This indicator can be used to show and evaluate the trailing stop algorithm "Trailing Stop with Inside Bars" that was proposed by the famous German trader and author Michael Voigt ("Das grosse Buch der Markttechnik") to capture robust gains when trading strong price moves.
- The trailing stop price is shown as a red line.
- You can start the trailing stop anywhere on your chart (bars or candles) by setting the "initialBarDateTime" input parameter to the open time of an arbitrary candle
- You can specify the direction of the trade by setting the "isLong" input parameter to true (Long) or false (Short)
- You can specify the initial stop bar by setting the "numberOfStopBars" input parameter to 0 (start bar),1 (previous bar of the start bar),2,....
The algorithm is used on candlestick or bar charts providing Open, Close, High, Low data for each candlestick or bar.
- An "Outside Bar" occurs when a bar closes above the High of the previous bar (for LONG trades, vice versa for SHORTS).
- An "Inside Bar" occurs when a bar closes below the High of the previous bar and above the Low of the previous bar, inside the range of the previous Outside Bar (for LONG trades, vice versa for SHORTS).
The idea is to relax the trailing stop price as soon as an InsideBar occurs and momentum slows down. You give a subordinated trend the chance to correct in price without being stopped out. In comparison to traditional trailing stop where you put the stop below/above the previous candle this method generates incredible results.
Stop values are adjusted as soon as a bar has closed, beginning with the bar after the Start Bar (Open of the third bar).
As soon as a bar is complete the system determines whether it is a new Outside Bar. If that is the case the trailing stop is set to the Low of that bar. If it is an Inside Bar the stop is set to the Low of the bar preceding the current Outside Bar (or keeps the stop at the Low of the Outside Bar if it is below the Low of its preceding bar).
A long position is closed as soon as the current price falls below the stop value or a bar closes below the Low of the current Outside Bar although the stop is not triggered.
As soon as a bar is complete the system determines whether it is a new Outside Bar. If that is the case the trailing stop is set to the High of that bar. If it is an Inside Bar the stop is set to the High of the bar preceding the current Outside Bar (or keeps the stop at the High of the Outside Bar if it is above the High of the preceding bar).
A short position is closed as soon as the current price rises above the stop value or a bar closes above the current Outside Bar although the stop is not triggered.
As M. Voigt suggests the trailing stop algorithm uses a fix "delta" value (Input Parameter) that is added to or subtracted from the High and Low values of the bars to determine stop levels and Outside/Inside Bars.
Example: You are using the InsideBarStop in Long direction on the US SPX 500 index and set the Input Parameter "delta" to the value "2.0". The trailing stop values will be set 2 points below the Lows of the bars. A new Outside Bar will be detected only if a bar closes more that 2 points above the High of the current Outside Bar.
This mechanism is used to reduce the impact of market noise and prevents from being stopped out by slightly new highs or lows.
InsideBarStop allows high flexibility by letting you set the bar for the initial stop relative to the initial bar. The initial bar is the current bar when starting the expert or indicator. Depending on the actual chart pattern you can set the bar that defines the initial stop by its Low (LONG) or High (SHORT). Voigt suggests to use the minimum of the Low of the initial bar and the Low of the previous bar as initial stop for LONGS and the maximum of the High of the initial bar and the High of the previous bar for SHORTS.
In contrast to that InsideBarStop lets you set the distinct High or Low of any distinct bar preceding the initial bar.
For more details please refer to "Das große Buch der Markttechnik".
Below is an example of the indicator in action. Here in the market the expert advisor InsideBarStop for semiautomatic trading is available. It manages your manually opened positions according to the algorithm described above.