Indicator X-Axis Offsets – Bollinger Bands® Long Entry on Breakout Above Upper Band (With X-Axis Offset) (Point-and-Click NinjaTrader® Strategy)
Original Trading Strategy
Peer Reviews, Modifications & Responses
Thanks for Sharing!
Trading Strategy Summary
This trend following strategy goes long when the close price crosses above the upper band of a Bollinger Bands® indicator that is offset along the X-Axis by a number of bars specified by the “X-Axis Offset” input parameter while the close price is going up and exits when the close price crosses below the middle band of a Bollinger Bands® indicator that is offset along the X-Axis by a number of bars specified by the “X-Axis Offset” input parameter.
This strategy is a modification of the strategy called “Bollinger Bands® Long Entry on Breakout Above Upper Band”, which is built into Quagensia N Edition and can be opened from the “Algos from Quagensia > Strategies > Strategies for New Users” folder of the Algo Explorer on the left side of Quagensia N Edition’s main window and whose “Strategy Home Page” is at https://www.quagensia.com/trading-idea/bollinger-bands-long-entry-on-breakout-above-upper-band-n.
The main purpose of this strategy is to demonstrate how to offset an indicator or a plot of a multi-plot indicator (such as the Upper Band of the Bollinger Bands® indicator) by a number of bars to the right along the X-Axis, which is also the time axis, so that the value and plot of the indicator or plot of a multi-plot indicator is “old information” from the specified number of bars ago.
This strategy uses Editable Time Series to hold the values of the plots of a Bollinger Bands® indicator but with the X-Axis offset. These Editable Time Series are only used to hold the time-shifted plots and are not plotted.
Instead of plotting the Editable Time Series that hold the data of the time-shifted plots directly, 1-period Simple Moving Average (SMA) indicators that use the Editable Time Series as their time series input parameters are plotted.
This works because mathematically the 1-period Simple Moving Average (SMA) of a time series is the same value as the time series itself. (Note that the values differ by a tiny amount due to the way that computers do mathematical operations on “double-precision floating point numbers”, which are called “Decimal Numbers” in Quagensia N Edition, but the two values are equal to many significant figures).
While we could have plotted the Editable Time Series instead of plotting 1-period simple moving averages of the Editable Time Series, the Simple Moving Average (SMA) indicator built into NinjaTrader® can be plotted on chart panels other than the main chart panel, which is something that cannot be done with Editable Time Series directly. Therefore this technique was used not to improve this strategy but to provide the trading logic that you can use in your own strategies whose plots need to be calculated and stored in an Editable Time Series while at the same time need to be plotted on a panel other than the main chart panel.
To see another example of how to use the relative strengths of Editable Time Series and Simple Moving Average (SMA) indicators, take a look at the strategy called “Plotting and Using the Values of Moving Averages Based on Secondary Price Bars”, which is built into Quagensia N Edition and can be opened from the “Algos from Quagensia > Strategies > Strategies for Intermediate Users” folder of the Algo Explorer on the left side of Quagensia N Edition’s main window and whose “Strategy Home Page” is at https://www.quagensia.com/trading-idea/plotting-and-using-the-values-of-moving-averages-based-on-secondary-price-bars-n.
Copyright © 2024 Quagensia, Inc. All rights reserved.
How to Get the Quagensia Strategies
This point-and-click trading strategy is built into Quagensia N Edition (for NinjaTrader®).
Customize Quagensia Strategies with Your Own Ideas
Tweaking Quagensia Trading Strategies using point-and-click with the Quagensia Desktop Application is easy for non-programmers. If you get stuck you can usually find the answer you need in our online help documentation or you can ask a question in our friendly Discord community.
If you don’t want to tweak a Quagensia Trading Strategy with point-and-click to add your own proprietary trading logic, you can still download a Quagensia Trading Strategy file, open it up in the Quagensia Desktop Application, and generate its code, then backtest and optimize the trading strategy on different instruments, different bar periods (weekly bars, daily bars, hourly bars, 15-minute bars, etc.), or different bar types (time-based bars, volume-based bars, tick-based bars, etc.), and use different start and end dates.
Some tweaks you can make to the Quagensia Trading Strategies you download include:
Modify the entry & exit logic.
- Add more conditions, remove conditions, or change them by choosing from among a very large number of components, including many exotic indicators.
- Add or modify stop losses, trailing stops, and profit targets. Make them tighter, less tight, or based on an entirely different calculation.
- Add or modify time stops. For example, exit after a certain number of bars either unconditionally or only if the post-entry price action did or did not exhibit certain characteristics.
Enhance the output of the strategy to go beyond simply placing orders.
- Draw lines, shapes, and text on the chart. For instance, you can mark times or prices where each entry or exit condition of a multi-condition entry or exit was true, even if all the necessary entry or exit conditions were not true at the same time so an entry or exit did not occur.
- Write information to NinjaTrader®’s NinjaScript® Output window or TradeStation®’s EasyLanguage® Print Log window.
- Write information to a file. You can even output a report that can be opened in Microsoft Excel or consumed by another application that reads comma-delimited, semicolon-delimited, or otherwise character-delimited tabular data files.


