help about OrderModify Error 1

 
i use ( bollinger bands)  for modify SellStop .. and all time i have  in the journal (OrderModify Error 1)

some one can help me plz to slove it 


//+------------------------------------------------------------------+
//|                                                      ProjectName |
//|                                      Copyright 2018, CompanyName |
//|                                       http://www.companyname.net |
//+------------------------------------------------------------------+

input string EaName = "ATLAS" ;
double priceNew1,priceNew10,priceNew100,priceNew_1;
extern double lot = 0.01 ;
extern double TP = 0 ;
extern double SL = 0 ;
extern int MagicNumber1 = 1917 ;
double MyPoint  ;
int Ticket,Decimal;
color N = clrNONE;


//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int OnInit()
  {

   if(Digits ==4 || Digits <=2)
      MyPoint=Point ;
   if(Digits ==3 || Digits ==5)
      MyPoint=Point*10 ;
   Comment(EaName,"\n\nalkosovi13@yahoo.fr") ;
   if(MarketInfo(Symbol(),MODE_MINLOT)<0.1)
      Decimal =2;
   else
      Decimal=1;



   return(INIT_SUCCEEDED);
  }



//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {


  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()

  {

   double bolingbandlower1= iBands(NULL,0,20,2,0,PRICE_TYPICAL,MODE_LOWER,0);
   double bolingbandlower10=NormalizeDouble(bolingbandlower1,Digits);



//SELLSTOP
   if(TS()<1  && Total(OP_SELLSTOP)<1  && Low[0]<(Close[1]-5*MyPoint) && Ask<  bolingbandlower10 && Bid >bolingbandlower10-2*MyPoint)

     {

      priceNew1 = bolingbandlower10-4*MyPoint ;
      priceNew10 = priceNew1 +SL*MyPoint;
      priceNew100 = priceNew1-TP*MyPoint;

      Ticket= OrderSend(Symbol(),OP_SELLSTOP,lot,priceNew1,1, priceNew10, priceNew100,EaName,MagicNumber1,0,N);


     }



//OrderModify

   int total=OrdersTotal();

   for(int i=0; i<total; i++)
     {
      if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))


        {
         //Modify_SELLSTOP

         if(OrderType()==OP_SELLSTOP && OrderSymbol()==Symbol()&&OrderMagicNumber()==MagicNumber1)

           {

            priceNew1  =  bolingbandlower10-4*MyPoint;
            priceNew10 = priceNew1 +SL*MyPoint;
            priceNew100 = priceNew1-TP*MyPoint;


            bool  modify3 =  OrderModify(OrderTicket(), priceNew1, priceNew10, priceNew100,0,clrRed);

            priceNew_1=  NormalizeDouble(priceNew1,Digits);

           }

        }

     }

  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int TS()
  {

   int s=0,i;
   for(i =0 ; i < OrdersTotal() ; i++)
     {
      if(OrderSelect(i,SELECT_BY_POS, MODE_TRADES))
         if(Symbol()== OrderSymbol()&& OrderMagicNumber() == MagicNumber1 && OrderType() == OP_SELL)
           {
            s++ ;

           }
     }
   return (s) ;
  }


// pending order

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int Total(int type=-1)
  {
   int total =0,i;
   for(i=0; i<OrdersTotal(); i++)
     {
      if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
         if(Symbol()==OrderSymbol()&& OrderMagicNumber()==MagicNumber1   && (OrderType()==type||type==-1))
           {
            total++;
           }
     }
   return (total);
  }

//+------------------------------------------------------------------+
 

Did you run a search before posting and read the many existing threads about the same issue?

 
ALI AMRIOUI in the journal (OrderModify Error 1)
ERR_NO_RESULT
You Server
Change the SL to X It is at X!
Change the SL to X It is at X!
Change the SL to X You are insane
Insanity: doing the same thing over and over again and expecting different results.
          Unknown

Compute the new value, then check that you are moving the existing value at least a tick.
          What is a TICK? - MQL4 programming forum (2014)

 
Fernando Carreiro #:

Did you run a search before posting and read the many existing threads about the same issue?

yes i search but i did not found any solution

 
ALI AMRIOUI #:yes i search but i did not found any solution
Then you did not read very well or you did not understand the answers.
 
Fernando Carreiro #:
Then you did not read very well or you did not understand the answers.

yes i dont understand i found many things diffirent

 
ALI AMRIOUI #: yes i dont understand i found many things diffirent

Did you not understand that you are repeatedly trying to "modify" even when your stops have not changed (when the "new" values are exactly the same as the "old" values)?

If the stops have not changed, then don't try to "modify" them again.

 
Fernando Carreiro #:

Did you not understand that you are repeatedly trying to "modify" even when your stops have not changed (when the "new" values are exactly the same as the "old" values)?

If the stops have not changed, then don't try to "modify" them again.

but how ican do that??

can u write me the code??

 
Fernando Carreiro #:

Did you not understand that you are repeatedly trying to "modify" even when your stops have not changed (when the "new" values are exactly the same as the "old" values)?

If the stops have not changed, then don't try to "modify" them again.

like that for exemple 

//OrderModify

   int total=OrdersTotal();

   for(int i=0; i<total; i++)
     {
      if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))


        {
         //Modify_SELLSTOP

         if(  OrderType()==OP_SELLSTOP && OrderSymbol()==Symbol()&&OrderMagicNumber()==MagicNumber1)

           {

            priceNew1  =  bolingbandlower10-4*MyPoint;
            priceNew10 = priceNew1 +SL*MyPoint;
            priceNew100 = priceNew1-TP*MyPoint;


            bool  modify3 =  OrderModify(OrderTicket(), NormalizeDouble(priceNew1,Digits), NormalizeDouble(priceNew10,Digits), NormalizeDouble(priceNew100,Digits),0,clrRed);

           
   

           }

        }

     }
 
ALI AMRIOUI #: can u write me the code??
Show us your attempt (using the CODE button) and state the nature of your difficulty.
          No free help (2017)

Or pay someone. Top of every page is the link Freelance.
          Hiring to write script - General - MQL5 programming forum (2018)

We're not going to code it for you (although it could happen if you are lucky or the issue is interesting).
          No free help (2017)

 
William Roeder #:
Show us your attempt (using the CODE button) and state the nature of your difficulty.
          No free help (2017)

Or pay someone. Top of every page is the link Freelance.
          Hiring to write script - General - MQL5 programming forum (2018)

We're not going to code it for you (although it could happen if you are lucky or the issue is interesting).
          No free help (2017)

i fount it  and its work correctly

//OrderModify

   int total=OrdersTotal();

   for(int i=0; i<total; i++)
     {
      if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))


        {
         //Modify_SELLSTOP

         if( (bolingbandlower10-4*MyPoint>OrderOpenPrice()+1*Point ||  bolingbandlower10-4*MyPoint<OrderOpenPrice()-1*Point)   &&     OrderType()==OP_SELLSTOP && OrderSymbol()==Symbol()&&OrderMagicNumber()==MagicNumber1 &&OrderTicket()==Ticket  )

           {

            priceNew1 =  bolingbandlower10-4*MyPoint;
            priceNew10 = priceNew1 +SL*MyPoint;
            priceNew100 = priceNew1-TP*MyPoint;


            bool  modify3 =  OrderModify(Ticket, priceNew1, priceNew10, priceNew100,0,clrRed);

      
   

           }

        }

     }