Forum

Error Code #1, how to avoid modify when the value is same.

if (OrderTakeProfit()!= tp || OrderStopLoss() != 0 ){ if (OrderModify(OrderTicket(),OrderOpenPrice(),sl,tp, 0 , clrNONE )) Print ( "Modified successfully" ); else Print ( "Error in OrderModify. Error code=" , GetLastError ()); } I am trying to stop EA to modify the value when it has

Error 131 when trying to publish a simple EA to the market.

void OnTick () { Count(); if (Automated== true ){ if (count1== 0 ){ int ticket= OrderSend ( Symbol (),OP_BUY, 0.01 ,Ask, 3 , 0 , 0 , "My order" , 0 , 0 , clrGreen ); if (ticket< 0 ) { Print ( "OrderSend failed with error #" , GetLastError ()); } else Print (

Trying to get the latest open trade info.

void counttrades() { //---- int total= OrdersTotal (); if (total== 0 ) openedtrades= 0 ; else { for ( int i= 0 ; i<total; i++) { if (! OrderSelect (i, SELECT_BY_POS )) continue ; if ( OrderSymbol ()== Symbol ()) { openedtrades++;

ExitTrade function question!!

void ExitTrade() { for ( int i= OrdersTotal (); i>= 0 ; i--) { if ( OrderSelect (i, SELECT_BY_POS )) { if ( OrderType ()== OP_BUY && OrderMagicNumber () == MagicNumber) { while ( true ) { bool result = OrderClose ( OrderTicket ()