PINE LIBRARY
Cập nhật Tools

Library "Tools"
Common tools
movingAverage(maType, maSource, maLength)
dynamically returns MA
Parameters:
maType (string): ma type
maSource (float): ma source
maLength (simple int): ma length
Returns: ta.{sma,rma,ema,wma,vwma,hma}
Common tools
movingAverage(maType, maSource, maLength)
dynamically returns MA
Parameters:
maType (string): ma type
maSource (float): ma source
maLength (simple int): ma length
Returns: ta.{sma,rma,ema,wma,vwma,hma}
Phát hành các Ghi chú
v2Added:
isFracHighBW(srcHigh)
Returns bool regarding candle[2] can be marked as BW High Fractal
Parameters:
srcHigh (float): float[] Series source for high fractal marking. Default: high
Returns: boolean
isFracLowBW(srcLow)
Returns bool regarding candle[2] can be marked as BW Low Fractal
Parameters:
srcLow (float): float[] Series source for low fractal marking. Default: low
Returns: boolean
getFracMarkBW(isHighMark, isLowMark, lastHigh, lastLow, srcHigh, srcLow)
Returns int between -2 and 2. 2: HH, 1: LH, 0: No condition met, -1: HL, -2: LL
Parameters:
isHighMark (bool): bool Is candle[2] marked as high
isLowMark (bool): bool Is candle[2] marked as low
lastHigh (float): float Last value of high mark
lastLow (float): float Last value of low mark
srcHigh (float): float[] Series source for high fractal marking. Default: high
srcLow (float): float[] Series source for low fractal marking. Default: low
Returns: int -2, -1, 0, 1, 2
PosInfo
PosInfo - Position info object
Fields:
isBuy (series bool): bool Is position buy
entry (series float): float Entry price
index (series int): int Entry bar index
lastTP (series float): float Last take profit price
lastRE (series float): float Last re-entry price
Updated:
movingAverage(maType, maSource, maLength)
Dynamically returns desired moving average type
Parameters:
maType (string): string Moving average type
maSource (float): float[] Source series for moving average
maLength (simple int): int Length for moving average
Returns: float[] ta.{sma,rma,ema,wma,vwma,hma}
Phát hành các Ghi chú
v3Updated:
PosInfo
PosInfo - Position info object
Fields:
isBuy (series bool): bool Is position buy
entry (series float): float Entry price
index (series int): int Entry bar index. Default: bar_index
lastTP (series float): float Last take profit price. Default: 0
lastRE (series float): float Last re-entry price. Default: 0
Phát hành các Ghi chú
v4Added:
PosTPInfo
PosTPInfo - Position Take Profit info object
Fields:
price (float): float Take profit price
when (int): int Take profit bar time UNIX. Default: time
mark (float): float Take profit source mark price value. Default: na
markWhen (int): int Take profit source mark bar time UNIX. Default: na
PosREInfo
PosREInfo - Position Re-Entry info object
Fields:
price (float): float Re-entry price
when (int): int Re-entry bar time UNIX. Default: time
mark (float): float Re-entry source mark price value. Default: na
markWhen (int): int Re-entry source mark bar time UNIX. Default: na
Updated:
PosInfo
PosInfo - Position info object
Fields:
state (PosState): <PosState> Position state
price (float): float Entry price
when (int): int Entry bar time UNIX. Default: time
tp (array<PosTPInfo>): PosTPInfo[] Take profit info. Default: na
re (array<PosREInfo>): PosREInfo[] Re-entry info. Default: na
Phát hành các Ghi chú
v5Added:
processFractals(fractals, srcHigh, srcLow)
Returns Fractals after processing
Parameters:
fractals (Fractals): Fractals container object to be used. Default: na
srcHigh (float): float[] Series source for high fractal marking. Default: high
srcLow (float): float[] Series source for low fractal marking. Default: low
Returns: Fractals
FracInfo
FracInfo - Fractal mark info object
Fields:
mark (series FracMark): <FracMark> Fractal mark
price (series float): float Fractal price
when (series int): int Fractal bar time UNIX. Default: time
Fractals
Fractals - Fractal container object
Fields:
hh (array<FracInfo>): FracInfo[] Higher high fractals
lh (array<FracInfo>): FracInfo[] Lower high fractals
hl (array<FracInfo>): FracInfo[] Higher low fractals
ll (array<FracInfo>): FracInfo[] Lower low fractals
lastHigh (series float): float Last high mark fractal value
lastLow (series float): float Last low mark fractal value
Phát hành các Ghi chú
v6Updated:
getFracMarkBW(srcHigh, srcLow)
Returns int between -2 and 2. 2: HH, 1: LH, 0: No condition met, -1: HL, -2: LL
Parameters:
srcHigh (float): float[] Series source for high fractal marking. Default: high
srcLow (float): float[] Series source for low fractal marking. Default: low
Returns: array -2, -1, 0, 1, 2
FracInfo
FracInfo - Fractal mark info object
Fields:
mark (series FracMark): <FracMark> Fractal mark
price (series float): float Fractal price
when (series int): int Fractal bar time UNIX. Default: time
markWhen (series int): int Fractal mark bar time UNIX. Default: time
Fractals
Fractals - Fractal container object
Fields:
hh (array<FracInfo>): FracInfo[] Higher high fractals
lh (array<FracInfo>): FracInfo[] Lower high fractals
hl (array<FracInfo>): FracInfo[] Higher low fractals
ll (array<FracInfo>): FracInfo[] Lower low fractals
isHigh (series bool): bool Is current candle marked a high fractal
isLow (series bool): bool Is current candle marked a low fractal
isHH (series bool): bool Is current candle marked a higher high fractal
isLH (series bool): bool Is current candle marked a lower high fractal
isHL (series bool): bool Is current candle marked a higher low fractal
isLL (series bool): bool Is current candle marked a lower low fractal
Phát hành các Ghi chú
v7Updated:
FracInfo
FracInfo - Fractal mark info object
Fields:
mark (series FracMark): <FracMark> Fractal mark
price (series float): float Fractal price
when (series int): int Fractal bar time UNIX. Default: time
markWhen (series int): int Fractal mark bar time UNIX. Default: time
boPrice (series float): float Fractal breakout price. Default: na
boTime (series int): int Fractal breakout bar time UNIX. Default: time
Phát hành các Ghi chú
v8Added:
new_pos(state, price, when)
Returns new PosInfo object
Parameters:
state (series PosState): <PosState> Position state
price (float): float Entry price
when (int): int Entry bar time UNIX. Default: time
Returns: PosInfo
Phát hành các Ghi chú
v9Updated:
PosInfo
PosInfo - Position info object
Fields:
state (series PosState): <PosState> Position state
price (series float): float Entry price
when (series int): int Entry bar time UNIX. Default: time
tp (array<PosTPInfo>): PosTPInfo[] Take profit info. Default: na
re (array<PosREInfo>): PosREInfo[] Re-entry info. Default: na
infoInt (map<string, int>): map<string, int> Integer holder map. Default: na
infoFloat (map<string, float>): map<string, float> Float holder map. Default: na
Phát hành các Ghi chú
v10Join with map tools.
Phát hành các Ghi chú
v11Updated:
FracInfo
FracInfo - Fractal mark info object
Fields:
mark (series FracMark): <FracMark> Fractal mark
price (series float): float Fractal price
when (series int): int Fractal bar time UNIX. Default: time
index (series int)
markWhen (series int): int Fractal mark bar time UNIX. Default: time
markIndex (series int)
boPrice (series float): float Fractal breakout price. Default: na
boTime (series int): int Fractal breakout bar time UNIX. Default: time
boIndex (series int): int Fractal breakout bar index. Default: time
Phát hành các Ghi chú
v12Updated:
processFractals(fractals, srcHigh, srcLow, hhBoLb, llBoLb)
Returns Fractals after processing
Parameters:
fractals (Fractals): Fractals container object to be used. Default: na
srcHigh (float): source for high fractal marking. Default: high
srcLow (float): source for low fractal marking. Default: low
hhBoLb (int): Higher high brakout loopback count. Default: 0
llBoLb (int): Lower loe brakout loopback count. Default: 0
Returns: Fractals
Phát hành các Ghi chú
v13- Updated to Pine v6
- Pos related helpers moved to ToolsPos
Added:
Info
Info - General purpose info object
Fields:
si (map<string, int>): map<string, int> String key, integer value info holder map. Default: na
sf (map<string, float>): map<string, float> String key, float value info holder map. Default: na
sb (map<string, bool>): map<string, bool> String key, boolean value info holder map. Default: na
ss (map<string, string>): map<string, string> String key, string value info holder map. Default: na
sc (map<string, color>): map<string, colour> String key, color value info holder map. Default: na
Updated:
processFractals(fractals, srcHigh, srcLow, hhBoLb, llBoLb)
Returns Fractals after processing
Parameters:
fractals (Fractals): Fractals container object to be used. Default: na
srcHigh (float): source for high fractal marking. Default: high
srcLow (float): source for low fractal marking. Default: low
hhBoLb (int): Higher high brakout lookback count. Default: 0
llBoLb (int): Lower low brakout lookback count. Default: 0
Returns: Fractals
Removed:
new_pos(state, price, when)
Returns new PosInfo object
PosTPInfo
PosTPInfo - Position Take Profit info object
PosREInfo
PosREInfo - Position Re-Entry info object
PosInfo
PosInfo - Position info object
Phát hành các Ghi chú
v14Added:
new_info(init, si, sf, sb, ss, sc)
Returns new Info object
Parameters:
init (bool): bool Initalise maps for na maps. Default: true
si (map<string, int>): map<string, int> String key, integer value info holder map. Default: na
sf (map<string, float>): map<string, float> String key, float value info holder map. Default: na
sb (map<string, bool>): map<string, bool> String key, boolean value info holder map. Default: na
ss (map<string, string>): map<string, string> String key, string value info holder map. Default: na
sc (map<string, color>): map<string, colour> String key, color value info holder map. Default: na
Returns: Info
Phát hành các Ghi chú
v15Added:
typeof(value)
Parameters:
value (color)
set_info(info, key, value)
Parameters:
info (Info)
key (string)
value (color)
Removed:
new_info(init, si, sf, sb, ss, sc)
Returns new Info object
Phát hành các Ghi chú
v16Pine Script Syntax Migration:
- Currently, the `to_num` part of the loop's header cannot change after the loop begins. Starting next week, scripts will be able to change the `to_num` value on any loop iteration.
Removed:
set_info(info, key, value)
Info
Info - General purpose info object
Thư viện Pine
Theo tinh thần TradingView thực sự, tác giả đã xuất bản mã Pine này dưới dạng thư viện nguồn mở để các lập trình viên Pine khác trong cộng đồng của chúng tôi có thể sử dụng lại. Xin tri ân tác giả! Bạn có thể sử dụng thư viện này riêng tư hoặc trong các bài đăng nguồn mở khác. Tuy nhiên, bạn cần sử dụng lại mã này theo Nội quy chung.
Thông báo miễn trừ trách nhiệm
Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.
Thư viện Pine
Theo tinh thần TradingView thực sự, tác giả đã xuất bản mã Pine này dưới dạng thư viện nguồn mở để các lập trình viên Pine khác trong cộng đồng của chúng tôi có thể sử dụng lại. Xin tri ân tác giả! Bạn có thể sử dụng thư viện này riêng tư hoặc trong các bài đăng nguồn mở khác. Tuy nhiên, bạn cần sử dụng lại mã này theo Nội quy chung.
Thông báo miễn trừ trách nhiệm
Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.