See sample
int Duration=1; int MagicExpert=666666; int CheckForClose(int type) { if (Duration!=0) { //Lenght of time a postion is held for(int i2=OrdersTotal()-1;i2>=0;i2--) { if(!OrderSelect(i2,SELECT_BY_POS,MODE_TRADES)) continue; if(OrderMagicNumber()!=MagicExpert) continue; if (OrderOpenTime()<TimeCurrent()-Duration*60*720) {//Duration*60*720 if (OrderType()==OP_BUY) { OrderClose(OrderTicket(),OrderLots(),Bid,3,Yellow); } if (OrderType()==OP_SELL) { OrderClose(OrderTicket(),OrderLots(),Ask,3,Violet); } }// end if(OrderOpenTime()<TimeCurrent()-Duration*60*720) }// end for(int i2=OrdersTotal();i2>=0;i2--) } //end duration check }//end check for close
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
when a condition is fulfilled ( equity>=balance*1.2||equity<=balance*0. 8). Thanks in advance.