Order modify error 1 for XAGUSD only!

Back to topics list To post a new topic, please log in or register
avatar
49
Opengates 2015.11.23 05:46
 

Hi everyone in the house,

I have this challenge in my modification code but what baffled me most is that it only occurs on XAGUSD (SILVER) and works fine on other currencies. Please help check and tell me what I am doing wrong. However, I noticed the XAGUSD is having 2 digits point value i. e 24.23 as currency quote, can this cause it and how do I handle it?

//----------------------------------------------------------------- 
   if(UseBEnTS==true) {
        Symb=Symbol();       
        for(Ticket=OrdersTotal()-1; Ticket>=0; Ticket--) {      
        if(OrderSelect(Ticket,SELECT_BY_POS,MODE_TRADES)) {     
        if(OrderSymbol()==Symb) {
        OP=OrderOpenPrice(); Tip=OrderType(); RefreshRates(); SL=OrderStopLoss();     
//-----  MoveStopLoss Strategies by Levels  --------              
            double Min_Dist=MarketInfo(Symb,MODE_STOPLEVEL); // 
            if(bBE<Min_Dist) bBE=Min_Dist;                     // 
            Min_Dist=MarketInfo(Symb,MODE_STOPLEVEL); //
            if(tTS<Min_Dist) tTS=Min_Dist; 
            //--------------------------------------------------- 4 --
            bool Modify=false;                  // 
            switch(Tip) {
                  case 0 :                          // Buy                
                  if(NormalizeDouble(OP,Digits)>NormalizeDouble(SL,Digits) && 
                  NormalizeDouble(Bid-bBE,Digits)>NormalizeDouble(OP,Digits)) {
                     SL=OP+sPrd; Text="Buy "; Modify=true; }
                    if(NormalizeDouble(OP,Digits)<NormalizeDouble(Bid-tTS,Digits)) {
                     SL=Bid-tTS; Text="Buy "; Modify=true; } break;                         
                  case 1 :                          //  Sell
                   if(NormalizeDouble(OP,Digits)<NormalizeDouble(SL,Digits) && 
                   NormalizeDouble(Ask+bBE,Digits)<NormalizeDouble(OP,Digits)) {
                     SL=OP-sPrd; Text="Sell "; Modify=true;  }
                     if(NormalizeDouble(Ask+tTS,Digits)<NormalizeDouble(OP,Digits)) {
                     SL=Ask+tTS; Text="Sell "; Modify=true;  } }                                
            if (Modify==false) break;                           // while
           //----------------------------------------------------
             TP=OrderTakeProfit(); double Price=OrderOpenPrice(); Ticket=OrderTicket();
             bool Ans=OrderModify(Ticket,Price,SL,TP,0);//
            //--------------------------------------------------- 
             if(Ans==true) { Print("Order ",Text," ", Ticket," has been modified!");
             break; RefreshRates(); } } } } }
 //========================================
avatar
3134
qjol 2015.11.26 14:20 #
 

Opengates:

 

and works fine on other currencies.

 

i wonder how it works at all

 

bool Ans=OrderModify(Ticket???,Price,SL,TP,0);//

OrderModify()

 

bool  OrderModify(
   int        ticket,      // ticket no. not the index in the order pool
   double     price,       // price
   double     stoploss,    // stop loss
   double     takeprofit,  // take profit
   datetime   expiration,  // expiration
   color      arrow_color  // color
   );

 

Back to topics list  

To add comments, please log in or register