I have been trying to find an answer for this but still unsuccessful. Seniors, kindly guide. I want to do it using MQL5.
not enuf details in your question. What have you tried? There is many styles of trail stops that you can find on codebase, of which many of them use the std libraries.
There is also detailed examples in the editor help.
There is also examples in the experts folder of mt5 that use the trail stop settings from the std libraries.
I am opening a trade using the below code. I can set a fixed Stop Loss but I don't know how to set a trailing stop loss.
```
MqlTradeRequest request = {};
request.action = TRADE_ACTION_DEAL; // Specify a market order
request.symbol = _Symbol;
request.volume = lot;
request.type = ORDER_TYPE_SELL;
request.price = SymbolInfoDouble(_Symbol, SYMBOL_BID);
request.deviation = 30; // Maximum allowed slippage
request.magic = Magic;
request.comment = comment;
request.type_filling = ORDER_FILLING_IOC;
request.type_time = ORDER_TIME_GTC; // Good till canceled order
request.sl = sl;
request.tp = tp;
MqlTradeResult result = {};
OrderSend(request, result);
```
not enuf details in your question. What have you tried? There is many styles of trail stops that you can find on codebase, of which many of them use the std libraries.
There is also detailed examples in the editor help.
There is also examples in the experts folder of mt5 that use the trail stop settings from the std libraries.
I responded above what I have tried so far.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use