Have other people had the same problems with trailing stop losses on short time frames (1 second) as I have? When you write a strategy, the strategy cannot ‘see’ the previous level of a stop loss, so instead it reassesses the stop every second. This wouldn’t be a problem, except for the fact that when a new stop loss is placed each second, it is subject to IG’s minimum stop loss threshold. This results in the stop loss being repeatedly pushed back in the opposite direction, thus defeating the whole objective of a trailing stop loss. I completely understand about IG’s minimum, however the previous stop level isn’t being honoured after it’s started trailing. I did put in a technical support request to IG several weeks ago.
I was wondering if I could get round this by rewriting the stop loss conditions as ‘exit conditions’.
Originaly, for long trades (mirror logic for short trades) my trailing stop was to follow the LOWEST of the following which could change throughout the trade:
The SMA 89
The SMA55
The SMA 21
The highest level of the lower Bollinger Band for the lifetime of the trade.
Here’s the code for the trailing stop (below). Does anyone know how I can rewite this code below as an ‘exit condition’? The highest level of each line would have to be ‘remembered’ in the code for the lifetime of the trade in order to trigger the exit. Many thanks in advance.
A Trailing System which uses a native TF of 1 second, can not exist; there would be no headroom to trail. Think about this carefully and you will give up on it right away.
The solution is using a somewhat larger TF (could be 3 seconds) for the trailing commands (Pending orders !), while using an underlaying 1 second system to apply the other things you want the “speed” for. In functional terms : set the TF of the chart to 1 second as you are used to, but use the TimeFrame command to set an e.g. 3 second TF around that.
This is somewhat more difficult to explain, but if you make a base like this for it, you will automatically start to understand.
In practice you will see that 3 seconds is still not giving you much headroom to trail down, though technically it can work. In other words, you can just as well use 5 seconds or 10 seconds or anything, as long as you re-optimize all.
Think in terms of : the more headroom I give my system to trail down but also to recover from that “dip”, the longer the trailing can last and the more your trade can earn. All to some degree of course and all in the “balance” you foresee or backtest.
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.