forex software

Create and Test Forex Strategies

forex software

Skip to forum content

Forex Forum

Forex Software, Forex Strategies, Expert Advisors Generator

You are not logged in. Please login or register.


[ Closed ]

Forex Forum → Technical Matters → Trailing Stop Loss

Pages 1

You must login or register to post a reply

RSS topic feed

Posts: 8

1 (edited by Minch 2020-06-10 22:05:31)

Topic: Trailing Stop Loss

Hello,

I think there is a bug in creating a trailing stop loss.

I set up a portfolio of 100 strategies each with a TSL of 50. When the trades have executed on MT4, the TSL of 50 does not show and there is instead of SL of 50. There is a separate space in the Oanda app for SL and TSL and the TSL value remains empty when the trade is created through the portfolio. I closed the trades manually to check these on my account history and the column which reports the TSL is also empty; what should be the TSL value is going into the SL column and you can see this from the attached screenprints.

As a second test, I took 20 strategies from the portfolio and placed these into the demo account but individual strategies (I verified again these were set up in EA with TSL) ... Its the same problem - the TSL has been translated into an SL.

Note: if I manually change the SL into a TSL in the Oanda app, it stays as a TSL, meaning there is definitely a difference between the two types of stop loss. I am not a coder but I suspect that TSL are not being sent to MT4 correctly as trailing; the fact they are showing up is good BUT they are not showing up in the right way.

This issue is really key for my risk management to have TSL and not SL, especially when there is no functionality to manage risk as a ratio of ATR.

Please can someone take a look urgently at this - thank you.

Update: The issue with the different stop loss amounts mentioned in the middle of the attached is resolved; Oanda updates it to show how far you are from that point, but it still doesnt resolve the TSL problem. Thanks.

Post's attachments

Trailing Stop Loss Issue.pdf 637.5 kb, 5 downloads since 2020-06-10 

You don't have the permssions to download the attachments of this post.

Re: Trailing Stop Loss

Hi Minch,

I think EA Studio moves trailing stop at a new bar, you can try to compare every tick and open price backtest result to see if trailing stop works or not

do or do not there is no try

Re: Trailing Stop Loss

The MT experts cannot set Trailing Stop Loss.
EA Studio sets a Stop Loss for the position at the same distance as the Trailing Stop Loss used in the application.
The EA moves the SL ta a new bar if the price makes a new High or Low.

Re: Trailing Stop Loss

I searched the old posts and found this
https://forexsb.com/forum/post/49219/#p49219

do or do not there is no try

Re: Trailing Stop Loss

Thank you Yonkuro, that's interesting.

6 (edited by Minch 2020-06-11 14:37:24)

Re: Trailing Stop Loss

Hi Popov,

Thanks for your explanation. In summary, for EA Studio :

- If I set a fixed SL, that stop loss does not move. It is set (e.g.) to 50 pips above or below the entry price and gets hit when the price reaches that, it is not dynamic at all.

- If I set a TSL then this is changed at the next bar depending on the direction of the price. So, for a long trade, if the price goes up at the next bar (e.g. 1 Hour later if I am on the the 1H chart) then the TSL will go up as well such that it is 50 pips below the current new price.

You then go on to say that "The MT experts cannot set Trailing Stop Loss".

Couple of issues I would appreciate your feedback on:

1. If you cannot set a TSL on an MT expert, what is the point in having this function in EA Studio? You run the risk of getting equity curves (based on a TSL strategy) which you will not be able to reproduce in MT. If we cannot translate the TSL into a real strategy, can the TSL option be removed from the strategy screen because it's misleading.

2. Refer to the link provided from Yonkuro, above. You previously said that "the Trailing Stop Loss works on all kind of experts created by EA Studio - MQL4, MQL5, Portfolio Expert... The Trailing Stop trails ones per bar at a new High or Low. This is valid for EA Studio, the MT Tester and the live trading." - from the post it seemed this was a new functionality in EA Studio - has this now been removed?

3. There is a TSL option in MT4, if you right click on the chart you have the option to add one. I found some additional info on TSL in MT4

https://www.youtube.com/watch?v=TsvEt7JRwkA

https://www.mql5.com/en/articles/1363

https://www.mql5.com/en/forum/173670)

https://smartforexlearning.com/mt4-ea-course-trailing-stops/#:~:text=A%20trailing%20stop%20is%20a,stop%20loss%20will%20move%20along.

I am certainly not a coder and I dont have the knowledge to make a case at a technical level but the above info seems to suggest that TSL in EA/MT4 should be possible, so I dont really follow your reply. If anything, there may not be a "trailing stop" function already existing in MQL but it looks to me that it can be defined and then used like a standard function (and you alluded to this functionality in the post you wrote in 2018)

The reason I would like to clarify this so keenly is because Risk Management has to be a big part of the trading approach. We currently cannot set Stop Loss at ATR levels, which would make the risk management more dynamic; but not having this ATR functionality could be mitigated by having a TSL. Without both, the Stop Loss functionality remains basic and the only other way around this would be to have the strategy set a fixed stop loss and then the trader manually changes this at broker level, which is a bit of a pain. This approach additionally defeats the point of an "automated" strategy and, depending how often you want to check the trades, means that 1M, 15M, 1H charts are not going to work - 1D trading would be the only option, for me.

Thank you for your advice,
Matthew

Post's attachments

tight_trailing_stops.mq4 4.71 kb, 3 downloads since 2020-06-11 

You don't have the permssions to download the attachments of this post.

Re: Trailing Stop Loss

1. If you cannot set a TSL on an MT expert, what is the point in having this function in EA Studio?

The point is that the Trailing Stop Loss is a popular feature and may be useful.

We simulate the exact behaviour in the exported Expert Advisors like in the EA Studio backtest. The only "problem" is cosmetic. You see "SL" in MT instead of "TSL". We actually use SL but we trailed it programmatically because it is not possible to set it via MQL.

> 3. There is a TSL option in MT4,

MT does allow you to set Trailing Stop but only manually.

If you think it is supported by MQL, please post a link to the particular article in the MQL guide: https://docs.mql4.com/

Re: Trailing Stop Loss

Matthew, please don't lose your and our time.

The expert you attached work in the exact way our experts work. It set SL and modifies it when needed.

Please see line 34

               if(TrailingStep > 8){
                  ModifyStopLoss(TrailPrice);
               }

Posts: 8

Pages 1

You must login or register to post a reply

Forex Forum → Technical Matters → Trailing Stop Loss

Similar topics in this forum