So I want a series of conditions to come true before I enter a trade. I tried to build multiple ifs inside on tick but it doesn't suit to my needs. I don't want all of my conditions to come true to the same tick. I just want them to come true the one after the other. For example if condition 1 is true start searching for condition 2. If after 6 minutes for example the second condition is true start searching for the third condition. The problem I am figuring is that the on tick function is searching for each tick everyone and every time the first condition comes true it is going to search for the second condition. But if then the first condition comes false it is changing to false. I want if it all of my conditions have come true once in a whole day to search for the next one.
- Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6.
- cannot detect new bar form.
- Make function wait until condition
dio1zervas: if condition 1 is true start searching for condition 2.
The same way you do in other languages, you use a State diagram.
How to write a ea command to meet one condition and then the next other before excute - MQL5 programming forum (2018)
enum Condition{ cNewDay, cSeenA, …, cSeenY, cSeenZ}; static Condition status; static datetime curDate=0; datetime preDate=curDate, curDate=date(); if(curDate != preDate) status = cNewDay; if(cNewDay == status){ bool isConditionA = …; if( !isConditionA ) return; status=cSeenA; } ⋮ if(cSeenY == status){ bool isConditionZ = …; if( !isConditionZ ) return; status=cSeenZ; doTrade(); } return;

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register