Automatci Fibonacci ZigZag

 

Hello all,

Does anyone know how this custom indicator can be altered so it only draws fibonacci retracements on the vertical zigzags in an uptrend and downward zigzags in a downtrend? An uptrend/ downtrend is calculated from a 120 period donchian channel on the H4 chart.

The reason I ask is that my EA waits for price to cross the 23.6 fib level, but with this custom indicator it never gets there because the fib lines get recalculated when there is an up/ down move.

Can anyone help?

 

Sorry forgot to attach the indicator!

Files:
 

I'm thinking the way to go about it is to only draw the fibonacci lines when "WaveEnd" > "WaveStart", the two points on a zigzag formation in an uptrend, or where "WaveEnd" < "WaveStart" in a down trend.

This is the section of code I think I need to change:

//----

if(ObjectFind("FIBO236 line") != 0)

{

ObjectCreate("FIBO236 line", OBJ_HLINE, 0, Time[3], FIBO236);

ObjectSet("FIBO236 line", OBJPROP_STYLE, STYLE_DASHDOTDOT);

ObjectSet("FIBO236 line", OBJPROP_COLOR, Fibo_23.6_Color);

}

else

{

ObjectMove("FIBO236 line", 0, Time[3], FIBO236);

}

//----

This is what I have done:

//------------------------------------------------------------

if(ObjectFind("FIBO100 line") != 0)

{

if(ObjectGet("WaveEnd", OBJPROP_PRICE1) > ObjectGet("WaveStart", OBJPROP_PRICE1))

{

ObjectCreate("FIBO100 line", OBJ_HLINE, 0, Time[3], FIBO100);

ObjectSet("FIBO100 line", OBJPROP_STYLE, STYLE_DASH);

ObjectSet("FIBO100 line", OBJPROP_COLOR, Fibo_100.0_Color);

}

}

else if (ObjectGet("WaveEnd", OBJPROP_PRICE1) > ObjectGet("WaveStart", OBJPROP_PRICE1))

{

ObjectMove("FIBO100 line", 0, Time[3], FIBO100);

}

//----

if(ObjectFind("FIBO0 line") != 0)

{

if(ObjectGet("WaveEnd", OBJPROP_PRICE1) > ObjectGet("WaveStart", OBJPROP_PRICE1))

{

ObjectCreate("FIBO0 line", OBJ_HLINE, 0, Time[3], FIBO0);

ObjectSet("FIBO0 line", OBJPROP_STYLE, STYLE_DASH);

ObjectSet("FIBO0 line", OBJPROP_COLOR, Fibo_0.00_Color);

}

}

else if (ObjectGet("WaveEnd", OBJPROP_PRICE1) > ObjectGet("WaveStart", OBJPROP_PRICE1))

{

ObjectMove("FIBO0 line", 0, Time[3], FIBO0);

}

//----

if(ObjectFind("FIBO236 line") != 0)

{

if(ObjectGet("WaveEnd", OBJPROP_PRICE1) > ObjectGet("WaveStart", OBJPROP_PRICE1))

{

ObjectCreate("FIBO236 line", OBJ_HLINE, 0, Time[3], FIBO236);

ObjectSet("FIBO236 line", OBJPROP_STYLE, STYLE_DASHDOTDOT);

ObjectSet("FIBO236 line", OBJPROP_COLOR, Fibo_23.6_Color);

}

}

else if (ObjectGet("WaveEnd", OBJPROP_PRICE1) > ObjectGet("WaveStart", OBJPROP_PRICE1))

{

ObjectMove("FIBO236 line", 0, Time[3], FIBO236);

}

//----

if(ObjectFind("FIBO382 line") != 0)

{

if(ObjectGet("WaveEnd", OBJPROP_PRICE1) > ObjectGet("WaveStart", OBJPROP_PRICE1))

{

ObjectCreate("FIBO382 line", OBJ_HLINE, 0, Time[3], FIBO382);

ObjectSet("FIBO382 line", OBJPROP_STYLE, STYLE_DASHDOTDOT);

ObjectSet("FIBO382 line", OBJPROP_COLOR, Fibo_38.2_Color);

}

}

else if (ObjectGet("WaveEnd", OBJPROP_PRICE1) > ObjectGet("WaveStart", OBJPROP_PRICE1))

{

ObjectMove("FIBO382 line", 0, Time[3], FIBO382);

}

//----

if(ObjectFind("FIBO50 line") != 0)

{

if(ObjectGet("WaveEnd", OBJPROP_PRICE1) > ObjectGet("WaveStart", OBJPROP_PRICE1))

{

ObjectCreate("FIBO50 line", OBJ_HLINE, 0, Time[3], FIBO50);

ObjectSet("FIBO50 line", OBJPROP_STYLE, STYLE_DASHDOTDOT);

ObjectSet("FIBO50 line", OBJPROP_COLOR, Fibo_50.0_Color);

}

}

else if (ObjectGet("WaveEnd", OBJPROP_PRICE1) > ObjectGet("WaveStart", OBJPROP_PRICE1))

{

ObjectMove("FIBO50 line", 0, Time[3], FIBO50);

}

//----

if(ObjectFind("FIBO618 line") != 0)

{

if(ObjectGet("WaveEnd", OBJPROP_PRICE1) > ObjectGet("WaveStart", OBJPROP_PRICE1))

{

ObjectCreate("FIBO618 line", OBJ_HLINE, 0, Time[3], FIBO618);

ObjectSet("FIBO618 line", OBJPROP_STYLE, STYLE_DASHDOTDOT);

ObjectSet("FIBO618 line", OBJPROP_COLOR, Fibo_61.8_Color);

}

}

else if (ObjectGet("WaveEnd", OBJPROP_PRICE1) > ObjectGet("WaveStart", OBJPROP_PRICE1))

{

ObjectMove("FIBO618 line", 0, Time[3], FIBO618);

}

//----

if(ObjectFind("FIBO764 line") != 0)

{

if(ObjectGet("WaveEnd", OBJPROP_PRICE1) > ObjectGet("WaveStart", OBJPROP_PRICE1))

{

ObjectCreate("FIBO764 line", OBJ_HLINE, 0, Time[3], FIBO764);

ObjectSet("FIBO764 line", OBJPROP_STYLE, STYLE_DASHDOTDOT);

ObjectSet("FIBO764 line", OBJPROP_COLOR, Fibo_76.4_Color);

}

}

else if (ObjectGet("WaveEnd", OBJPROP_PRICE1) > ObjectGet("WaveStart", OBJPROP_PRICE1))

{

ObjectMove("FIBO764 line", 0, Time[3], FIBO764);

}

But this isnt working. Any ideas?

 

It is a great pity that this has not been taken up as it is a great scalping indicator.

This is my manual drawing of the indictor (not being a coder) and as everyone can see, it is ideal as it will keep traders out of sideways chopping charts.

It would need to have an alert when the price closed above the 61.8% level (for a buy signal) and closed below 61.8% level for a sell signal.

TEAMTRADER

Files:
gbpeurm2.png  75 kb
 
TEAMTRADER:
It is a great pity that this has not been taken up as it is a great scalping indicator.

This is my manual drawing of the indictor (not being a coder) and as everyone can see, it is ideal as it will keep traders out of sideways chopping charts.

It would need to have an alert when the price closed above the 61.8% level (for a buy signal) and closed below 61.8% level for a sell signal.

TEAMTRADER

Teamtrader, if I'm not mistaken I think this indicator does this.

Files:
 

Thanks Mr Tools.

Sadly it does not operate on offline charts but I appreciate the thought.

TEAMTRADER

 
TEAMTRADER:
Thanks Mr Tools.

Sadly it does not operate on offline charts but I appreciate the thought.

TEAMTRADER

Weird this is it working on ha smoothed offline.

Files:
 

I will try it on another platform - question:- can it be adapted to Fibonacci Fans rather than levels?

Thanks

TEAMTRADER

 
TEAMTRADER:
I will try it on another platform - question:- can it be adapted to Fibonacci Fans rather than levels?

Thanks

TEAMTRADER

Teamtrader, there is one here: https://www.mql5.com/en/forum/183798/page33 last time I checked it, it worked.

Reason: