John Fasheyiku:
Hi JohnHey
Is there a piece of code I can add to my EA so all new trades expire after x Minutes?
Many Thanks
John
Do you mean pending orders? Or orders that have actually opened?
Yes, you would first need to code a loop to search through all the open orders, you will then have to select the order you wish to add an instruction to.
So let's say you want to select an order.
for(int da=OrdersTotal()-1;da>=0;da--) { if(OrderSelect(da,SELECT_BY_POS,MODE_TRADES)) { if(OrderMagicNumber()==MagicNumber && OrderSymbol()==Symbol()&& OrderType()==OP_BUY) {
now you can narrow things down by saying, if(OrderOpenTime() - TimeSeconds>=numberOfMinutes*60){some close order code}
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
Hey
Is there a piece of code I can add to my EA so all new trades expire after x Minutes?
Many Thanks
John