0% found this document useful (0 votes)
129 views2 pages

Auto Fibonacci

This document defines a study that plots Fibonacci retracement levels on a chart based on the highest and lowest prices within a specified number of candles. It calculates the various Fibonacci ratios (0%, 23.6%, 38.2%, etc.) and plots them on the chart with labels, along with labeling the highest and lowest prices. The color of the lines and text depends on whether the highest or lowest price is used as the base of the ratios.

Uploaded by

Kumar Manoj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
129 views2 pages

Auto Fibonacci

This document defines a study that plots Fibonacci retracement levels on a chart based on the highest and lowest prices within a specified number of candles. It calculates the various Fibonacci ratios (0%, 23.6%, 38.2%, etc.) and plots them on the chart with labels, along with labeling the highest and lowest prices. The color of the lines and text depends on whether the highest or lowest price is used as the base of the ratios.

Uploaded by

Kumar Manoj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

//@version=3

study(title="Auto Calvonacci", overlay=true)


FPeriod = input(80, title="Candles to Check", step=20, minval=20)
plotF1618 = input(title="Plot 1.618 Level?", type=bool, defval=false)

Fhigh=highest(FPeriod)
Flow=lowest(FPeriod)
FH=highestbars(high,FPeriod)
FL=lowestbars(low,FPeriod)
downfibo = FH < FL

F0 = downfibo ? Flow : Fhigh


F236 = downfibo ? (Fhigh-Flow)*0.236+Flow : Fhigh-(Fhigh-Flow)*0.236
F382 = downfibo ? (Fhigh-Flow)*0.382+Flow : Fhigh-(Fhigh-Flow)*0.382
F500 = downfibo ? (Fhigh-Flow)*0.500+Flow : Fhigh-(Fhigh-Flow)*0.500
F618 = downfibo ? (Fhigh-Flow)*0.618+Flow : Fhigh-(Fhigh-Flow)*0.618
F702 = downfibo ? (Fhigh-Flow)*0.702+Flow : Fhigh-(Fhigh-Flow)*0.702
F786 = downfibo ? (Fhigh-Flow)*0.786+Flow : Fhigh-(Fhigh-Flow)*0.786
F1000 = downfibo ? (Fhigh-Flow)*1.000+Flow : Fhigh-(Fhigh-Flow)*1.000
F1618 = downfibo ? (Fhigh-Flow)*1.618+Flow : Fhigh-(Fhigh-Flow)*1.618

Fcolor = downfibo ? #00CC00 : #E41019


Foffset = downfibo ? FH : FL

plot(F0,color=Fcolor,linewidth=2,trackprice=true,show_last=1,title='0',transp=0)
//plot(F236,color=Fcolor,linewidth=1,trackprice=true,show_last=1,title='0.236',tran
sp=0)
//plot(F382,color=Fcolor,linewidth=1,trackprice=true,show_last=1,title='0.382',tran
sp=0)
//plot(F500,color=Fcolor,linewidth=2,trackprice=true,show_last=1,title='0.5',transp
=0)
//plot(F618,color=Fcolor,linewidth=1,trackprice=true,show_last=1,title='0.618',tran
sp=0)
plot(F702,color=Fcolor,linewidth=1,trackprice=true,show_last=1,title='0.702',transp
=0)
//plot(F786,color=Fcolor,linewidth=1,trackprice=true,show_last=1,title='0.786',tran
sp=0)
//plot(F1000,color=Fcolor,linewidth=2,trackprice=true,show_last=1,title='1',transp=
0)
plot(plotF1618 and F1618 ? F1618 :
na,color=Fcolor,linewidth=3,trackprice=true,show_last=1,title='1.618',transp=0)

//plotshape(F0,style=shape.labeldown,location=location.absolute,color=Fcolor,textco
lor=black,show_last=1,text="%0",offset = 15,transp=30)
//plotshape(F236,style=shape.labeldown,location=location.absolute,color=Fcolor,text
color=black,show_last=1,text="%23.6",offset = 15,transp=30)
//plotshape(F382,style=shape.labeldown,location=location.absolute,color=Fcolor,text
color=black,show_last=1,text="%38.2",offset = 15,transp=30)
//plotshape(F500,style=shape.labeldown,location=location.absolute,color=Fcolor,text
color=black,show_last=1,text="%50",offset = 15,transp=30)
//plotshape(F618,style=shape.labeldown,location=location.absolute,color=Fcolor,text
color=black,show_last=1,text="%61.8",offset = 15,transp=30)
plotshape(F702,style=shape.labeldown,location=location.absolute,color=Fcolor,textco
lor=white,show_last=1,text="Calvonacci (70.2%)",offset = 15,transp=30)
//plotshape(F786,style=shape.labeldown,location=location.absolute,color=Fcolor,text
color=black,show_last=1,text="%78.6",offset = 15,transp=30)
//plotshape(F1000,style=shape.labeldown,location=location.absolute,color=Fcolor,tex
tcolor=black,show_last=1,text="%100",offset = 15,transp=30)
//plotshape(plotF1618 and F1618 ? F1618 :
na,style=shape.labeldown,location=location.absolute,color=Fcolor,textcolor=black,sh
ow_last=1,text="%161.8",offset = 15,transp=30)

plotshape(Flow,style=shape.labelup,location=location.absolute,size=
size.large,color=Fcolor,textcolor=black,show_last=1,text="Low",offset =
FL,transp=0)
plotshape(Fhigh,style=shape.labeldown,location=location.absolute,size=
size.large,color=Fcolor,textcolor=black,show_last=1,text="High",offset =
FH,transp=0)

You might also like