Please help with one trade per day code
Hello Guys
I want my EA to open only one trade per day.I do not know what code to use.Please help me if you know.،Thanks aLot
It is possible when coded the way within the EA
-
For a new bar test, Bars is unreliable (a refresh/reconnect can change number of bars on chart), volume is unreliable (miss ticks), Price is unreliable (duplicate prices and The == operand. - MQL4 programming forum.) Always use time.
New candle - MQL4 programming forum #3 2014.04.04I disagree with making a new bar function, because it can only be called once per tick. A variable can be tested multiple times.
Running EA once at the start of each bar - MQL4 programming forum 2011.05.06 - For a new day just substitute date for time.
void OnTick(){ static datetime curDate=0; datetime preDate=curDate; curDate=date(); if(curDate != preDate) OnNewDay(); ⋮
Find bar of the same time one day ago - MQL4 programming forum 2017.10.06 -
You could also use D1 timeframe, but then you have to deal with 4066/synchronization issue.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello Guys
I want my EA to open only one trade per day.I do not know what code to use.Please help me if you know.،Thanks aLot