The Zig-Zag Trader strategy shows excellent results over 10 years but given the nature of the Zig-Zag indicator, I was wondering if it was viable as an automatic trader.
As you are no doubt aware, the direction and length of each Zig-Zag is not finally established until the beginning of the next leg. The question is whether this code is affected, as it is only looking at the direction of the leg not long after it is established.
// Definition of code parameters
DEFPARAM CumulateOrders = False // Cumulating positions deactivated
// Conditions to enter long positions
ZZST = ZigZag[1](totalPrice)
c1 = ZZST > ZZST[1]
IF c1 AND NOT LongOnMarket THEN
BUY 1 CONTRACT AT MARKET
ENDIF
// Conditions to exit long positions
c2 = ZZST < ZZST[1]
IF c2 THEN
SELL AT MARKET
ENDIF
// Conditions to enter short positions
c3 = ZZST < ZZST[1]
IF c3 AND NOT ShortOnMarket THEN
SELLSHORT 1 CONTRACT AT MARKET
ENDIF
// Conditions to exit short positions
c4 = ZZST > ZZST[1]
IF c4 THEN
EXITSHORT AT MARKET
ENDIF
// Stops and targets
I would very much appreciate your feedback on the viability of this strategy.
I hoped to use ZigZag as part of an automatic trading strategy but Automatic trading in Proreal Time didn’t support this indicator on V10.1, haven’t tried it since 10.2 was released.
Hello Mike, unfortunately this strategy can’t work in real time.
ZigZag indicator are not supported into ProOrder because of its lookback needs to recalculate recent highs and lows to draw zigzag points and it’s not allowed in PRT. While it is great to avoid the so-called “repainting” indicators, it’s also something that sometimes missed in development needs.
So the embedded zigzag that is pre-calculated into the platform can’t be taken into real information in backtest. Sorry.
When you test a strategy with an equity curve so straight, there’s something wrong for sure!
Many thanks, Nicolas. I see the impossibility of trading this live. This harks back to the problems with the strategy based on the screener I posted with three indicators – the need to define the change in trend satisfactorily.
Hi Nicolas,
Perhaps if I have the original prorealtime code of zig zag indicator I can solve this repaint. Do you have the code?
Dear
@msblend,
Thank you for your query. I had never thought about stabilising the ZigZag. However, I went to https://www.prorealtime.com/en/indicator-library-open-496 and found the code for a stabilised version. Here is what the author wrote:
ZIGZAG TREND
ZigZag Trend
Binary indicator which adopts the Zigzag mechanism but as opposed to the above two indicators, it gives always valid signals about the direction of a trend and shows when that trend was confirmed.
It does not show peaks and troughs like Zigzag, but returns +1 for valid up trends and -1 for valid downtrends and it rejects all the invalid trends.
The real power of ZZT is that its signals are never revisable, so you can let the indicator provide valid signals for both the past and the present.
Indicator programming
// price value
price = close
// ZigZag method : 1=percent, 2=points
method = 1
// Reversal amount
amnt = 10
IF method=1 THEN
zz0 = ZigZag[amnt](price)
ELSE
zz0 = ZigZagPoint[amnt](price)
ENDIF
zz1 = zz0[1]
zz2 = zz0[2]
IF zz0 > zz1 AND zz1 < zz2 THEN
ztr = zz1
ENDIF
IF zz0 < zz1 AND zz1 > zz2 THEN
zpk = zz1
ENDIF
IF method=1 THEN
PU = ztr + Abs(ztr) * amnt / 100
ELSE
PU = ztr + amnt
ENDIF
IF method=1 THEN
PD = zpk - Abs(zpk) * amnt / 100
ELSE
PD = zpk - amnt
ENDIF
IF price >= PU AND zz0 > zz1 THEN
res = 1
ELSIF price <= PD AND zz0 < zz1 THEN
res = -1
ELSE
res = 0
ENDIF
RETURN res AS"ZZT"
Thanks Mike, but even if its informations are not “revisable”, the use of ZigZag indicator in its code make it useless for automatic trading purpose, ProOrder will reject the code.
To point highest high and lowest low, there are plenty of other indicators in the Library:
Thanks
@Nicolas. After much research, I find that the SuperTrend is an excellent indicator of trend as it takes account of ATR. I have also tested Pivot Hi/Lo but not as a trend indicator . I look forward to testing the other 3 you mention.
As always your assistance is much appreciated .
Cheers , Mike
CKWParticipant
Veteran
Hi Nicholas,
is Multi Factals Indicator that you shared on library is the most similar indicator as ZigZag? I just realized ZigZag can’t be used on automatic trading & glad found this post. Attatched screenshot, Line in black is ZigZagpoints (30*pointsizes), Green line is MultiFactals. My strategy requires cleaner chart like ZigZag. Do we have other indicators ?
br,
CKW
You could potentially get the same thing as the original ZigZag with this indicator:
http://www.prorealcode.com/prorealtime-indicators/fractals-zigzag/ You could use Close instead of High/Low values to get the new fractals points. Also a conditional statement to know if the new detected fractal is 30*pointsizes away from the last one should help.
CKWParticipant
Veteran
Thanks Nicholas. Good idea
DEar Nicolas ,
actually ( vers 10.3) is not available yet the ZIGZAG indicator in proorder ?
Thanks
REgards
No, I don’t feel like it will be the case soon..
Ciao,
esiste un indicatore che sia simile allo ZigZag e che possa essere usato con proorder 10.3?
Ciao
ironshirow – please ONLY use English in the English speaking forum. If you want to communicate in Italian then please use the Italian forums and post a link to this topic. 🙂
Si prega di utilizzare SOLO l’inglese nel forum di lingua inglese. Se vuoi comunicare in italiano, per favore usa i forum italiani e pubblica un link a questo argomento. 🙂