Download MetaTrader 5

I'm going crazy with OrderModify error 1 - page 2

To add comments, please log in or register
Bro840
104
Bro840 2016.02.09 16:57  
i have to change that 5 for a variable of course
Bro840
104
Bro840 2016.02.09 17:02  

Thank you both of you that help me out on this problem

 

Very appreciated 

honest_knave
Moderator
2422
honest_knave 2016.02.09 18:19  
   double SL=NormalizeDouble((Ask + PipsToLockInTS * Point),Digits); // don't calculate it twice
   if (OrderStopLoss() > SL || OrderStopLoss() == 0)   
Glad you got it sorted. You can use Digits for the NormalizeDouble. Also, save the calculated SL to a variable otherwise you'll need to calculate it again during OrderModify
whroeder1
14756
whroeder1 2016.02.09 19:30  
honest_knave:

I'm afraid that isn't actually the case.

When you change timeframes, the extern will revert to the value set in the Inputs window (so it forgets all the modifications made to it during the running of the code to date). 

I stand corrected. The behavior has changed recently.
Bro840
104
Bro840 2016.02.09 19:35  

Digits was my solution indeed :)

And i may update the code in the way you told, it really releases some CPU power :)

Thank you again

 

By the way i have updated my litle function AdjustPips and now instead of  Variable * Points i use Variable * Pip

void AdjustPips()
{
   if (Point == 0.00001 || Point == 0.001)
   {
      StopLoss       = StopLoss * 10;
      TakeProfit     = TakeProfit * 10;
      PipsToTriggerBE  = PipsToTriggerBE * 10;
      PipsToLockInBE   = PipsToLockInBE * 10;
      PipsToTriggerTS  = PipsToTriggerTS * 10;
      PipsToLockInTS   = PipsToLockInTS * 10;
   }
}

to

void AdjustPips()
{
   if (Point == 0.00001 || Point == 0.001)
      Pip = Point * 10;
   else
      Pip = Point;   
}
12
To add comments, please log in or register