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
hello
in mql4 i used following code
for (i=0;i<OrdersTotal();i++){
OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
if( OrderMagicNumber()==Magic){
if(OrderType()==OP_BUYSTOP || OrderType()==OP_BUY) Bought++;
if(OrderType()==OP_SELLSTOP || OrderType()==OP_SELL) Sold++;
}
}
if( Bought==0 ){ //no buy order
Ticket=OrderSend(Symbol(),OP_BUYSTOP,Lots, Long ,3, SLLong, 0,Text,Magic,TimeCurrent() + 119*60*60,Blue);
}
this works very well
but in mql5
for (int i=0;i<OrdersTotal();i++){
//OrderSelect(0,0);
if(ORDER_COMMENT == Text && ORDER_MAGIC == MN){
if(ORDER_TYPE == ORDER_TYPE_BUY || ORDER_TYPE == ORDER_TYPE_BUY_STOP) Bought++;
if(ORDER_TYPE == ORDER_TYPE_SELL || ORDER_TYPE == ORDER_TYPE_BUY_STOP) Sold++;
}
}
dont work this code
how i have to write it?
regards