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

 
Let's say you set a 300-point Trailing Stop for your long position and the price reaches 300 points above your long position which activates the Trailing Stop order. The problem is, the Trailing Stop activates at ZERO point. Meaning, if for some reason the market doesn't go above 300 points, and instead comes down to your initial long level, your trade closes at zero with 0.00 profit, instead of profiting 300 points.

In other words, when a Trailing Stop is set for a trade, it only activates at the initial trading level and it goes up from there. What if I wanted the Trailing Stop to activate at the 300-point profit mark instead, and not at the ZERO level (the initial trading level)?

Is coding this difficult? Also, can it be done automatically? So for instance, you open a buy position, and the EA or the script automatically sets the Trailing Stop (at for example 300 points), and then if the market goes up 300 points, the Trailing Stop activates at the current market level (which is 300 points above your initial long level) or a little below it (280 points above your long level). This way if the market reverses, you at least profit 280 points, instead of zero profit.
 

There are many "Trailing Stop" solutions (with various options), available in the CodeBase section and also available in the Market place, both free and paid options.

Please following the two links I provided in the previous sentence and do some research on your own, because recommendations or suggestions for products are not allowed on the forum.

EDIT: And if nothing is to your satisfaction, then you can always code your own or hire a programmer in the Freelance section to do it for you.

 
I searched the CodeBase but I couldn't really find what I was looking for. I don't know exactly what to do.
 
hello.new #: I searched the CodeBase but I couldn't really find what I was looking for. I don't know exactly what to do.
  • Usually people who can't code don't receive free help on this forum.
  • If you show your attempts and describe your problem clearly, you will most probably receive an answer from the community. Use the CODE button (Alt-S) when inserting code.
  • To learn MQL programming, you can research the many available Articles on the subject, or examples in the Codebase, as well as reference the online Documentation.
  • If you do not want to learn to code, that is not a problem. You can either look at the Codebase if something free already exists, or in the Market for paid products (also sometimes free). However, recommendations or suggestions for Market products are not allowed on the forum, so you will have to do your own research.
  • Finally, you also have the option to hire a programmer in the Freelance section.
 
Fernando Carreiro #:
  • Usually people who can't code don't receive free help on this forum.
  • If you show your attempts and describe your problem clearly, you will most probably receive an answer from the community. Use the CODE button (Alt-S) when inserting code.
  • To learn MQL programming, you can research the many available Articles on the subject, or examples in the Codebase, as well as reference the online Documentation.
  • If you do not want to learn to code, that is not a problem. You can either look at the Codebase if something free already exists, or in the Market for paid products (also sometimes free). However, recommendations or suggestions for Market products are not allowed on the forum, so you will have to do your own research.
  • Finally, you also have the option to hire a programmer in the Freelance section.
Yes, sure, I'm not necessarily looking for an EA/script recommendation. I'm mostly trying to find a workaround. Should I delete the original post and post it in CodeBase instead?
 
hello.new #: Yes, sure, I'm not necessarily looking for an EA/script recommendation. I'm mostly trying to find a workaround. Should I delete the original post and post it in CodeBase instead?

There is no "work-around". You have to code a MQL program to do it the way you want.

The CodeBase is for publishing your own code contributions, not for posting coding requests.

If you wish to hire someone to code it for you, do it in the Freelance section.

Trading applications for MetaTrader 5 to order
Trading applications for MetaTrader 5 to order
  • 2023.10.25
  • www.mql5.com
The largest freelance service with MQL5 application developers
 
hello.new: Let's say you set a 300-point Trailing Stop for your long position and the price reaches 300 points above your long position which activates the Trailing Stop order. The problem is, the Trailing Stop activates at ZERO point. Meaning, if for some reason the market doesn't go above 300 points, and instead comes down to your initial long level, your trade closes at zero with 0.00 profit, instead of profiting 300 points.

Exactly. If you want to “profiting 300 point” then set the take profit (TP) to that level.

 
William Roeder #:

Exactly. If you want to “profiting 300 point” then set the take profit (TP) to that level.

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. Does that make sense now?
 
Fernando Carreiro #:

There is no "work-around". You have to code a MQL program to do it the way you want.

The CodeBase is for publishing your own code contributions, not for posting coding requests.

If you wish to hire someone to code it for you, do it in the Freelance section.

Yes sir, understood.
 
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. Does that make sense now?

It's made sense since the beginning, but unfortunately that is not how trading works.

You certainly free to try program such a trailing-stop, but you may find that it's not always possible nor practical to achieve it exactly as you perceive it.

For one, if the broker has a stops-level or freeze-level in play, you will not be able to place the trailing-stop so close. You would have to implement a virtual trailing-stop in that case.

Also, the price may just suffer a slight negative slippage and the position will immediately close, so you will need to have a little bit of a "buffer" room for price to deviate.

For it to work as you envision it, price will need to have a very strong momentum at the moment you set the trailing-stop equal to the target price, so that there is no negative slippage at all at the time.

In any case, since it seems you don't know how to code it yourself, you will have to hire someone to do it for you, but please understand that it may not be possible to achieve 100% what you want.

 
Fernando Carreiro #:

It's made sense since the beginning, but unfortunately that is not how trading works.

You certainly free to try program such a trailing-stop, but you may find that it's not always possible nor practical to achieve it exactly as you perceive it.

For one, if the broker has a stops-level or freeze-level in play, you will not be able to place the trailing-stop so close. You would have to implement a virtual trailing-stop in that case.

Also, the price may just suffer a slight negative slippage and the position will immediately close, so you will need to have a little bit of a "buffer" room for price to deviate.

For it to work as you envision it, price will need to have a very strong momentum at the moment you set the trailing-stop equal to the target price, so that there is no negative slippage at all at the time.

In any case, since it seems you don't know how to code it yourself, you will have to hire someone to do it for you, but please understand that it may not be possible to achieve 100% what you want.

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.

Reason: