PINE LIBRARY
FibonacciRetracement

Hi all!
This library will help you draw Fibonacci retracement levels (zones). The code is from my indicator "Fibonacci retracement" (tradingview.com/script/yFIioDwi-Fibonacci-retracement/). You can see that description for more information about the behaviour and example of how to use this library. The code is almost the same with the addition of alerts. If the alert frequency is 'alert.freq_once_per_bar_close' alert messages will be concatenated and have a header saying how many messages it contains (if it's more than 1).
Hope this is of help!
Library "FibonacciRetracement"
ConcateAlerts(context)
Concatenates all alerts from the bar to one string (separated by new lines) and clears alert messages on the current bar.
Parameters:
context (Context)
AddAlert(context, message, unshiftInsteadOfPush)
Parameters:
context (Context)
message (string)
unshiftInsteadOfPush (bool)
Range(context, structure, settings)
Will return values if new levels/zones should be drawn.
Parameters:
context (Context): The 'Context' for the Fibonacci retracement.
structure (Structure type from mickes/PriceAction/1): The current 'Structure' from the 'MarketStructure' library.
settings (Settings): The 'Settings' object for the 'Context'.
Returns: A tuple with the start and end pivot if new zones should be drawn, '[na, na]' otherwise.
DrawAll(context, settings, start, end)
Draws lines and labels for the zone. It will also set the 'Price' value that will be used for absolute positions.
Parameters:
context (Context): The 'Context' for the Fibonacci retracement.
settings (Settings): The 'Settings' object for the 'Context'.
start (Pivot type from mickes/PriceAction/1)
end (Pivot type from mickes/PriceAction/1)
AlertActive(context, settings)
Will alert for all zones that are active. If multiple alert messages are added they will be concatenated (separated by a new line) with a header saying how many messages the alert contains.
Parameters:
context (Context): The 'Context' for the Fibonacci retracement. This contains the zones that will be alerted if price (wick or close according to the settings) enters it.
settings (Settings): The 'Settings' object for the 'Context'.
TrendlineSettings
Holds all the values for 'TrendlineSettings'.
Fields:
Enabled (series bool): If the trendline should be visible or not.
Color (series color): The color of the trendline.
Style (series string): The style of the trendline (as a string).
GenericZonesSettings
Holds all the values for 'GenericZonesSettings', that will be applicable to all drawn objects.
Fields:
ExtendRight (series bool): If all lines should extend to the right or not.
Style (series string): The style of all drawn lines
Reverse (series bool): If true, all lines will be reversed.
Prices (series bool): If price levels should be shown or not.
Levels (series bool): If levels should be shown or not.
LevelsValue (series string): Either 'Value' or 'Percent'. Defined if value or percentage should be shown.
FontSize (series int): The for size of the text in labels drawn.
LabelsPosition (series string): Coul be 'Left', 'Rigth' or 'Adapt'. 'Adapt' will try to adapt the labels position to the prices.
ZoneSettings
Holds all the values for 'ZoneSettings'.
Fields:
Enabled (series bool): If this zone is enabled or not.
Level (series float): The level of the zone.
Color (series color): The color that will be displayed.
Price (series float): The price of the level. Will be set internally.
Settings
Holds all the values for 'Settings'.
Fields:
PivotLeftLength (series int): The left length used to find pivots through the 'MarketStructure' library.
PivotRightLength (series int): The right length used to find pivots through the 'MarketStructure' library.
Trendline (TrendlineSettings): The settings for the 'Trendline' object.
GenericZonesSettings (GenericZonesSettings): The setting applicable to all zones.
AlertFrequency (series string): The frequency for the alerts. If 'alert.freq_once_per_bar_close', alert messages will be concatenated and have a header saying how many messages it contains (if it's more than 1).
AlertPrice (series string): The price that has to enter a zone. Can be 'Close' (the closing price) or 'Wick' (the whole candle needs to be in the zone).
Zone1 (ZoneSettings): The 'ZoneSettings' that represents this zone.
Zone2 (ZoneSettings): The 'ZoneSettings' that represents this zone.
Zone3 (ZoneSettings): The 'ZoneSettings' that represents this zone.
Zone4 (ZoneSettings): The 'ZoneSettings' that represents this zone.
Zone5 (ZoneSettings): The 'ZoneSettings' that represents this zone.
Zone6 (ZoneSettings): The 'ZoneSettings' that represents this zone.
Zone7 (ZoneSettings): The 'ZoneSettings' that represents this zone.
Zone8 (ZoneSettings): The 'ZoneSettings' that represents this zone.
Zone9 (ZoneSettings): The 'ZoneSettings' that represents this zone.
Zone10 (ZoneSettings): The 'ZoneSettings' that represents this zone.
Zone11 (ZoneSettings): The 'ZoneSettings' that represents this zone.
Zone12 (ZoneSettings): The 'ZoneSettings' that represents this zone.
Zone13 (ZoneSettings): The 'ZoneSettings' that represents this zone.
Zone14 (ZoneSettings): The 'ZoneSettings' that represents this zone.
Zone15 (ZoneSettings): The 'ZoneSettings' that represents this zone.
Zone16 (ZoneSettings): The 'ZoneSettings' that represents this zone.
Zone17 (ZoneSettings): The 'ZoneSettings' that represents this zone.
Zone18 (ZoneSettings): The 'ZoneSettings' that represents this zone.
Zone19 (ZoneSettings): The 'ZoneSettings' that represents this zone.
Zone20 (ZoneSettings): The 'ZoneSettings' that represents this zone.
Zone21 (ZoneSettings): The 'ZoneSettings' that represents this zone.
Zone22 (ZoneSettings): The 'ZoneSettings' that represents this zone.
Zone23 (ZoneSettings): The 'ZoneSettings' that represents this zone.
Zone24 (ZoneSettings): The 'ZoneSettings' that represents this zone.
Context
Holds all the values for 'Context'.
Fields:
Lines (array<line>): All the drawn lines for the current 'Context'.
Labels (array<label>): All the drawn labels for the current 'Context'.
Boxes (array<box>): All the drawn boxes for the current 'Context'.
Alerts (array<string>): All the alert messages on the current tick.
Start (series int): The start bar index of the current 'Context'.
This library will help you draw Fibonacci retracement levels (zones). The code is from my indicator "Fibonacci retracement" (tradingview.com/script/yFIioDwi-Fibonacci-retracement/). You can see that description for more information about the behaviour and example of how to use this library. The code is almost the same with the addition of alerts. If the alert frequency is 'alert.freq_once_per_bar_close' alert messages will be concatenated and have a header saying how many messages it contains (if it's more than 1).
Hope this is of help!
Library "FibonacciRetracement"
ConcateAlerts(context)
Concatenates all alerts from the bar to one string (separated by new lines) and clears alert messages on the current bar.
Parameters:
context (Context)
AddAlert(context, message, unshiftInsteadOfPush)
Parameters:
context (Context)
message (string)
unshiftInsteadOfPush (bool)
Range(context, structure, settings)
Will return values if new levels/zones should be drawn.
Parameters:
context (Context): The 'Context' for the Fibonacci retracement.
structure (Structure type from mickes/PriceAction/1): The current 'Structure' from the 'MarketStructure' library.
settings (Settings): The 'Settings' object for the 'Context'.
Returns: A tuple with the start and end pivot if new zones should be drawn, '[na, na]' otherwise.
DrawAll(context, settings, start, end)
Draws lines and labels for the zone. It will also set the 'Price' value that will be used for absolute positions.
Parameters:
context (Context): The 'Context' for the Fibonacci retracement.
settings (Settings): The 'Settings' object for the 'Context'.
start (Pivot type from mickes/PriceAction/1)
end (Pivot type from mickes/PriceAction/1)
AlertActive(context, settings)
Will alert for all zones that are active. If multiple alert messages are added they will be concatenated (separated by a new line) with a header saying how many messages the alert contains.
Parameters:
context (Context): The 'Context' for the Fibonacci retracement. This contains the zones that will be alerted if price (wick or close according to the settings) enters it.
settings (Settings): The 'Settings' object for the 'Context'.
TrendlineSettings
Holds all the values for 'TrendlineSettings'.
Fields:
Enabled (series bool): If the trendline should be visible or not.
Color (series color): The color of the trendline.
Style (series string): The style of the trendline (as a string).
GenericZonesSettings
Holds all the values for 'GenericZonesSettings', that will be applicable to all drawn objects.
Fields:
ExtendRight (series bool): If all lines should extend to the right or not.
Style (series string): The style of all drawn lines
Reverse (series bool): If true, all lines will be reversed.
Prices (series bool): If price levels should be shown or not.
Levels (series bool): If levels should be shown or not.
LevelsValue (series string): Either 'Value' or 'Percent'. Defined if value or percentage should be shown.
FontSize (series int): The for size of the text in labels drawn.
LabelsPosition (series string): Coul be 'Left', 'Rigth' or 'Adapt'. 'Adapt' will try to adapt the labels position to the prices.
ZoneSettings
Holds all the values for 'ZoneSettings'.
Fields:
Enabled (series bool): If this zone is enabled or not.
Level (series float): The level of the zone.
Color (series color): The color that will be displayed.
Price (series float): The price of the level. Will be set internally.
Settings
Holds all the values for 'Settings'.
Fields:
PivotLeftLength (series int): The left length used to find pivots through the 'MarketStructure' library.
PivotRightLength (series int): The right length used to find pivots through the 'MarketStructure' library.
Trendline (TrendlineSettings): The settings for the 'Trendline' object.
GenericZonesSettings (GenericZonesSettings): The setting applicable to all zones.
AlertFrequency (series string): The frequency for the alerts. If 'alert.freq_once_per_bar_close', alert messages will be concatenated and have a header saying how many messages it contains (if it's more than 1).
AlertPrice (series string): The price that has to enter a zone. Can be 'Close' (the closing price) or 'Wick' (the whole candle needs to be in the zone).
Zone1 (ZoneSettings): The 'ZoneSettings' that represents this zone.
Zone2 (ZoneSettings): The 'ZoneSettings' that represents this zone.
Zone3 (ZoneSettings): The 'ZoneSettings' that represents this zone.
Zone4 (ZoneSettings): The 'ZoneSettings' that represents this zone.
Zone5 (ZoneSettings): The 'ZoneSettings' that represents this zone.
Zone6 (ZoneSettings): The 'ZoneSettings' that represents this zone.
Zone7 (ZoneSettings): The 'ZoneSettings' that represents this zone.
Zone8 (ZoneSettings): The 'ZoneSettings' that represents this zone.
Zone9 (ZoneSettings): The 'ZoneSettings' that represents this zone.
Zone10 (ZoneSettings): The 'ZoneSettings' that represents this zone.
Zone11 (ZoneSettings): The 'ZoneSettings' that represents this zone.
Zone12 (ZoneSettings): The 'ZoneSettings' that represents this zone.
Zone13 (ZoneSettings): The 'ZoneSettings' that represents this zone.
Zone14 (ZoneSettings): The 'ZoneSettings' that represents this zone.
Zone15 (ZoneSettings): The 'ZoneSettings' that represents this zone.
Zone16 (ZoneSettings): The 'ZoneSettings' that represents this zone.
Zone17 (ZoneSettings): The 'ZoneSettings' that represents this zone.
Zone18 (ZoneSettings): The 'ZoneSettings' that represents this zone.
Zone19 (ZoneSettings): The 'ZoneSettings' that represents this zone.
Zone20 (ZoneSettings): The 'ZoneSettings' that represents this zone.
Zone21 (ZoneSettings): The 'ZoneSettings' that represents this zone.
Zone22 (ZoneSettings): The 'ZoneSettings' that represents this zone.
Zone23 (ZoneSettings): The 'ZoneSettings' that represents this zone.
Zone24 (ZoneSettings): The 'ZoneSettings' that represents this zone.
Context
Holds all the values for 'Context'.
Fields:
Lines (array<line>): All the drawn lines for the current 'Context'.
Labels (array<label>): All the drawn labels for the current 'Context'.
Boxes (array<box>): All the drawn boxes for the current 'Context'.
Alerts (array<string>): All the alert messages on the current tick.
Start (series int): The start bar index of the current 'Context'.
파인 라이브러리
진정한 트레이딩뷰 정신에 따라 작성자는 이 파인 코드를 오픈 소스 라이브러리로 공개하여 커뮤니티의 다른 파인 프로그래머들이 재사용할 수 있도록 했습니다. 작성자에게 건배! 이 라이브러리는 개인적으로 또는 다른 오픈 소스 출판물에서 사용할 수 있지만, 출판물에서 이 코드를 재사용하는 것은 하우스 룰의 적용을 받습니다.
면책사항
이 정보와 게시물은 TradingView에서 제공하거나 보증하는 금융, 투자, 거래 또는 기타 유형의 조언이나 권고 사항을 의미하거나 구성하지 않습니다. 자세한 내용은 이용 약관을 참고하세요.
파인 라이브러리
진정한 트레이딩뷰 정신에 따라 작성자는 이 파인 코드를 오픈 소스 라이브러리로 공개하여 커뮤니티의 다른 파인 프로그래머들이 재사용할 수 있도록 했습니다. 작성자에게 건배! 이 라이브러리는 개인적으로 또는 다른 오픈 소스 출판물에서 사용할 수 있지만, 출판물에서 이 코드를 재사용하는 것은 하우스 룰의 적용을 받습니다.
면책사항
이 정보와 게시물은 TradingView에서 제공하거나 보증하는 금융, 투자, 거래 또는 기타 유형의 조언이나 권고 사항을 의미하거나 구성하지 않습니다. 자세한 내용은 이용 약관을 참고하세요.