modify pending order

 

con some one slove that .. 

i wana modify pending order with bollinger band

double MyPoint;

int OnInit()
  {

   if(Digits ==4 || Digits <=2)
      MyPoint=Point ;
   if(Digits ==3 || Digits ==5)
      MyPoint=Point*10 ;

return(INIT_SUCCEEDED);
  }





void OnTick()

 {
  
double bolingbandlower = iBands(NULL,0,20,2,0,PRICE_WEIGHTED   ,MODE_LOWER,0 );
double bolingbanduper = iBands(NULL,0,20,2,0, PRICE_WEIGHTED  ,MODE_UPPER,0 );

RefreshRates();
int total=OrdersTotal();

double priceNew;


  for(int i=0; i<total; i++)
   {
      if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
      {
         if (OrderType()==OP_BUYSTOP)
         {
               if(bolingbanduper - OrderOpenPrice() >2*MyPoint||OrderOpenPrice()- bolingbanduper>2*MyPoint  )
               {
                    priceNew=(bolingbanduper);
                     OrderModify(OrderTicket(),priceNew,0,OrderStopLoss(),OrderTakeProfit());
                    
               }
         }        
         else if (OrderType()==OP_SELLSTOP)
         {
               if (OrderOpenPrice()- bolingbandlower>2*MyPoint||bolingbandlower - OrderOpenPrice()>2*MyPoint )
               {
                     priceNew=(bolingbandlower);
                     OrderModify(OrderTicket(),priceNew,0,OrderStopLoss(),OrderTakeProfit());
                   
               }
         }
      }

   }
}

why dsont wok

 
ALI AMRIOUI:

con some one slove that .. 

i wana modify pending order with bollinger band

why dsont wok

MT5 or  MT4?

Anyway place the cursor in iBands and press F1 - study and use the example!!

 
  1. double bolingbandlower = iBands(NULL,0,20,2,0,PRICE_WEIGHTED   ,MODE_LOWER,0 );
    double bolingbanduper = iBands(NULL,0,20,2,0, PRICE_WEIGHTED  ,MODE_UPPER,0 );

    Why did you post your MT4 question in the MT5 General section instead of the MQL4 section, (bottom of the Root page)?
              General rules and best pratices of the Forum. - General - MQL5 programming forum?
    Next time, post in the correct place. The moderators will likely move this thread there soon.

  2.                      OrderModify(OrderTicket(),priceNew,0,OrderStopLoss(),OrderTakeProfit());

    Check your return codes, and report your errors (including market prices and your variables). Don't look at GLE/LE unless you have an error. Don't just silence the compiler (MT5/MT4+strict), it is trying to help you.
              What are Function return values ? How do I use them ? - MQL4 programming forum (2012)
              Common Errors in MQL4 Programs and How to Avoid Them - MQL4 Articles (2014)

 
William Roeder #:
  1. Why did you post your MT4 question in the MT5 General section instead of the MQL4 section, (bottom of the Root page)?
              General rules and best pratices of the Forum. - General - MQL5 programming forum?
    Next time, post in the correct place. The moderators will likely move this thread there soon.

  2. Check your return codes, and report your errors (including market prices and your variables). Don't look at GLE/LE unless you have an error. Don't just silence the compiler (MT5/MT4+strict), it is trying to help you.
              What are Function return values ? How do I use them ? - MQL4 programming forum (2012)
              Common Errors in MQL4 Programs and How to Avoid Them - MQL4 Articles (2014)

sorry i use mt4

 
ALI AMRIOUI #: sorry i use mt4

So next time post there as I already said. (#2.1)

Reason: