I want to limit trades within a day to x number
is this the best way to do? by checking the history?
It's the more reliable way. Any problem with this code ?
no problem but its kinda slow. so searching for more opinions :)
Don't execute such function on each tick, but only when needed.
Use a global variable for your counter, initialize it with your function, then update your variable each time you place a trade with your EA.
By the way, you are counting deals, it can be different from the number of trades depending of what you call a trade.
Don't execute such function on each tick, but only when needed.
Use a global variable for your counter, initialize it with your function, then update your variable each time you place a trade with your EA.
By the way, you are counting deals, it can be different from the number of trades depending of what you call a trade.
that's an interesting idea, so I just need to reset the counter at the start of the day.
How can I restart at start of the day?
that's an interesting idea, so I just need to reset the counter at the start of the day.
How can I restart at start of the day?
![](https://c.mql5.com/3/67/wink.gif)
By doing some efforts
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I want to limit trades within a day to x number
is this the best way to do? by checking the history?