The basic algorithm for this indicator is Zig Zag indicator. Each time a new peak or trough is found, the averaged value are inverted:
This indicator was coded by a request in the English indicators forum.
//PRC_ZigZag Average | indicator
//30.05.2018
//Nicolas @ www.prorealcode.com
//Sharing ProRealTime knowledge
//--- settings
Percentage = 1
mmPeriod = 30
//--- end of settings
peak = ZigZag[Percentage](high)
trough = ZigZag[Percentage](low)
if peak<peak[1] and peak[1]>peak[2] then
last=1
endif
if trough>trough[1] and trough[1]<trough[2] then
last=-1
endif
if last>0 then
mm=average[mmPeriod](high)
else
mm=average[mmPeriod](low)
endif
if mm>mm[1] then
r=0
g=128
b=196
else
r=255
g=0
b=0
endif
return mm coloured(r,g,b) style(line,2)
You must be logged in to post a comment.
Hi Nicolas, Can you please share MT4 version of this? Cheers
I'm trying to make a strategy based on EMA crosses over the ZigZag Average. Is there a way to generate these signals and copy them onto "myIndicator2" and simply print the signals (for example: +1; -1) ? If this is possible, maybe the strategy can be built with myIndicator2, then overcoming the ZigZag issue with auto trading. Any thoughts?
Nice. I like this, are the graphics as pretty when used with market entries?
Thank you vey much for your swift response, hope others find it useful!
I noticed it changes as time progress, I am 7 as the average, how many period it wont change much?