Stop Loss with price value New comment evertonalex 2015.08.03 04:44 I'm learning MQL5 and I'm me with a question. In most EA examples, the stop loss and take profit are realized by points. However, I would like to use the stop loss and take profit by the price. How can I do that? mrequest.action=TRADE_ACTION_DEAL; mrequest.price = NormalizeDouble(latest_price.bid,_Digits); mrequest.sl = NormalizeDouble(latest_price.bid + STP*_Point,_Digits); // Stop Loss I want use stop by price here mrequest.tp = NormalizeDouble(latest_price.bid - TKP*_Point,_Digits); // Take Profit mrequest.symbol = _Symbol; mrequest.volume = Lot; mrequest.magic = EA_Magic; mrequest.type= ORDER_TYPE_SELL; mrequest.type_filling = ORDER_FILLING_FOK; mrequest.deviation=100; //--- send order OrderSend(mrequest,mresult); Questions from Beginners MQL5 MT5 MetaTrader 5 Errors, bugs, questions Closing a position New comment
I'm learning MQL5 and I'm me with a question. In most EA examples, the stop loss and take profit are realized by points. However, I would like to use the stop loss and take profit by the price. How can I do that?
mrequest.action=TRADE_ACTION_DEAL;
mrequest.price = NormalizeDouble(latest_price.bid,_Digits);
mrequest.sl = NormalizeDouble(latest_price.bid + STP*_Point,_Digits); // Stop Loss I want use stop by price here
mrequest.tp = NormalizeDouble(latest_price.bid - TKP*_Point,_Digits); // Take Profit
mrequest.symbol = _Symbol;
mrequest.volume = Lot;
mrequest.magic = EA_Magic;
mrequest.type= ORDER_TYPE_SELL;
mrequest.type_filling = ORDER_FILLING_FOK;
mrequest.deviation=100;
//--- send order
OrderSend(mrequest,mresult);