Hi, can anyone show me the code how to limit the total of transactions per day? I see most of the EA only limits open position per execution.
Let say I need to limit the transaction only 2 transaction per day, because if more than two, the risk of trade will increase.
thanks for helping.
Equivolume Charting Revisited
The article dwells on the method of constructing charts, at which each bar consists of the equal number of ticks.
Just perform a loop to count the number of open orders each time before you place a trade.
Only place a trade when the result is less than 2.
Fleshing this out in pedantic detail, for aristonchai's benefit: you'll probably need to do two loops. One to check closed orders, and one to check open/pending orders, and then add the totals together.
In even more pedantic detail, there's a potential problem with anything which relies on looping through the account history: the user can break it. Any date filtering which is applied on screen to the list of trades in the account history also affects what an EA sees, in terms of things such as OrdersHistoryTotal(). Therefore, if the user applies a date filter such as "Last Month", then the EA will not be able to see any orders placed and closed today. Also worth bearing in mind that attempts to select a historic closed order using OrderSelect(x, SELECT_BY_TICKET) also fail if the order has been filtered out of the account history. (This, incidentally, is a horrible design decision by Metaquotes, and something which I really hope gets changed in MT5.)
To add comments, please log in or register
Copyright 2000-2013, MetaQuotes Software Corp.