Comment on page
The installation of the Technical Analysis Package is required in order to access this indicator.
InsideBarsMT displays inside bars as defined by Michael Voigt in his book. The settings can be modified, and additional adjustments are also possible. Furthermore, there are several data series used in stop calculations for self-developed indicators and strategies.
Inside bars are bars whose body (open-close) are located within the high-low span of the previous bar. The previous bar is generally called an outside bar. Inside bars will sometimes reflect sideways phases, and will also display trend corrections of lower timeframes. When trading inside bars, the stop is placed at the high or low of the previous period. If the high or low of the previous candle is unsuitable, then the high or low of an older candle is used.
- InsideBarsMT().isInsideBar[int barsAgo]
Will return “true” if the referenced bar is an inside bar, otherwise “false”
- InsideBarsMT().isOutsideBar[int barsAgo]
Will return “true” if the previous bar is an outside bar
- InsideBarsMT().HighBeforeOutsideBar[int barsAgo]
Will output the high of the bar preceding the outside bar
- InsideBarsMT().LowBeforeOutsideBar[int barsAgo]
Will return the low of the bar preceding the outside bar
In the image below you will see a longer “phase” where the market is within an inside bar. The bar marked with the arrow opens the low of the outside bar. If the open of the green candle had been a tick lower, then the marked bar would not be an inside bar and the red bar would clearly not be an outside bar. The tolerance parameter defines the number of ticks by which the inside bars may “breach” the high-low span of the outside bar and still be recognized as an inside bar.
Tolerance default setting = 0.
protected override void OnCalculate()
// Open position when SMAs cross
if (CrossAbove(SMA(10),SMA(20),1) && Position.PositionType == PositionType.Flat)
// If the current bar is an inside bar, modify the stop
StopPrice = InsideBarsMT().LowBeforeOutsideBar;
// Use different stop method