• Overview
  • Reviews (1)
  • Comments (8)
  • What's new


This Export Advisor implements the trailing stop algorithm "Trailing Stop with Inside Bars" that was suggested by the famous German trader and author Michael Voigt ("Das grosse Buch der Markttechnik") to capture robust gains when trading strong price moves.

It is used for semiautomatic trading. You open a position manually and apply the expert to the chart. It modifies your order by setting a stop loss according to the trailing stop algorithm.

  • Your trade direction (Long/Short) is detected automatically.
  • The expert removes itself after being stopped out.
  • You can specify the initial stop bar by setting the "numberOfStopBars" input parameter.
  • You can set the threshold value added to lows/highs of bars for using input parameter "delta".
  • The current value for the stop value is indicated as a blue line and logged to the terminal.
  • Add-On: Separate indicator that shows the progress of the stop value as a red line available for free in the market.

This is an exact implementation of the algorithm described in "Das grosse Buch der Markttechnik".

The Stop-loss value is adjusted as soon as a candle has closed, beginning with the bar after the Start Bar (second bar close):

  • as soon as a new Outside Bar occurs the stop is moved to it's High/Low (+ or - delta).
  • as soon as an Inside Bar occurs the stop is relaxed to the High/Low (+ or - delta) of the predecessor of the Outside Bar (or kept at the Outside Bar, if it has a lower Low/higher High than the predecessor).
  • when a candle closes below the Low of the current Outside Bar (LONG) the stop is set to that close value (-delta), vice versa for SHORT.

Bar for the initial stop (Input parameter "numberOfStopBars")

InsideBarStop allows to set the candle that defines the initial stop using the input parameter "numberOfStopBars". This offers full flexibility and is the only real extension of the algorithm suggested by Voigt.

Value 0 (start bar of the algorithm), 1 (bar preceding the start bar), and so on.

Threshold buffer (Input parameter"delta")

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.

Tip: The indicator "InsideBarStop Indicator" is available for free here in the market. You can use it in conjunction with the expert. It shows the progress of the trailing stop value as a red line.

Detailed information concerning the algorithm is available in the product description of the indicator InsideBarStop Indicator.

The first screenshot below shows the indicator in action. The second one shows the expert displaying the current Stop-Loss as a blue line above the corresponding candle.

martinkurz 2016.10.16 14:52 

Funktioniert zuverlässig und schnell im MT4. Hält, was er verspricht. Ist der EA aktiv werden auf bestehende Trades oder Trades, die nach dem Start vom EA eröffnet wurden angewandt. Nur eines irritiert: wird im aktuellen Fenster mit dem EA ein anderes Zeitintervall ausgewählt wird sofort der Stop angepasst. Das kann man umgehen, wenn man ein 2. Fenster öffnet, wo der EA nicht läuft. Dies irritiert aber zunächst. Mein Wunsch: dieses Feature sollte in den Einstellungen ein- und ausgeschaltet werden können.

Version 1.3 2018.11.15
Version 1.3 now supports Pending Orders and Multiple Orders

Up to version 1.2 InsideBarStop expects exactly one active order(open position) for the given market symbol at the moment you apply InsideBarStop to a chart.
Otherwise it simply cannot determine which of the orders it has to manage for You.

Version 1.3 now in general waits for the first distinct active order.

Scenario 1 - Pending Orders:
You enter one or more pending orders (stop buy/stop sell/limit buy/limit sell) for the EUR/USD into the system.
You apply InsideBarStop to the EUR/USD chart. It waits for an order.
As soon the first pending order is triggered and gets activated InsideBarStop will take it and manage the position for you.
It trails the Stop Loss for only that position. After the position is stopped out InsideBarStop has done.

Scenario 2 - Multiple Orders:
You have an arbitrary EA running on the EUR/USD. The EA has opened a long position. There is one active buy order in the system for that market.
You open a trade manually a want InsideBarStop to manage the position. The order number of your trade is 123456.
Your apply InsideBarStop, setting its input parameter "orderNumber" to 123456.
InsideBarStop will only manage order 123456, leaving all third party orders alone and therefore will not interfere with your running EA.
Default value for "ordernumber" is -1 (means any order).
Version 1.2 2016.10.17
Minor improvements:
Error messages/alerts