Turn Indicator Entry Filters On and Off and Don’t Plot Off Indicators (Point-and-Click NinjaTrader® Strategy)
Original Trading Strategy
Peer Reviews, Modifications & Responses
Thanks for Sharing!
Trading Strategy Summary
This strategy demonstrates how to add “toggleable” indicator-based entry filters to your trading strategy’s entry criteria and demonstrates how to toggle indicator visibility based on your strategy’s input parameters as well.
A toggleable entry filter is one that can be turned on or off from the NinjaTrader® user interface by setting input parameters to specific values that turn the toggleable entry filter on or off.
The conditions that turn a toggleable entry filter on or off and that toggle indicator visibility can be based on something as simple as whether or not a single “Boolean (True or False)” input parameter is set to True or False due to a checkbox being checked or unchecked in the NinjaTrader® user interface as is demonstrated in this strategy. The entry filter toggle conditions can be complex as well, and use ANDs, ORs, and parentheses, but this is not demonstrated in this strategy.
One great thing about using “Boolean (True or False)” input parameters for toggle conditions is that NinjaTrader® allows optimizations over “Boolean (True or False)” input parameters, so you can optimize strategies with toggleable conditions like this one using every combination of on and off for each indicator-based filter’s toggle condition. Since this strategy has four toggleable conditions, this creates 2^4 = 16 possible combinations of on and off filter toggle conditions. You can also optimize over this strategy’s numeric input parameters such as moving average lengths as well.
In this strategy, when a toggleable entry filter’s checkbox is unchecked in the NinjaTrader® user interface it will not be used as one of the entry conditions that are required to be True in order to enter a position and the indicator used by the toggleable entry filter will not be plotted on the chart upon which the strategy is applied. When its checkbox is checked the entry filter will be used as one of this strategy’s required entry conditions and the indicator used by the toggleable entry filter will be plotted on the chart.
The way that each entry filter was turned into a “toggleable entry filter” can be seen in this strategy’s “When Bar Updates” section. Note how each toggleable entry filter is “ORed” together with its specific toggle condition that turns it on or off and that these two conditions are inside of paretheses so that they are determined to be True or False as a group. The condition above each OR checks if the entry filter’s toggle is on or off. If the entry filter’s toggle condition is off then the ORed conditions in the parentheses are evaluated as True regardless of whether the specific indicator-based entry filter is True or False on that bar, tick, or price change and won’t filter out entry signals on that bar, tick, or price change. If the entry filter’s toggle condition is on then the specific indicator-based entry filter must be True for the ORed conditions in the parentheses to be evaluated as True for the entry signal to not be filtered out on that bar, tick, or price change.
The way that the indicators are plotted or not plotted based on if their respective entry filter toggles are turned on or off is by creating a condition in the plotting settings for that indicator’s internal variable that must be True for the indicator to be plotted. You can use this technique to conditionally plot indicators, Editable Time Series, and horizontal lines that you define as internal variables in your own strategy’s internal variables section by checking the “Plot This” checkbox of the internal variable, clicking the link that reads something like “Set Conditions That If False Will Cause Plot to Not Be Plotted” and then building a condition or set of conditions in the field that appears.
Note that while this strategy uses toggleable entry filters, you can create “toggleable exit filters” using the same approach.
This strategy also demonstrates how to group input parameters together under separate headings in the NinjaTrader® user interface by using the same value in the “Category” field of each related input parameter that should go under a specific heading. The “Category” field of a Quagensia N Edition Strategy’s input parameter is hidden by default but can be shown and filled out by clicking the “Advanced Fields” link of the input parameter. This link was already clicked for all of the input parameters of this strategy which is why the “Category” fields of all the input parameters of this strategy are visible.
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.


