The Problem with Trailing Stop in MetaTrader 5 - Forcing Trailing Stop to Activate at a Certain Profit Level - page 2

 
hello.new #:Thank you for the great explanation. I do understand that there's no such thing as 100% guarantee. What I meant was as close to it as possible. But yes, you're right, it absolutely needs some “buffer”, I just skipped explaining that part, I thought it was understood.

In that case, then there are already implementations out there already, which implement a trailing-stop with a trailing-step, that will achieve what you want.

The choice of the "step" and "stop" parameter values will allow you to get what you want, with the "buffer".

Do some research and test out the various implementations. But, if even then, if it's not exactly what you want, consider the Freelance option.

 
Fernando Carreiro #:

In that case, then there are already implementations out there already, which implement a trailing-stop with a trailing-step, that will achieve what you want.

The choice of the "step" and "stop" parameter values will allow you to get what you want, with the "buffer".

Do some research and test out the various implementations. But, if even then, if it's not exactly what you want, consider the Freelance option.

Thank you again Fernando.
 

If I can make the suggestion, you may want to look at trailing stop techniques based on either:

  • Parabolic SAR
  • ATR (Average True Range multiple — Chandelier Exit is a special case of this)
  • Exponential Moving Average (EMA, or Double/Triple EMA)

All of these have the benefit of dynamically adjusting to the price action as the trade progresses, particularly that they tend to tighten up the stop when the trade slows/stalls. You need to test it for yourself in the context of your main strategy, but I can tell you that in my experience, every one of these has outperformed the standard trailing stop, or even a step-stop with fixed points as Fernando described. And if you're going to have to use code anyway, you might as well use better code.

There are dozens of examples in the CodeBase. If you just want it for manual trading, there are many free/inexpensive options in the market. I only know of a couple that are specifically marketed as a trailing stop solution — most are listed as trade managers/assistants, and some different trailing stop options are just one of many features.

Also, two of these three options (PSAR and EMA) are available as trailing stop options in the MQL Wizard EA generator. That won't help you for manual trading, but it's another option.
 
Scott Allen #:

If I can make the suggestion, you may want to look at trailing stop techniques based on either:

  • Parabolic SAR
  • ATR (Average True Range multiple — Chandelier Exit is a special case of this)
  • Exponential Moving Average (EMA, or Double/Triple EMA)

All of these have the benefit of dynamically adjusting to the price action as the trade progresses, particularly that they tend to tighten up the stop when the trade slows/stalls. You need to test it for yourself in the context of your main strategy, but I can tell you that in my experience, every one of these has outperformed the standard trailing stop, or even a step-stop with fixed points as Fernando described. And if you're going to have to use code anyway, you might as well use better code.

There are dozens of examples in the CodeBase. If you just want it for manual trading, there are many free/inexpensive options in the market. I only know of a couple that are specifically marketed as a trailing stop solution — most are listed as trade managers/assistants, and some different trailing stop options are just one of many features.

Also, two of these three options (PSAR and EMA) are available as trailing stop options in the MQL Wizard EA generator. That won't help you for manual trading, but it's another option.
Thank you Scott for the suggestion. Yes, I only trade manually, so what I need is a trailing stop that activates as I open a new trade. Your suggestions are very interesting. I'm going to read about them and see which one is closer to what I'm looking for. Thank you again Scott.
 
hello.new #:
Thank you Scott for the suggestion. Yes, I only trade manually, so what I need is a trailing stop that activates as I open a new trade. Your suggestions are very interesting. I'm going to read about them and see which one is closer to what I'm looking for. Thank you again Scott.

I'll add this observation:  there's what we're looking for, and there's what the market gives us. 🙂

I'm not a believer in using arbitrary point targets — you will generally either fall short or leave money on the table. There's a big difference between the market hitting your 300 point profit target in the middle of a big bullish candle, or a big bull run, vs. hitting it in the middle of several choppy sideways candles. The 300 is arbitrary. Using a stop loss that reacts to the ebb and flow of the trade seems less likely to leave money on the table that you could have gotten, and also less likely to retrace after falling just short of your arbitrary target.

Trade what the market gives you.

 
Scott Allen #:

I'll add this observation:  there's what we're looking for, and there's what the market gives us. 🙂

I'm not a believer in using arbitrary point targets — you will generally either fall short or leave money on the table. There's a big difference between the market hitting your 300 point profit target in the middle of a big bullish candle, or a big bull run, vs. hitting it in the middle of several choppy sideways candles. The 300 is arbitrary. Using a stop loss that reacts to the ebb and flow of the trade seems less likely to leave money on the table that you could have gotten, and also less likely to retrace after falling just short of your arbitrary target.

Trade what the market gives you.

Your observation sounds very reasonable. How about using the regular trailing stop but at the same time being ready to manually close the trade if it starts going against you?

For instance you buy and put a 300-point trailing stop. The price goes up 300 points, and activates the trailing stop. From that point on, your mouse is on the close button ready to close, in case the price started going down. If/when the price reaches around 600 points from your initial long position, it means the trailing stop is now actually giving you 300 guaranteed points. From that point forward, you don't need to manually close the position anymore, you can let the trailing stop give you as much profit as possible.

 
hello.new #:

Your observation sounds very reasonable. How about using the regular trailing stop but at the same time being ready to manually close the trade if it starts going against you?

For instance you buy and put a 300-point trailing stop. The price goes up 300 points, and activates the trailing stop. From that point on, your mouse is on the close button ready to close, in case the price started going down. If/when the price reaches around 600 points from your initial long position, it means the trailing stop is now actually giving you 300 guaranteed points. From that point forward, you don't need to manually close the position anymore, you can let the trailing stop give you as much profit as possible.

That seems reasonable. What you could also do in conjunction with that is tighten up your trailing stop as the trade progresses after your initial target, so that whatever gains are made aren't lost on a pullback.

One thing to be aware of is that a trailing stop, just as with manual trading, can be subject to slippage, particularly if the reversal is very sudden/strong.

 
hello.new #: I want to guarantee the 300-point profit, but I don't want to limit the profit to 300 points. So I need a Trailing Stop that starts from my Take Profit point, not from the initial trade level.

Not possible. You can't move the SL to the market. If you are trailing, you must be able to lose the trail amount.

If you want the guarantee, use a TP. Does that make sense now?

 
Scott Allen #:

That seems reasonable. What you could also do in conjunction with that is tighten up your trailing stop as the trade progresses after your initial target, so that whatever gains are made aren't lost on a pullback.

One thing to be aware of is that a trailing stop, just as with manual trading, can be subject to slippage, particularly if the reversal is very sudden/strong.

Tightening up the trailing stop sounds great, thank you. Regarding slippage, do you mean that the price can slip past the trailing stop without it getting hit? What protection can one have against such an event?

Also if I may, I created a $1,000 demo account with 50:1 Leverage. I wanted to see what would happen to my Margin Level and Free Margin if I open as many trades as possible. The initial Margin Level was around 1200%. With each new open trade, the initial (1200%) Margin Level got divided by the number of open trades. So for instance with one open trade, the Margin Level was around 1200%. A second trade brought the Margin Level down to around 600%. The third one brought it down to around 400% and so on and so forth. I could only open 12 trades before the Margin Level reached around 100% and Free Margin was around 30 or 40.

So now My question is: Assuming all these 12 open trades are profitable at the moment and protected by ALREADY ACTIVATED Trailing Stop, what would happen in case of a Black Swan Event? For instance a huge gap, that opens on the wrong side of all those 12 trades (the trades which were initially winning trades had it not been for the Black Swan Event)? Does that mean the account is blown? Because remember, the Free Margin got around 30 to 40 with those 12 open positions.

And if the answer is yes, then what measures can one take for a $1,000 account with 50:1 Leverage to not get to that point? I know one answer is to NOT have 12 open trades simultaneously. But what if adding new winning trades is part of the strategy? I'm a little confused.
 
hello.new #:

Tightening up the trailing stop sounds great, thank you. Regarding slippage, do you mean that the price can slip past the trailing stop without it getting hit? What protection can one have against such an event?

Also if I may, I created a $1,000 demo account with 50:1 Leverage. I wanted to see what would happen to my Margin Level and Free Margin if I open as many trades as possible. The initial Margin Level was around 1200%. With each new open trade, the initial (1200%) Margin Level got divided by the number of open trades. So for instance with one open trade, the Margin Level was around 1200%. A second trade brought the Margin Level down to around 600%. The third one brought it down to around 400% and so on and so forth. I could only open 12 trades before the Margin Level reached around 100% and Free Margin was around 30 or 40.

So now My question is: Assuming all these 12 open trades are profitable at the moment and protected by ALREADY ACTIVATED Trailing Stop, what would happen in case of a Black Swan Event? For instance a huge gap, that opens on the wrong side of all those 12 trades (the trades which were initially winning trades had it not been for the Black Swan Event)? Does that mean the account is blown? Because remember, the Free Margin got around 30 to 40 with those 12 open positions.

And if the answer is yes, then what measures can one take for a $1,000 account with 50:1 Leverage to not get to that point? I know one answer is to NOT have 12 open trades simultaneously. But what if adding new winning trades is part of the strategy? I'm a little confused.

You can place limit orders rather than market orders, but the trade-off is that then you run the risk of the trade not getting executed at all. You get to control the price, but you may not have any takers. You can do a stop-limit, where at a certain market price, you do an offer of a different price farther in that direction, e.g., you buy at $100, you get to $110, you set a stop limit order with the stop at $105 and the limit at $104. Hopefully, as the price blasts past $105, you get a taker at $104. Still not guaranteed, but much better chance than trying to do a limit order at $105 when the market hits $105. You have the advantage of knowing exactly what your loss will be, if the trade goes through, but it's still possible the trade won't go through.

In your scenario, if they all go into loss, you could easily blow the account, if the slippage makes the loss exceed what you planned for in your position sizing. At 50:1 leverage, that slippage is effectively magnified 50x. You're basically trading a $50K account, but with only $1K — 2% of that $50K, available to lose.

The fact that it's 12 trades doesn't really matter — it would be the same issue if you opened one big trade of that same size. The thing with the multiple positions is that if you move up the trailing stop on the early entries, and you're stacking more trades on top, you might not lose as much on some of the trades as initially planned, or some might actually be in profit to offset some of the losses.

That said, yeah, 12 trades at a time on a $1K account is tough, especially on one instrument/strategy. If you filter through all the various advice on growing a small account, the consensus recommendation is generally to trade only the very best setups — high probability, high risk/reward, able to set a very tight stop loss. Multiple trade strategies — Martingale, stacking, hedging, etc. — generally need more capital, and more margin leeway for unexpected drawdowns.

Reason: