Hello I found AlgoWizard today and very exciting that this is really a good tool.
I have read the help document and tried some EA.
I want to make an EA with one or 2 conditions delay, which means when these condition trigered, the condition will be set to be True for a period time, no mater the original condition has turn into false。
here is an simple example:
When MACD divergency in the past 60 bars, when MACD cross 0 line open buy. ( it shows divergency in the past but maybe not in recent. )
I saw that we can use if…then to set variables, maybe I can set a variable when MACD divergency and let it last for 60 bars ?
And MACD divergency is another feature, which I have saw a sample in the user document, havn’t view it yet.
Any responce will be thanksful, I will go on try this and will give some further info.
if you want to combine two signals that do not have to appear at the same time but with a delay from one another you can easily achieve that by using variables (call them state variables) so you will split the logic into 2 steps:
1) check for MACD divergency … when a buy MACD divergency occurs you set a variable (create a new one called ‘divergencyState (int)) to +1
2) create a second condition that checks a situation when MACD crosses above 0 AND divergencyState = 1 …. now you can trigger a buy entry and set divergencyState back to 0 for next situation
This way there can be multiple bars delay between those two signals so after a divergence a strategy “waits” until the MACD crosses above 0 line
If you want to limit the number of bars between signals you also need to “count bars” after divergencyState is set to 1 and check for “max bars to detect MACD cross above 0”
Let me know if you need any help with this
You must be logged in to reply to this topic.