Pete
I have an auto fibonacci study and was hoping to add the price and the fib level percentage to it. I would like to have it layed out the way TOS lays it out.
input sideline = no;
def f11 = 0.236;
def f12 = 0.382;
def f13 = 0.50;
def f14 = 0.618;
def f15 = 0.786;
def hh = HighestAll(high);
def ll = LowestAll(low);
plot H =
if isnaN(close) && sideline then
hh
else if !isnaN(close) && !sideline then
hh
else
double.NaN
;
plot L =
if isnaN(close) && sideline then
ll
else if !isnaN(close) && !sideline then
ll
else
double.NaN
;
plot P236 =
if isnaN(close) && sideline then
hh – ((hh – ll) * f11)
else if !isnaN(close) && !sideline then
hh – ((hh – ll) * f11)
else
double.NaN
;
plot P382 =
if isnaN(close) && sideline then
hh – ((hh – ll) * f12)
else if !isnaN(close) && !sideline then
hh – ((hh – ll) * f12)
else
double.NaN
;
plot P50 =
if isnaN(close) && sideline then
hh – ((hh – ll) * f13)
else if !isnaN(close) && !sideline then
hh – ((hh – ll) * f13)
else
double.NaN
;
plot P618 =
if isnaN(close) && sideline then
hh – ((hh – ll) * f14)
else if !isnaN(close) && !sideline then
hh – ((hh – ll) * f14)
else
double.NaN
;
plot P781 =
if isnaN(close) && sideline then
hh – ((hh – ll) * f15)
else if !isnaN(close) && !sideline then
hh – ((hh – ll) * f15)
else
double.NaN
;
p236.SetDefaultColor(Color.lIGHT_GRAY);
p382.SetDefaultColor(Color.lIGHT_GRAY);
p50.SetDefaultColor(Color.ORANGE);
p618.SetDefaultColor(Color.lIGHT_GRAY);
p781.SetDefaultColor(Color.lIGHT_GRAY);
H.SetDefaultColor(Color.MAGENTA);
L.SetDefaultColor(Color.MAGENTA);
p236.SetStyle(Curve.LONG_DASH);
p382.SetStyle(Curve.LONG_DASH);
p50.SetStyle(Curve.LONG_DASH);
p618.SetStyle(Curve.LONG_DASH);
p781.SetStyle(Curve.LONG_DASH);
H.SetStyle(Curve.SHORT_DASH);
L.SetStyle(Curve.SHORT_DASH);
H.SetLineWeight(2);
L.SetLineWeight(2);
p50.SetLineWeight(2);
Like this:
Like Loading...