Take profit MQL 4 - page 2

 
Adj007 #:
You normalise the double using that equation. That equation you’ve put returns more than 5 digits. You need to fill a separate variable with that equation and then use normalise. 

is that what your talking about?

double Price1 = (TPD1-OrderOpenPrice())+OrderOpenPrice();

NormalizeDouble(Price1,100);



              {

               res=OrderModify(OrderTicket(), OrderOpenPrice(), OrderStopLoss(), Price1, 0, CLR_NONE);

              }
 
I am going to assume TPD1 is a price i.e 1.25434 and it is a buy you want to modify. 


double pricedraft = (TPD1-OrderOpenPrice()); // if TPD1 is above OrderOpenPrice

NormalizeDouble(Price1,100); <---- double Price = NormalizeDouble(pricedraft,6);

double finalprice = OrderOpenPrice() + Price; <--- returns the same take profit you have just inerted. 


              {

               res=OrderModify(OrderTicket(), OrderOpenPrice(), OrderStopLoss(), finalprice, 0, CLR_NONE);

              }

I am not entirely sure if this will run because you are not specifying which order you want to modify and also the return value of finalprice = take profit so that makes the usage of OrderModify redundant. 

FYI
NormalizeDouble allows you to trim the number of digits there are in an output.
double stores decimals, integer stores whole numbers
OrderOpenPrice() with specification returns the orders open price
OrderModify() allows you to modify a position, you may include conditions