Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
- // © rapmadarang
- //@version=5
- indicator(title="Moving Fib Based on Donchain/Pivot/BB", overlay=true)
- //---------------------------------------------------------------------------------------------------------------------//
- //General input
- //---------------------------------------------------------------------------------------------------------------------//
- Basis_of_HL = input.string("Donchain",title="High Low Basis",options=["Donchain","Pivot","Bollinger Bands"],tooltip="This will determine which point the indicator will consider as the high and low for the Fibonacci overlay.")
- Bias=input.string("Bull",options=["Bull","Bear"], tooltip = "This will determine where the Fibonacci overlay will start, whether it is from the low or high. Select 'Bull' for standard Fib, and choose 'Bear' for reverse Fib")
- period_length=input.int(200,title = "Period Length", group="Donchain", tooltip = "This will determine how many periods the indicator will consider when determining the high and low, if the setting is configured for Donchian.")
- donchain_src = input(close, title="Source",group="Donchain")
- //Pivot Settings
- leftLenH = input.int(title="Pivot High", defval=20, minval=1, inline="Pivot High", group="Pivot Settings")
- rightLenH = input.int(title="/", defval=20, minval=1, inline="Pivot High", group="Pivot Settings")
- leftLenL = input.int(title="Pivot Low", defval=20, minval=1, inline="Pivot Low", group="Pivot Settings")
- rightLenL = input.int(title="/", defval=20, minval=1, inline="Pivot Low", group="Pivot Settings")
- //Bollinger Bands Settings
- length = input.int(20, minval=1,group="Bollinger Bands Settings")
- maType = input.string("SMA", "Basis MA Type", options = ["SMA", "EMA", "SMMA (RMA)", "WMA", "VWMA"],group="Bollinger Bands Settings")
- src = input(close, title="Source",group="Bollinger Bands Settings")
- mult = input.float(2.0, minval=0.001, maxval=50, title="StdDev",group="Bollinger Bands Settings")
- //Log Scale toggle
- Log_scale =input.bool(false,title="Fib levels on log scale")
- //Background Color, Fill and Transparency Settings
- Background_color_bool=input.string("Multi Color",title="Background Color Fill",options=["Multi Color","Single Color"],group="Background",
- tooltip="Provides the option to switch between a multi-color background, a single-color background, or no background.")
- Background_color_color=input.color(color.rgb(33, 149, 243, 80),title="Color",group="Background",
- tooltip="Provides an option to select background and line colors when the Background Color Fill is toggled to Single Color.")
- //Labels Settings
- Labels_toggle = input.bool(true,title="Labels",group="Labels",inline="label")
- Label_prices = input.bool(true,title="Show Prices", group="Labels")
- Label_int_float = input.string("Decimal",title=" ",options=["Decimal","Percent"] ,group="Labels",inline="label")
- line_width = input.int(1,title="Line Width",group="Line Settings")
- //Fib levels customization
- first_line_bool = input.bool(true,inline="1st line",title="",group="Fibonacci Levels")
- first_line_float = input.float(0,inline="1st line",title=" ",group="Fibonacci Levels")
- first_line_color = input.color(color.rgb(43, 42, 42),inline="1st line",title="",group="Fibonacci Levels")
- second_line_bool = input.bool(true,inline="2nd line",title="",group="Fibonacci Levels")
- second_line_float = input.float(0.236,inline="2nd line",title=" ",group="Fibonacci Levels")
- second_line_color = input.color(color.rgb(243, 33, 33),inline="2nd line",title="",group="Fibonacci Levels")
- third_line_bool = input.bool(true,inline="3rd line",title="",group="Fibonacci Levels")
- third_line_float = input.float(0.382,inline="3rd line",title=" ",group="Fibonacci Levels")
- third_line_color = input.color(color.rgb(138, 196, 30),inline="3rd line",title="",group="Fibonacci Levels")
- fourth_line_bool = input.bool(true,inline="4th line",title="",group="Fibonacci Levels")
- fourth_line_float = input.float(0.5,inline="4th line",title=" ",group="Fibonacci Levels")
- fourth_line_color = input.color(color.rgb(81, 182, 22),inline="4th line",title="",group="Fibonacci Levels")
- fifth_line_bool = input.bool(true,inline="5th line",title="",group="Fibonacci Levels")
- fifth_line_float = input.float(0.618,inline="5th line",title=" ",group="Fibonacci Levels")
- fifth_line_color = input.color(color.rgb(36, 109, 49),inline="5th line",title="",group="Fibonacci Levels")
- sixth_line_bool = input.bool(true,inline="6th line",title="",group="Fibonacci Levels")
- sixth_line_float = input.float(0.786,inline="6th line",title=" ",group="Fibonacci Levels")
- sixth_line_color = input.color(color.rgb(47, 101, 145),inline="6th line",title="",group="Fibonacci Levels")
- seventh_line_bool = input.bool(true,inline="7th line",title="",group="Fibonacci Levels")
- seventh_line_float = input.float(1,inline="7th line",title=" ",group="Fibonacci Levels")
- seventh_line_color = input.color(color.rgb(43, 42, 42),inline="7th line",title="",group="Fibonacci Levels")
- //Fib extension customization
- first_extension_bool = input.bool(true,inline="1st extension",title="",group="Fibonacci Extension")
- first_extension_float = input.float(1.272,inline="1st extension",title=" ",group="Fibonacci Extension")
- first_extension_color = input.color(color.rgb(57, 23, 149),inline="1st extension",title="",group="Fibonacci Extension")
- second_extension_bool = input.bool(false,inline="2nd extension",title="",group="Fibonacci Extension")
- second_extension_float = input.float(1.618,inline="2nd extension",title=" ",group="Fibonacci Extension")
- second_extension_color = input.color(color.rgb(23, 120, 149),inline="2nd extension",title="",group="Fibonacci Extension")
- third_extension_bool = input.bool(false,inline="3rd extension",title="",group="Fibonacci Extension")
- third_extension_float = input.float(2,inline="3rd extension",title=" ",group="Fibonacci Extension")
- third_extension_color = input.color(color.rgb(23, 149, 101),inline="3rd extension",title="",group="Fibonacci Extension")
- fourth_extension_bool = input.bool(false,inline="4th extension",title="",group="Fibonacci Extension")
- fourth_extension_float = input.float(2.414,inline="4th extension",title=" ",group="Fibonacci Extension")
- fourth_extension_color = input.color(color.rgb(44, 149, 23),inline="4th extension",title="",group="Fibonacci Extension")
- fifth_extension_bool = input.bool(false,inline="5th extension",title="",group="Fibonacci Extension")
- fifth_extension_float = input.float(2.618,inline="5th extension",title=" ",group="Fibonacci Extension")
- fifth_extension_color = input.color(color.rgb(147, 149, 23),inline="5th extension",title="",group="Fibonacci Extension")
- sixth_extension_bool = input.bool(false,inline="6th extension",title="",group="Fibonacci Extension")
- sixth_extension_float = input.float(2.718,inline="6th extension",title=" ",group="Fibonacci Extension")
- sixth_extension_color = input.color(color.rgb(149, 80, 23),inline="6th extension",title="",group="Fibonacci Extension")
- seventh_extension_bool = input.bool(false,inline="7th extension",title="",group="Fibonacci Extension")
- seventh_extension_float = input.float(3.141,inline="7th extension",title=" ",group="Fibonacci Extension")
- seventh_extension_color = input.color(color.rgb(149, 23, 23),inline="7th extension",title="",group="Fibonacci Extension")
- eight_extension_bool = input.bool(false,inline="8th extension",title="",group="Fibonacci Extension")
- eight_extension_float = input.float(3.618,inline="8th extension",title=" ",group="Fibonacci Extension")
- eight_extension_color = input.color(color.rgb(149, 23, 101),inline="8th extension",title="",group="Fibonacci Extension")
- ninth_extension_bool = input.bool(false,inline="9th extension",title="",group="Fibonacci Extension")
- ninth_extension_float = input.float(4.236,inline="9th extension",title=" ",group="Fibonacci Extension")
- ninth_extension_color = input.color(color.rgb(103, 23, 149),inline="9th extension",title="",group="Fibonacci Extension")
- //Fib Fill Customization
- main_1st_block_fill = input.color(color.rgb(243, 33, 33, 90),title="Block 1",group="Fib BG Color")
- main_2nd_block_fill =input.color(color.rgb(138, 196, 30, 90),title="Block 2",group="Fib BG Color")
- main_3rd_block_fill =input.color(color.rgb(138, 196, 30, 90),title="Block 3",group="Fib BG Color")
- main_4th_block_fill =input.color(color.rgb(30, 196, 182, 90),title="Block 4",group="Fib BG Color")
- main_5th_block_fill =input.color(color.rgb(36, 53, 109, 90),title="Block 5",group="Fib BG Color")
- main_6th_block_fill =input.color(color.rgb(43, 42, 42, 90),title="Block 6",group="Fib BG Color")
- ex_7th_block_fill =input.color(color.rgb(243, 33, 177, 90),title="Block 7",group="Fib BG Color")
- ex_8th_block_fill =input.color(color.rgb(33, 44, 243, 90),title="Block 8",group="Fib BG Color")
- ex_9th_block_fill =input.color(color.rgb(8, 143, 210, 90),title="Block 9",group="Fib BG Color")
- ex_10th_block_fill =input.color(color.rgb(8, 210, 62, 90),title="Block 10",group="Fib BG Color")
- ex_11th_block_fill =input.color(color.rgb(8, 149, 210, 90),title="Block 11",group="Fib BG Color")
- ex_12th_block_fill =input.color(color.rgb(8, 210, 72, 90),title="Block 12",group="Fib BG Color")
- ex_13th_block_fill =input.color(color.rgb(210, 170, 8, 90),title="Block 13",group="Fib BG Color")
- ex_14th_block_fill =input.color(color.rgb(149, 8, 210, 90),title="Block 14",group="Fib BG Color")
- ex_15th_block_fill =input.color(color.rgb(207, 8, 210, 90),title="Block 15",group="Fib BG Color")
- //---------------------------------------------------------------------------------------------------------------------//
- //Calculate the highest and lowest price of the selected time frame
- //---------------------------------------------------------------------------------------------------------------------//
- var float highest_price = na
- var float lowest_price = na
- if Basis_of_HL=="Donchain"
- highest_price := ta.highest(Log_scale==true ? math.log(high) : high,period_length)
- lowest_price := ta.lowest(Log_scale==true ? math.log(low) : low,period_length)
- ph = ta.pivothigh(leftLenH, rightLenH)
- pl = ta.pivotlow(leftLenL, rightLenL)
- var float pivot_high = high
- var float pivot_low = low
- pivot_high := ph !=0 ? ph : pivot_high
- pivot_low := pl !=0 ? pl : pivot_low
- if Basis_of_HL=="Pivot"
- highest_price := Log_scale==false ? pivot_high : math.log(pivot_high)
- lowest_price := Log_scale==false ? pivot_low : math.log(pivot_low)
- ma(source, length, _type) =>
- switch _type
- "SMA" => ta.sma(source, length)
- "EMA" => ta.ema(source, length)
- "SMMA (RMA)" => ta.rma(source, length)
- "WMA" => ta.wma(source, length)
- "VWMA" => ta.vwma(source, length)
- basis = ma(src, length, maType)
- dev = mult * ta.stdev(src, length)
- upper = basis + dev
- lower = basis - dev
- if Basis_of_HL=="Bollinger Bands"
- highest_price := Log_scale==false ? upper : math.log(upper)
- lowest_price := Log_scale==false ? lower : math.log(lower)
- //Calculated Fibonacci retracement levels
- //Bull
- fib0 = highest_price
- fib236 = highest_price - (highest_price - lowest_price) * second_line_float
- fib382 = highest_price - (highest_price - lowest_price) * third_line_float
- fib50 = highest_price - (highest_price - lowest_price) * fourth_line_float
- fib618 = highest_price - (highest_price - lowest_price) * fifth_line_float
- fib786 = highest_price - (highest_price - lowest_price) * sixth_line_float
- fib100 = lowest_price
- //Bear
- fib100B = highest_price
- fib786B = lowest_price - (lowest_price - highest_price) * sixth_line_float
- fib618B = lowest_price - (lowest_price - highest_price) * fifth_line_float
- fib50B = lowest_price - (lowest_price - highest_price) * fourth_line_float
- fib382B = lowest_price - (lowest_price - highest_price) * third_line_float
- fib236B = lowest_price - (lowest_price - highest_price) * second_line_float
- fib0B = lowest_price
- fx=highest_price
- f2=Bias=="Bull" and second_line_bool==true ? fib236
- :Bias=="Bear" and sixth_line_bool==true ? fib786B
- :na
- f3=Bias=="Bull" and third_line_bool==true ? fib382
- :Bias=="Bear" and fifth_line_bool==true ? fib618B
- :na
- f4=Bias=="Bull" and fourth_line_bool==true ? fib50
- :Bias=="Bear" and fourth_line_bool==true ? fib50B
- :na
- f5=Bias=="Bull" and fifth_line_bool==true ? fib618
- :Bias=="Bear" and third_line_bool==true ? fib382B
- :na
- f5b=Bias=="Bull" and sixth_line_bool==true ? fib786
- :Bias=="Bear" and second_line_bool==true ? fib236B
- :na
- fy=lowest_price
- //Calculations of Fibonacci extension levels
- //Bull
- ex_fib_1272 = highest_price - (highest_price - lowest_price) * first_extension_float
- ex_fib_1618 = highest_price - (highest_price - lowest_price) * second_extension_float
- ex_fib_2 = highest_price - (highest_price - lowest_price) * third_extension_float
- ex_fib_2414 = highest_price - (highest_price - lowest_price) * fourth_extension_float
- ex_fib_2618 = highest_price - (highest_price - lowest_price) * fifth_extension_float
- ex_fib_2718 = highest_price - (highest_price - lowest_price) * sixth_extension_float
- ex_fib_3141 = highest_price - (highest_price - lowest_price) * seventh_extension_float
- ex_fib_3618 = highest_price - (highest_price - lowest_price) * eight_extension_float
- ex_fib_4236 = highest_price - (highest_price - lowest_price) * ninth_extension_float
- //Bear
- ex_fib_1272B = lowest_price - (lowest_price - highest_price) * first_extension_float
- ex_fib_1618B = lowest_price - (lowest_price - highest_price) * second_extension_float
- ex_fib_2B = lowest_price - (lowest_price - highest_price) * third_extension_float
- ex_fib_2414B = lowest_price - (lowest_price - highest_price) * fourth_extension_float
- ex_fib_2618B = lowest_price - (lowest_price - highest_price) * fifth_extension_float
- ex_fib_2718B = lowest_price - (lowest_price - highest_price) * sixth_extension_float
- ex_fib_3141B = lowest_price - (lowest_price - highest_price) * seventh_extension_float
- ex_fib_3618B = lowest_price - (lowest_price - highest_price) * eight_extension_float
- ex_fib_4236B = lowest_price - (lowest_price - highest_price) * ninth_extension_float
- fex1=Bias=="Bull" and first_extension_bool==true ? ex_fib_1272
- :Bias=="Bear" and first_extension_bool==true ? ex_fib_1272B
- :na
- fex2=Bias=="Bull" and second_extension_bool==true ? ex_fib_1618
- :Bias=="Bear" and second_extension_bool==true ? ex_fib_1618B
- :na
- fex3=Bias=="Bull" and third_extension_bool==true ? ex_fib_2
- :Bias=="Bear" and third_extension_bool==true ? ex_fib_2B
- :na
- fex4=Bias=="Bull" and fourth_extension_bool==true ? ex_fib_2414
- :Bias=="Bear" and fourth_extension_bool==true ? ex_fib_2414B
- :na
- fex5=Bias=="Bull" and fifth_extension_bool==true ? ex_fib_2618
- :Bias=="Bear" and fifth_extension_bool==true ? ex_fib_2618B
- :na
- fex6=Bias=="Bull" and sixth_extension_bool==true ? ex_fib_2718
- :Bias=="Bear" and sixth_extension_bool==true ? ex_fib_2718B
- :na
- fex7=Bias=="Bull" and seventh_extension_bool==true ?ex_fib_3141
- :Bias=="Bear" and seventh_extension_bool==true? ex_fib_3141B
- :na
- fex8=Bias=="Bull" and eight_extension_bool==true ? ex_fib_3618
- :Bias=="Bear" and eight_extension_bool==true ? ex_fib_3618B
- :na
- fex9=Bias=="Bull"and ninth_extension_bool==true ?ex_fib_4236
- :Bias=="Bear" and ninth_extension_bool==true ? ex_fib_4236B
- :na
- //---------------------------------------------------------------------------------------------------------------------//
- //Plot and Fill Fibonacci retracement main levels
- //---------------------------------------------------------------------------------------------------------------------//
- plot(first_line_bool==true and Bias=="Bull" and Log_scale==true ? math.exp(fx) : seventh_line_bool==true and Bias=="Bear" and Log_scale==true ? math.exp(fx)
- :first_line_bool==true and Bias=="Bull" and Log_scale==false ? fx : seventh_line_bool==true and Bias=="Bear" and Log_scale==false ? fx : na
- ,color=Background_color_bool=="Single Color" ? Background_color_color
- :Bias=="Bull" ? first_line_color
- :Bias=="Bear" ? seventh_line_color : na, linewidth=line_width, style=plot.style_line)
- plot(Log_scale==true ? math.exp(f2) : f2, color=Background_color_bool=="Single Color" ? Background_color_color
- :Bias=="Bull" ? second_line_color
- :Bias=="Bear" ? sixth_line_color : na, linewidth=line_width, style=plot.style_line)
- plot(Log_scale==true ? math.exp(f3) : f3, color= Background_color_bool=="Single Color" ? Background_color_color
- :Bias=="Bull" ? third_line_color
- :Bias=="Bear" ? fifth_line_color : na , linewidth=line_width, style=plot.style_line)
- plot(Log_scale==true ? math.exp(f4) : f4, color=Background_color_bool=="Single Color" ? Background_color_color : fourth_line_color, linewidth=1, style=plot.style_line)
- plot(Log_scale==true ? math.exp(f5) : f5, color=Background_color_bool=="Single Color" ? Background_color_color
- :Bias=="Bull" ? fifth_line_color
- :Bias=="Bear" ? third_line_color : na , linewidth=line_width, style=plot.style_line)
- plot(Log_scale==true ? math.exp(f5b) : f5b,color=Background_color_bool=="Single Color" ? Background_color_color
- :Bias=="Bull" ? sixth_line_color
- :Bias=="Bear" ? second_line_color : na , linewidth=line_width, style=plot.style_line)
- plot(seventh_line_bool== true and Bias=="Bull" and Log_scale==true ? math.exp(fy) : first_line_bool==true and Bias=="Bear" and Log_scale==true ? math.exp(fy)
- :seventh_line_bool== true and Bias=="Bull" and Log_scale==false ? fy : first_line_bool==true and Bias=="Bear" and Log_scale==false ? fy : na
- ,color=Background_color_bool=="Single Color" ? Background_color_color
- :Bias=="Bull" ? seventh_line_color
- :Bias=="Bear" ? first_line_color : na, linewidth=line_width, style=plot.style_line)
- var count = 0
- count := count + 1
- var mainfib_float_sorted = array.new<float>()
- mainfib_float = array.from(f2,f3,f4,f5,f5b)
- for mainfib_sort in mainfib_float
- if count >= period_length
- array.push(mainfib_float_sorted,mainfib_sort)
- array.sort(mainfib_float_sorted, order.ascending)
- fill_line_1A = Bias=="Bull" ? highest_price : lowest_price
- fill_line_1B = Bias=="Bull" ? array.max(mainfib_float_sorted) : array.min(mainfib_float_sorted)
- fill1A = plot(Log_scale ==true ? math.exp(fill_line_1A) : fill_line_1A,color=color.rgb(255, 255, 255, 100))
- fill1B = plot(Log_scale ==true ? math.exp(fill_line_1B) : fill_line_1B,color=color.rgb(255, 255, 255, 100))
- fill(fill1A,fill1B, color = Background_color_bool=="Single Color" ? Background_color_color : main_1st_block_fill)
- index_of_fill_line_1B = array.binary_search(mainfib_float_sorted,fill_line_1B)
- if count >= period_length
- array.remove(mainfib_float_sorted,index_of_fill_line_1B)
- fill_line_2 = Bias=="Bull" ? array.max(mainfib_float_sorted) : array.min(mainfib_float_sorted)
- fill12 = plot(Log_scale ==true ? math.exp(fill_line_2) : fill_line_2,color=color.rgb(255, 255, 255, 100))
- fill(fill1B,fill12, color=Background_color_bool=="Single Color" ? Background_color_color : main_2nd_block_fill)
- index_of_fill_line_2 = array.binary_search(mainfib_float_sorted,fill_line_2)
- if count >= period_length
- array.remove(mainfib_float_sorted,index_of_fill_line_2)
- fill_line_3 = Bias=="Bull" ? array.max(mainfib_float_sorted) : array.min(mainfib_float_sorted)
- fill13 = plot(Log_scale ==true ? math.exp(fill_line_3) : fill_line_3,color=color.rgb(255, 255, 255, 100))
- fill(fill12,fill13, color=Background_color_bool=="Single Color" ? Background_color_color : main_3rd_block_fill)
- index_of_fill_line_3 = array.binary_search(mainfib_float_sorted,fill_line_3)
- if count >= period_length
- array.remove(mainfib_float_sorted,index_of_fill_line_3)
- fill_line_4 = Bias=="Bull" ? array.max(mainfib_float_sorted) : array.min(mainfib_float_sorted)
- fill14 = plot(Log_scale ==true ? math.exp(fill_line_4) : fill_line_4,color=color.rgb(255, 255, 255, 100))
- fill(fill13,fill14, color=Background_color_bool=="Single Color" ? Background_color_color : main_4th_block_fill)
- index_of_fill_line_4 = array.binary_search(mainfib_float_sorted,fill_line_4)
- if count >= period_length
- array.remove(mainfib_float_sorted,index_of_fill_line_4)
- fill_line_5 = Bias=="Bull" ? array.max(mainfib_float_sorted) : array.min(mainfib_float_sorted)
- fill15 = plot(Log_scale ==true ? math.exp(fill_line_5) : fill_line_5,color=color.rgb(255, 255, 255, 100))
- fill(fill14,fill15, color=Background_color_bool=="Single Color" ? Background_color_color : main_5th_block_fill)
- index_of_fill_line_5 = array.binary_search(mainfib_float_sorted,fill_line_5)
- if count >= period_length
- array.remove(mainfib_float_sorted,index_of_fill_line_5)
- mainfib_float_sorted := array.new<float>()
- fill_line_6 = Bias=="Bull" ? lowest_price : highest_price
- fill16 = plot(Log_scale ==true ? math.exp(fill_line_6) : fill_line_6,color=color.rgb(255, 255, 255, 100))
- fill(fill15,fill16, color=Background_color_bool=="Single Color" ? Background_color_color : main_6th_block_fill)
- //---------------------------------------------------------------------------------------------------------------------//
- //Plot Fibonacci Extensions
- //---------------------------------------------------------------------------------------------------------------------//
- plot(Log_scale ==true ? math.exp(fex1) : fex1, color= Background_color_bool=="Single Color" ? Background_color_color : first_extension_color, linewidth=line_width, style=plot.style_line)
- plot(Log_scale ==true ? math.exp(fex2) :fex2, color= Background_color_bool=="Single Color" ? Background_color_color : second_extension_color, linewidth=line_width, style=plot.style_line)
- plot(Log_scale ==true ? math.exp(fex3) :fex3, color=Background_color_bool=="Single Color" ? Background_color_color : third_extension_color, linewidth=line_width, style=plot.style_line)
- plot(Log_scale ==true ? math.exp(fex4) :fex4, color=Background_color_bool=="Single Color" ? Background_color_color : fourth_extension_color, linewidth=line_width, style=plot.style_line)
- plot(Log_scale ==true ? math.exp(fex5) :fex5, color= Background_color_bool=="Single Color" ? Background_color_color : fifth_extension_color, linewidth=line_width, style=plot.style_line)
- plot(Log_scale ==true ? math.exp(fex6) :fex6, color=Background_color_bool=="Single Color" ? Background_color_color :sixth_extension_color, linewidth=line_width, style=plot.style_line)
- plot(Log_scale ==true ? math.exp(fex7) :fex7, color=Background_color_bool=="Single Color" ? Background_color_color : seventh_extension_color, linewidth=line_width, style=plot.style_line)
- plot(Log_scale ==true ? math.exp(fex8) :fex8, color=Background_color_bool=="Single Color" ? Background_color_color : eight_extension_color, linewidth=line_width, style=plot.style_line)
- plot(Log_scale ==true ? math.exp(fex9) :fex9, color=Background_color_bool=="Single Color" ? Background_color_color : ninth_extension_color, linewidth=line_width, style=plot.style_line)
- //Array for Fib extension prices
- var Extension_Float_Sorted = array.new<float>()
- extension_float = array.from(fex1,fex2,fex3,fex4,fex5,fex6,fex7,fex8,fex9)
- for extension_sort in extension_float
- if extension_sort != 0
- array.push(Extension_Float_Sorted,extension_sort)
- //Array for Fib extension Fib float
- var Fib_Extension_Float_Sorted = array.new<float>()
- Fib_Extension_Float = array.from(first_extension_bool==true ? first_extension_float : na,
- second_extension_bool==true ? second_extension_float : na,
- third_extension_bool==true ? third_extension_float : na,
- fourth_extension_bool==true ? fourth_extension_float : na,
- fifth_extension_bool==true ? fifth_extension_float : na,
- sixth_extension_bool==true ? sixth_extension_float : na,
- seventh_extension_bool==true ? seventh_extension_float : na,
- eight_extension_bool==true ? eight_extension_float : na,
- ninth_extension_bool==true ? ninth_extension_float : na)
- for extension_sort2 in Fib_Extension_Float
- if extension_sort2 != 0
- array.push(Fib_Extension_Float_Sorted,extension_sort2)
- //Array for Fib extension color
- color_array = array.from(first_extension_color,second_extension_color,third_extension_color,fourth_extension_color,fifth_extension_color,sixth_extension_color,seventh_extension_color,eight_extension_color,ninth_extension_color)
- var color_array_index_sorted = array.new<int>()
- for index_get in extension_float
- for index_get2 in Extension_Float_Sorted
- if index_get==index_get2
- array.push(color_array_index_sorted,array.indexof(extension_float,index_get))
- //---------------------------------------------------------------------------------------------------------------------//
- //Labels for Main Fib
- //---------------------------------------------------------------------------------------------------------------------//
- main_label_function(labels_true,log_true,bool1,bool2,trend,main_label_charpoint,decimal_or_percent,price1,price2,fib_float,fib_float2,price_display,color1,color2) =>
- var label label_main_function = na
- if labels_true==true and ((bool1== true and trend=="Bull") or (bool2== true and trend=="Bear"))
- label_main_function := label.new(main_label_charpoint, text=decimal_or_percent=="Decimal" and trend=="Bull"
- ? str.tostring(fib_float)+" "+(price_display==true
- ? "("+str.format("{0,number,#.#}", price1)+")" :na):decimal_or_percent=="Percent" and trend=="Bull"
- ? str.tostring(fib_float*100)+"%"+" "+(price_display==true
- ? "("+str.format("{0,number,#.#}", price1)+")" :na):decimal_or_percent=="Decimal" and trend=="Bear"
- ? str.tostring(fib_float2)+" "+(price_display==true
- ? "("+str.format("{0,number,#.#}", price2)+")" :na) :decimal_or_percent=="Percent" and trend=="Bear"
- ? str.tostring(fib_float2*100)+"%"+" "+(price_display==true
- ? "("+str.format("{0,number,#.#}", price2)+")" :na):na, style=label.style_none, textcolor = trend=="Bull" ? color1 : color2)
- label_1_char_point = chart.point.from_index(bar_index+2, Log_scale ==true ? math.exp(highest_price):highest_price)
- var label label_1 = na
- label_1.delete()
- label_1 := main_label_function(Labels_toggle,Log_scale,first_line_bool,seventh_line_bool,Bias,label_1_char_point,Label_int_float,
- Log_scale ==true ? math.exp(highest_price)
- :highest_price,Log_scale ==true ? math.exp(highest_price):highest_price,first_line_float,seventh_line_float,
- Label_prices,Background_color_bool=="Single Color" ? Background_color_color : first_line_color,
- Background_color_bool=="Single Color" ? Background_color_color :seventh_line_color)
- main_label_chart_point(index,Biasx,Log_scale_x,fib1,fib2) =>
- main_label_chart_point_x = chart.point.from_index(index, Biasx=="Bull" and Log_scale_x==false ? fib1
- :Biasx=="Bull" and Log_scale_x==true ? math.exp(fib1)
- :Biasx=="Bear" and Log_scale_x==false ? fib2
- :Biasx=="Bear" and Log_scale_x==true ? math.exp(fib2)
- :na)
- label_2_char_point = main_label_chart_point(bar_index+2,Bias,Log_scale,fib236,fib786B)
- var label label_2 = na
- label_2.delete()
- label_2 := main_label_function(Labels_toggle,Log_scale,second_line_bool,sixth_line_bool,Bias,label_2_char_point,Label_int_float,
- Bias=="Bull" and Log_scale==false ? fib236 :Bias=="Bull" and Log_scale==true ? math.exp(fib236) :na,
- Bias=="Bear" and Log_scale==false ? fib786B :Bias=="Bear" and Log_scale==true ? math.exp(fib786B) :na,
- second_line_float,sixth_line_float,Label_prices,Background_color_bool=="Single Color" ? Background_color_color :second_line_color,Background_color_bool=="Single Color" ? Background_color_color :sixth_line_color)
- label_3_char_point = main_label_chart_point(bar_index+2,Bias,Log_scale,fib382,fib618B)
- var label label_3 = na
- label_3.delete()
- label_3 := main_label_function(Labels_toggle,Log_scale,third_line_bool,fifth_line_bool,Bias,label_3_char_point,Label_int_float,Bias=="Bull" and Log_scale==false ? fib382
- :Bias=="Bull" and Log_scale==true ? math.exp(fib382) : na,Bias=="Bear" and Log_scale==false ? fib618B
- :Bias=="Bear" and Log_scale==true ? math.exp(fib618B) : na,
- third_line_float,fifth_line_float,Label_prices,Background_color_bool=="Single Color" ? Background_color_color :third_line_color,Background_color_bool=="Single Color" ? Background_color_color :fifth_line_color)
- label_4_char_point = main_label_chart_point(bar_index+2,Bias,Log_scale,fib50,fib50B)
- var label label_4 = na
- label_4.delete()
- label_4 := main_label_function(Labels_toggle,Log_scale,fourth_line_bool,fourth_line_bool,Bias,label_4_char_point,Label_int_float,
- Bias=="Bull" and Log_scale==false ? fib50 :Bias=="Bull" and Log_scale==true ? math.exp(fib50) : na,
- Bias=="Bear" and Log_scale==false ? fib50B :Bias=="Bear" and Log_scale==true ? math.exp(fib50B) :na,
- fourth_line_float,fourth_line_float,Label_prices,Background_color_bool=="Single Color" ? Background_color_color :fourth_line_color,Background_color_bool=="Single Color" ? Background_color_color :fourth_line_color)
- label_5_char_point = main_label_chart_point(bar_index+2,Bias,Log_scale,fib618,fib382B)
- var label label_5 = na
- label_5.delete()
- label_5 := main_label_function(Labels_toggle,Log_scale,fifth_line_bool,third_line_bool,Bias,label_5_char_point,Label_int_float,
- Bias=="Bull" and Log_scale==false ? fib618 :Bias=="Bull" and Log_scale==true ? math.exp(fib618) : na,
- Bias=="Bear" and Log_scale==false ? fib382B :Bias=="Bear" and Log_scale==true ? math.exp(fib382B) : na,
- fifth_line_float,third_line_float,Label_prices,Background_color_bool=="Single Color" ? Background_color_color :fifth_line_color,Background_color_bool=="Single Color" ? Background_color_color :third_line_color)
- label_6_char_point = main_label_chart_point(bar_index+2,Bias,Log_scale,fib786,fib236B)
- var label label_6 = na
- label_6.delete()
- label_6 := main_label_function(Labels_toggle,Log_scale,sixth_line_bool,second_line_bool,Bias,label_6_char_point,Label_int_float,
- Bias=="Bull" and Log_scale==false ? fib786 :Bias=="Bull" and Log_scale==true ? math.exp(fib786) : na,
- Bias=="Bear" and Log_scale==false ? fib236B :Bias=="Bear" and Log_scale==true ? math.exp(fib236B) : na,
- sixth_line_float,second_line_float,Label_prices,Background_color_bool=="Single Color" ? Background_color_color :sixth_line_color,Background_color_bool=="Single Color" ? Background_color_color :second_line_color)
- label_7_char_point = chart.point.from_index(bar_index+2, Log_scale ==true ? math.exp(lowest_price):lowest_price)
- var label label_7 = na
- label_7.delete()
- label_7 := main_label_function(Labels_toggle,Log_scale,seventh_line_bool,first_line_bool,Bias,label_7_char_point,Label_int_float,
- Log_scale ==true ? math.exp(lowest_price):lowest_price,
- Log_scale ==true ? math.exp(lowest_price):lowest_price,
- seventh_line_float,first_line_float,Label_prices,Background_color_bool=="Single Color" ? Background_color_color :seventh_line_color,Background_color_bool=="Single Color" ? Background_color_color :first_line_color)
- //---------------------------------------------------------------------------------------------------------------------//
- //Plot, Fill and Label function for Fib Extension
- //---------------------------------------------------------------------------------------------------------------------//
- label_function(label_swtich,trend,label_chartpoint,percent_or_decimal,fib_number,prices_switch,price1,price2,color) =>
- var label new_labels = na
- if label_swtich==true
- new_labels := label.new(label_chartpoint, text=percent_or_decimal=="Decimal" and trend=="Bull" ? str.tostring(fib_number)+" "+(prices_switch==true ? "("+str.format("{0,number,#.#}", price1)+")" :na)
- :percent_or_decimal=="Percent" and trend=="Bull" ? str.tostring(fib_number*100)+"%"+" "+(prices_switch==true ? "("+str.format("{0,number,#.#}", price1)+")" :na)
- :percent_or_decimal=="Decimal" and trend=="Bear" ? str.tostring(fib_number)+" "+(prices_switch==true ? "("+str.format("{0,number,#.#}", price2)+")" :na)
- :percent_or_decimal=="Percent" and trend=="Bear" ? str.tostring(fib_number*100)+"%"+" "+(prices_switch==true ? "("+str.format("{0,number,#.#}", price2)+")" :na):na ,
- style=label.style_none, textcolor = color)
- chart_point_ex_function(index,Biasx,Log_scale_x,Extension_Float_Sorted_x) =>
- chart_point_ex_function_x = chart.point.from_index(index, Biasx=="Bull" and Log_scale_x==false ? array.max(Extension_Float_Sorted_x)
- :Biasx=="Bull" and Log_scale_x==true ? math.exp(array.max(Extension_Float_Sorted_x))
- :Biasx=="Bear" and Log_scale_x==false ? array.min(Extension_Float_Sorted_x)
- :Biasx=="Bear" and Log_scale_x==true ? math.exp(array.min(Extension_Float_Sorted_x))
- :na)
- array.sort(Extension_Float_Sorted, order.ascending)
- array.sort(Fib_Extension_Float_Sorted, order.ascending)
- var color color_for_label = na
- extension_fill_line_1A = Bias=="Bull" ? lowest_price : highest_price
- extension_fill_line_1B = Bias=="Bull" ? array.max(Extension_Float_Sorted) : array.min(Extension_Float_Sorted)
- label_fib_float1 = array.min(Fib_Extension_Float_Sorted)
- ex_fill1A = plot(Log_scale ==true ? math.exp(extension_fill_line_1A) :extension_fill_line_1A,color=color.rgb(255, 255, 255, 100))
- ex_fill1B = plot(Log_scale ==true ? math.exp(extension_fill_line_1B) :extension_fill_line_1B,color=color.rgb(255, 255, 255, 100))
- fill(ex_fill1A,ex_fill1B, color=Background_color_bool=="Single Color" ? Background_color_color : ex_7th_block_fill)
- index_of_extension_fill_line_1B = array.binary_search(Extension_Float_Sorted,extension_fill_line_1B)
- fib_index_of_label_fib_float1 = array.binary_search(Fib_Extension_Float_Sorted,label_fib_float1)
- ex_label_1B_char_point = chart_point_ex_function(bar_index+2,Bias,Log_scale,Extension_Float_Sorted)
- var label ex_label_1B = na
- ex_label_1B.delete()
- color_for_label := array.size(color_array_index_sorted) > 0 ? array.get(color_array,array.first(color_array_index_sorted)) : na
- ex_label_1B := label_function(Labels_toggle,Bias,ex_label_1B_char_point,Label_int_float,label_fib_float1,Label_prices
- ,Log_scale==false ? array.max(Extension_Float_Sorted) : math.exp(array.max(Extension_Float_Sorted))
- ,Log_scale==false ? array.min(Extension_Float_Sorted) : math.exp(array.min(Extension_Float_Sorted))
- ,Background_color_bool=="Multi Color" ? color_for_label : Background_color_color)
- if array.size(Extension_Float_Sorted) > 0
- array.remove(Extension_Float_Sorted,index_of_extension_fill_line_1B)
- if array.size(Fib_Extension_Float_Sorted) > 0
- array.remove(Fib_Extension_Float_Sorted,fib_index_of_label_fib_float1)
- if array.size(color_array_index_sorted) > 0
- array.remove(color_array_index_sorted,0)
- extension_fill_line_2 = Bias=="Bull" ? array.max(Extension_Float_Sorted) : array.min(Extension_Float_Sorted)
- label_fib_float2 = array.min(Fib_Extension_Float_Sorted)
- ex_fill12 = plot(Log_scale ==true ? math.exp(extension_fill_line_2) :extension_fill_line_2,color=color.rgb(255, 255, 255, 100))
- fill(ex_fill1B,ex_fill12, color=Background_color_bool=="Single Color" ? Background_color_color : ex_8th_block_fill)
- ex_label_2_char_point = chart_point_ex_function(bar_index+2,Bias,Log_scale,Extension_Float_Sorted)
- index_of_extension_fill_line_2 = array.binary_search(Extension_Float_Sorted,extension_fill_line_2)
- fib_index_of_label_fib_float2 = array.binary_search(Fib_Extension_Float_Sorted,label_fib_float2)
- var label ex_label_2 = na
- ex_label_2.delete()
- color_for_label := array.size(color_array_index_sorted) > 0 ? array.get(color_array,array.first(color_array_index_sorted)) : na
- ex_label_2 := label_function(Labels_toggle,Bias,ex_label_2_char_point,Label_int_float,label_fib_float2,Label_prices,
- Log_scale==false ? array.max(Extension_Float_Sorted) : math.exp(array.max(Extension_Float_Sorted)),
- Log_scale==false ? array.min(Extension_Float_Sorted) : math.exp(array.min(Extension_Float_Sorted)),Background_color_bool=="Multi Color" ? color_for_label : Background_color_color)
- if array.size(Extension_Float_Sorted) > 0
- array.remove(Extension_Float_Sorted,index_of_extension_fill_line_2)
- if array.size(Fib_Extension_Float_Sorted) > 0
- array.remove(Fib_Extension_Float_Sorted,fib_index_of_label_fib_float2)
- if array.size(color_array_index_sorted) > 0
- array.remove(color_array_index_sorted,0)
- extension_fill_line_3 = Bias=="Bull" ? array.max(Extension_Float_Sorted) : array.min(Extension_Float_Sorted)
- label_fib_float3 = array.min(Fib_Extension_Float_Sorted)
- ex_fill13 = plot(Log_scale ==true ? math.exp(extension_fill_line_3): extension_fill_line_3,color=color.rgb(255, 255, 255, 100))
- fill(ex_fill12,ex_fill13, color=Background_color_bool=="Single Color" ? Background_color_color : ex_9th_block_fill)
- ex_label_3_char_point = chart_point_ex_function(bar_index+2,Bias,Log_scale,Extension_Float_Sorted)
- fib_index_of_label_fib_float3 = array.binary_search(Fib_Extension_Float_Sorted,label_fib_float3)
- var label ex_label_3 = na
- ex_label_3.delete()
- color_for_label := array.size(color_array_index_sorted) > 0 ? array.get(color_array,array.first(color_array_index_sorted)) : na
- ex_label_3 := label_function(Labels_toggle,Bias,ex_label_3_char_point,Label_int_float,label_fib_float3,Label_prices,
- Log_scale==false ? array.max(Extension_Float_Sorted) : math.exp(array.max(Extension_Float_Sorted)),
- Log_scale==false ? array.min(Extension_Float_Sorted) : math.exp(array.min(Extension_Float_Sorted)),Background_color_bool=="Multi Color" ? color_for_label : Background_color_color)
- index_of_extension_fill_line_3 = array.binary_search(Extension_Float_Sorted,extension_fill_line_3)
- if array.size(Extension_Float_Sorted) > 0
- array.remove(Extension_Float_Sorted,index_of_extension_fill_line_3)
- if array.size(Fib_Extension_Float_Sorted) > 0
- array.remove(Fib_Extension_Float_Sorted,fib_index_of_label_fib_float3)
- if array.size(color_array_index_sorted) > 0
- array.remove(color_array_index_sorted,0)
- extension_fill_line_4 = Bias=="Bull" ? array.max(Extension_Float_Sorted) : array.min(Extension_Float_Sorted)
- label_fib_float4 = array.min(Fib_Extension_Float_Sorted)
- ex_fill14 = plot(Log_scale ==true ? math.exp(extension_fill_line_4):extension_fill_line_4,color=color.rgb(255, 255, 255, 100))
- fill(ex_fill13,ex_fill14, color=Background_color_bool=="Single Color" ? Background_color_color : ex_10th_block_fill)
- ex_label_4_char_point = chart_point_ex_function(bar_index+2,Bias,Log_scale,Extension_Float_Sorted)
- fib_index_of_label_fib_float4 = array.binary_search(Fib_Extension_Float_Sorted,label_fib_float4)
- var label ex_label_4 = na
- ex_label_4.delete()
- color_for_label := array.size(color_array_index_sorted) > 0 ? array.get(color_array,array.first(color_array_index_sorted)) : na
- ex_label_4 := label_function(Labels_toggle,Bias,ex_label_4_char_point,Label_int_float,label_fib_float4,Label_prices,
- Log_scale==false ? array.max(Extension_Float_Sorted) : math.exp(array.max(Extension_Float_Sorted)),
- Log_scale==false ? array.min(Extension_Float_Sorted) : math.exp(array.min(Extension_Float_Sorted)),Background_color_bool=="Multi Color" ? color_for_label : Background_color_color)
- index_of_extension_fill_line_4 = array.binary_search(Extension_Float_Sorted,extension_fill_line_4)
- if array.size(Extension_Float_Sorted) > 0
- array.remove(Extension_Float_Sorted,index_of_extension_fill_line_4)
- if array.size(Fib_Extension_Float_Sorted) > 0
- array.remove(Fib_Extension_Float_Sorted,fib_index_of_label_fib_float4)
- if array.size(color_array_index_sorted) > 0
- array.remove(color_array_index_sorted,0)
- extension_fill_line_5 = Bias=="Bull" ? array.max(Extension_Float_Sorted) : array.min(Extension_Float_Sorted)
- label_fib_float5 = array.min(Fib_Extension_Float_Sorted)
- ex_fill15 = plot(Log_scale ==true ? math.exp(extension_fill_line_5):extension_fill_line_5,color=color.rgb(255, 255, 255, 100))
- fill(ex_fill14, ex_fill15, color=Background_color_bool=="Single Color" ? Background_color_color : ex_11th_block_fill)
- ex_label_5_char_point = chart_point_ex_function(bar_index+2,Bias,Log_scale,Extension_Float_Sorted)
- fib_index_of_label_fib_float5 = array.binary_search(Fib_Extension_Float_Sorted,label_fib_float5)
- var label ex_label_5 = na
- ex_label_5.delete()
- color_for_label := array.size(color_array_index_sorted) > 0 ? array.get(color_array,array.first(color_array_index_sorted)) : na
- ex_label_5 := label_function(Labels_toggle,Bias,ex_label_5_char_point,Label_int_float,label_fib_float5,Label_prices,
- Log_scale==false ? array.max(Extension_Float_Sorted) : math.exp(array.max(Extension_Float_Sorted)),
- Log_scale==false ? array.min(Extension_Float_Sorted) : math.exp(array.min(Extension_Float_Sorted)),Background_color_bool=="Multi Color" ? color_for_label : Background_color_color)
- index_of_extension_fill_line_5 = array.binary_search(Extension_Float_Sorted,extension_fill_line_5)
- if array.size(Extension_Float_Sorted) > 0
- array.remove(Extension_Float_Sorted,index_of_extension_fill_line_5)
- if array.size(Fib_Extension_Float_Sorted) > 0
- array.remove(Fib_Extension_Float_Sorted,fib_index_of_label_fib_float5)
- if array.size(color_array_index_sorted) > 0
- array.remove(color_array_index_sorted,0)
- extension_fill_line_6 = Bias=="Bull" ? array.max(Extension_Float_Sorted) : array.min(Extension_Float_Sorted)
- label_fib_float6 = array.min(Fib_Extension_Float_Sorted)
- ex_fill16 = plot(Log_scale ==true ? math.exp(extension_fill_line_6):extension_fill_line_6,color=color.rgb(255, 255, 255, 100))
- fill(ex_fill15, ex_fill16, color=Background_color_bool=="Single Color" ? Background_color_color : ex_12th_block_fill)
- ex_label_6_char_point = chart_point_ex_function(bar_index+2,Bias,Log_scale,Extension_Float_Sorted)
- fib_index_of_label_fib_float6 = array.binary_search(Fib_Extension_Float_Sorted,label_fib_float6)
- var label ex_label_6 = na
- ex_label_6.delete()
- color_for_label := array.size(color_array_index_sorted) > 0 ? array.get(color_array,array.first(color_array_index_sorted)) : na
- ex_label_6 := label_function(Labels_toggle,Bias,ex_label_6_char_point,Label_int_float,label_fib_float6,Label_prices,
- Log_scale==false ? array.max(Extension_Float_Sorted) : math.exp(array.max(Extension_Float_Sorted)),
- Log_scale==false ? array.min(Extension_Float_Sorted) : math.exp(array.min(Extension_Float_Sorted)),Background_color_bool=="Multi Color" ? color_for_label : Background_color_color)
- index_of_extension_fill_line_6 = array.binary_search(Extension_Float_Sorted,extension_fill_line_6)
- if array.size(Extension_Float_Sorted) > 0
- array.remove(Extension_Float_Sorted,index_of_extension_fill_line_6)
- if array.size(Fib_Extension_Float_Sorted) > 0
- array.remove(Fib_Extension_Float_Sorted,fib_index_of_label_fib_float6)
- if array.size(color_array_index_sorted) > 0
- array.remove(color_array_index_sorted,0)
- extension_fill_line_7 = Bias=="Bull" ? array.max(Extension_Float_Sorted) : array.min(Extension_Float_Sorted)
- label_fib_float7 = array.min(Fib_Extension_Float_Sorted)
- ex_fill17 = plot(Log_scale ==true ? math.exp(extension_fill_line_7):extension_fill_line_7,color=color.rgb(255, 255, 255, 100))
- fill(ex_fill16, ex_fill17, color=Background_color_bool=="Single Color" ? Background_color_color : ex_13th_block_fill)
- ex_label_7_char_point = chart_point_ex_function(bar_index+2,Bias,Log_scale,Extension_Float_Sorted)
- fib_index_of_label_fib_float7 = array.binary_search(Fib_Extension_Float_Sorted,label_fib_float7)
- var label ex_label_7 = na
- ex_label_7.delete()
- color_for_label := array.size(color_array_index_sorted) > 0 ? array.get(color_array,array.first(color_array_index_sorted)) : na
- ex_label_7 := label_function(Labels_toggle,Bias,ex_label_7_char_point,Label_int_float,label_fib_float7,Label_prices,
- Log_scale==false ? array.max(Extension_Float_Sorted) : math.exp(array.max(Extension_Float_Sorted)),
- Log_scale==false ? array.min(Extension_Float_Sorted) : math.exp(array.min(Extension_Float_Sorted)),Background_color_bool=="Multi Color" ? color_for_label : Background_color_color)
- index_of_extension_fill_line_7 = array.binary_search(Extension_Float_Sorted,extension_fill_line_7)
- if array.size(Extension_Float_Sorted) > 0
- array.remove(Extension_Float_Sorted,index_of_extension_fill_line_7)
- if array.size(Fib_Extension_Float_Sorted) > 0
- array.remove(Fib_Extension_Float_Sorted,fib_index_of_label_fib_float7)
- if array.size(color_array_index_sorted) > 0
- array.remove(color_array_index_sorted,0)
- extension_fill_line_8 = Bias=="Bull" ? array.max(Extension_Float_Sorted) : array.min(Extension_Float_Sorted)
- label_fib_float8 = array.min(Fib_Extension_Float_Sorted)
- ex_fill18 = plot(Log_scale ==true ? math.exp(extension_fill_line_8):extension_fill_line_8,color=color.rgb(255, 255, 255, 100))
- fill(ex_fill17, ex_fill18, color=Background_color_bool=="Single Color" ? Background_color_color : ex_14th_block_fill)
- ex_label_8_char_point = chart_point_ex_function(bar_index+2,Bias,Log_scale,Extension_Float_Sorted)
- fib_index_of_label_fib_float8 = array.binary_search(Fib_Extension_Float_Sorted,label_fib_float8)
- var label ex_label_8 = na
- ex_label_8.delete()
- color_for_label := array.size(color_array_index_sorted) > 0 ? array.get(color_array,array.first(color_array_index_sorted)) : na
- ex_label_8 := label_function(Labels_toggle,Bias,ex_label_8_char_point,Label_int_float,label_fib_float8,Label_prices,
- Log_scale==false ? array.max(Extension_Float_Sorted) : math.exp(array.max(Extension_Float_Sorted)),
- Log_scale==false ? array.min(Extension_Float_Sorted) : math.exp(array.min(Extension_Float_Sorted)),Background_color_bool=="Multi Color" ? color_for_label : Background_color_color)
- index_of_extension_fill_line_8 = array.binary_search(Extension_Float_Sorted,extension_fill_line_8)
- if array.size(Extension_Float_Sorted) > 0
- array.remove(Extension_Float_Sorted,index_of_extension_fill_line_8)
- if array.size(Fib_Extension_Float_Sorted) > 0
- array.remove(Fib_Extension_Float_Sorted,fib_index_of_label_fib_float8)
- if array.size(color_array_index_sorted) > 0
- array.remove(color_array_index_sorted,0)
- extension_fill_line_9 = Bias=="Bull" ? array.max(Extension_Float_Sorted) : array.min(Extension_Float_Sorted)
- label_fib_float9 = array.min(Fib_Extension_Float_Sorted)
- ex_fill19 = plot(Log_scale ==true ? math.exp(extension_fill_line_9):extension_fill_line_9,color=color.rgb(255, 255, 255, 100))
- fill(ex_fill18, ex_fill19, color=Background_color_bool=="Single Color" ? Background_color_color : ex_15th_block_fill)
- ex_label_9_char_point = chart_point_ex_function(bar_index+2,Bias,Log_scale,Extension_Float_Sorted)
- fib_index_of_label_fib_float9 = array.binary_search(Fib_Extension_Float_Sorted,label_fib_float9)
- var label ex_label_9 = na
- ex_label_9.delete()
- color_for_label := array.size(color_array_index_sorted) > 0 ? array.get(color_array,array.first(color_array_index_sorted)) : na
- ex_label_9 := label_function(Labels_toggle,Bias,ex_label_9_char_point,Label_int_float,label_fib_float9,Label_prices,
- Log_scale==false ? array.max(Extension_Float_Sorted) : math.exp(array.max(Extension_Float_Sorted)),
- Log_scale==false ? array.min(Extension_Float_Sorted) : math.exp(array.min(Extension_Float_Sorted)),Background_color_bool=="Multi Color" ? color_for_label : Background_color_color)
- index_of_extension_fill_line_9 = array.binary_search(Extension_Float_Sorted,extension_fill_line_9)
- if array.size(Extension_Float_Sorted) > 0
- array.remove(Extension_Float_Sorted,index_of_extension_fill_line_9)
- if array.size(Fib_Extension_Float_Sorted) > 0
- array.remove(Fib_Extension_Float_Sorted,fib_index_of_label_fib_float9)
- if array.size(color_array_index_sorted) > 0
- array.remove(color_array_index_sorted,0)
- Extension_Float_Sorted := array.new<float>()
- Fib_Extension_Float_Sorted := array.new<float>()
- color_array_index_sorted := array.new<int>()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement