How to configure zigzag as stop loss
4 replies
Julianrob
9 years ago #113269
Hi,
I have a renko trading system that looks very good, but I need to set my stops at the previous ZigZag high/low. I notice this indi isn’t available in ea wizard. Mark please can you help me with how I can write this in ea wizard?
Julian
Mark Fric
9 years ago #128695
Hello Julian,
you can add any custom indicator to EA Wizard, including ZigZag.
https://strategyquant.com/eawizard/tutorial_custom_indicators
The only issue is that ZigZag indicator returns value only on the bar on which it makes the top or bottom, so you need a way to recognize it and retrieve the right value.
This is quite tricky, it is difficult to do it in pure EA Wizard, as it requires using a cycle.
It can be made using a little of MQL code and custom function.
Mark
StrategyQuant architect
Julianrob
9 years ago #128707
Hi Mark,
Thanks for your help. I managed to import zigzag custom indi to EA wizard successfully. I think I understand what you’re saying that I need to retrieve the right value.
But when I look at custom indi list and load zigzag, the only specs it has under parameter is shift (refer to image), so look at this second image – I would like it to enter a sell trade based on certain conditions and place stop at the zigzag high marked as the white horizontal line – This is obviously where it stops because price has made a high and is now pulling down.
So how could I tell the indicator it is zigzag high shift 1 or low shift 1?
Your help is appreciated,
Julian
Mark Fric
9 years ago #128824
unfortunately it is neither. If you’ll check for which values ZigZag returns in MT4 Data window you’ll see that most bars it doesn’t return any value. It returns value only if there is peak or bottom.
So you can use function like IndicatorHighestValue(ZigZag(…), X) to get the peak of ZigZag in the last X candles,
or IndicatorLowestValue(ZigZag(…), X) to get ZigZag bottom value.
You can then use these values as your SL or PT.
Mark
StrategyQuant architect
Brainyforex
9 years ago #128928
Hi Julian
Also another way of doing it is by getting a programmer to modify the standard metatrader zigzag indicator so that when you import the custom indicator into strategyquant you can select either the last zigzag high or low. You can also use the addition / subtraction feature in strategyquant to make your stop loss x pips (variable) above / below the last swing high / low. I use the last zigzag high / low as my stop loss with good results. If you need a programmer to do this, just contact me through my website and I will put you in contact with them.
Regards
Fritz
brainyforex.com
Viewing 4 replies - 1 through 4 (of 4 total)