A TP/SL is a price. TP-OrderOpenPrice() is not a price. Always post all relevant code. What is TP?
A TP/SL is a price. TP-OrderOpenPrice() is not a price. Always post all relevant code. What is TP?
Thanks William, TP is also a Price Value.
So, (Price Value - OrderOpenPrice()); the issue is the Price Value is larger then the OrderOpenPrice(), and so, if you were to Calculate a Take Profit value with (OrderOpenPrice()- Price Value ) the TakeProfit value would be negative on a BUY order. When you rearrange the equation as (Price Value - OrderOpenPrice()), MQL4 doesn't let you minus Price Value from OrderOpenPrice().
What do you mean OrderOpenPrice is not a Price? how would i get the same value for the equation above?
I've tried;
double OpenPrice = OrderOpenPrice();
then inputing;
(PriceValue - OpenPrice)
But that hasn't worked.
- Take profit is a price. TP is a price. Set your take profit to TP.
- I did not say OrderOpenPrice() is not a price. I said TP-OrderOpenPrice() is not a price.
Hey, try to normalise your double.
Thanks Adj007, i've tried;
double OP = OrderOpenPrice(); NormalizeDouble(OP,3); { res=OrderModify(OrderTicket(), OrderOpenPrice(), OrderStopLoss(), OP-TP, 0, CLR_NONE); }
From my research, NormalizedDouble is only adjusting digits after the decimal point. This hasn't worked either.
- Take profit is a price. TP is a price. Set your take profit to TP.
- I did not say OrderOpenPrice() is not a price. I said TP-OrderOpenPrice() is not a price.
Yeah, TP is also a Price Value. So, PriceValue-OpenPriceValue will give the points from the open price to the Take profit. And so the equitation is being implemented in doubletakeprofit.
So, how would I find that same value of PriceValue-OpenPriceValue?
No, you have not been paying attention! Everyone has been telling you that OrderModify() only accepts a "price" for a TakeProfit, not a "price difference".
For example, if your open price is 1.2345 and your take profit is 1.2398, then use OrderModify( OrderTicket(), OrderOpenPrice(), OrderStopLoss(), 1.2398, 0, CLR_NONE )
Don't use OrderModify( OrderTicket(), OrderOpenPrice(), OrderStopLoss(), 1.2345 - 1.2398, 0, CLR_NONE )
No, you have not been paying attention! Everyone has been telling you that OrderModify() only accepts a "price" for a TakeProfit, not a "price difference".
For example, if your open price is 1.2345 and your take profit is 1.2398, then use OrderModify( OrderTicket(), OrderOpenPrice(), OrderStopLoss(), 1.2398, 0, CLR_NONE )
Don't use OrderModify( OrderTicket(), OrderOpenPrice(), OrderStopLoss(), 1.2345 - 1.2398, 0, CLR_NONE )
So, if i put in the equation;
{
res=OrderModify(OrderTicket(), OrderOpenPrice(), OrderStopLoss(), (TP-OrderOpenPrice())+OrderOpenPrice(), 0, CLR_NONE);
}
this will find a price; (TP-OrderOpenPrice())+OrderOpenPrice() but this doesn't work either?
Thanks Adj007, i've tried;
From my research, NormalizedDouble is only adjusting digits after the decimal point. This hasn't worked either.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi, If i want to modify a take profit, I've tried this but it doesn't work.