The EA implements the trailing cease with Inside Bars plan, which was first suggested by the famous German dealer and writer Michael Voigt (Das Grosse Buch der Markttechnik). The algorithm is designed to capture profits in case of strong price movements.
The EA is designed for semi automatic trading. You need to open a position manually and operate this expert Advisor on the graph. The EA modifies the arrangement by placing a stop loss in accordance with the trailing algorithm.
- The trading direction of your transaction (extended/short) is decided mechanically.
- After stopping, the EA itself is removed from the chart.
- You can specify the initial stop bar in the “numberOfStopBars” parameter.
- It is also possible to specify a threshold value added to the maximum / minimum using the “delta” parameter.
- The current stop level value is displayed as a blue line and recorded in the terminal log.
- Add-On: a free indicator that displays the process of changing the stop in the form of a red line is available for download in the Market.
The EA implements exactly the algorithm described in the book “Das grosse Buch der Markttechnik”.
Modification of the stop loss occurs after the candle closes, the modification begins with the bar following the initial one (after the second bar closes):
[spoiler title=”Read More…”]
- when a new external bar appears, the stop level moves to its maximum/minimum ( or-delta).
- when an inner bar appears, the stop level remains at the maximum / minimum ( or-delta) of the bar preceding the outer bar (or at the extremes of the outer bar if it has a higher maximum or lower minimum than the previous bar).
- when the candle closes below the minimum of the current external bar (for long positions), the stop level is set at this closing level (- delta), or Vice versa for short positions.
Bar for the initial stop (input parameter ” numberOfStopBars”)
The insidebarstop expert Advisor allows you to specify the candle for which the initial stop will be determined in the “numberOfStopBars” parameter. This provides complete flexibility and is the only addition to the algorithm proposed by Voigt.
Valid values: 0 (the starting bar of the algorithm), 1 (the bar preceding the starting bar) , etc.
Threshold buffer (“delta” Parameter”)
According to M. Voigt, the trailing stop algorithm uses a fixed value “delta” (input parameter), which is added or subtracted from the maximum and minimum of the bar to determine the stop levels and external / internal bars.
For example: the insidebarstop expert Advisor is launched for a long trade on the US SPX 500 index, the “delta” parameter is set to “2.0”. In this case, the trailing stop value will be set to 2 points below the bar minimum. If the next bar closes 2 points above the maximum of the current external bar, it will be recognized as a new external bar.
This mechanism allows you to reduce the impact of market noise and prevent the closing of highs/lows that are not very different from the previous ones.
The first screenshot shows the operation of the indicator. The second one shows the expert Advisor and the current stop loss in the form of a blue line above the corresponding candle.