
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
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);