Reversible Volatility-Based Entry Filters: Standard Deviation Must be Above (or Below) a Threshold (Point-and-Click TradeStation® 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 while the close price is going up and one of the following two volatility-based entry filters are true:
- The standard deviation of the close price is greater than or equal to the threshold specified in the “Std Dev Threshold to Enter Trade” input parameter and the “Enter If Std Dev Is Below, Not Above, Threshold” input parameter is set to False.
- The standard deviation of the close price is less than or equal to the threshold specified in the “Std Dev Threshold to Enter Trade” input parameter and the “Enter If Std Dev Is Below, Not Above, Threshold” input parameter is set to True.
This strategy exits when the close price crosses below the middle band of a Bollinger Bands® indicator.
The Main Purpose of This Tutorial Strategy
The main purpose of this tutorial strategy is to demonstrate how to create an entry filter that only considers entry trades if a numerical value (in this case the standard deviation of the close price) is either 1) greater than or equal to a numerical threshold that is passed as an input parameter when another Boolean (True or False) input parameter is set to False in the TradeStation® user interface, or 2) less than or equal to a numerical threshold input parameter when the Boolean (True or False) input parameter is set to True in the TradeStation® user interface.
This technique is a lot like the “toggleable entry filter” technique demonstrated in the “Turn Indicator Entry Filters On and Off and Don’t Plot Off Indicators” strategy that is built into Quagensia T Edition and that can be opened from the “Algos from Quagensia > Strategies > Strategies for New Users” folder of the Algo Explorer on the left side of Quagensia T Edition’s main window and whose Strategy Home Page is https://www.quagensia.com/trading-idea/turn-indicator-filters-on-and-off-and-dont-plot-off-indicators-t. In that strategy, an input parameter allows a condition to be turned on and off based on whether a Boolean (True or False) input parameter is set to True or False. This strategy’s toggling technique is different however in that the entry filter is always “turned on” and the “toggling” toggles the numerical comparison from “Is Less Than or Equal To” to “Is Greater Than or Equal To”.
This technique allows a trader to create a strategy that for instance filters out entry trades based on whether or not a volatility metric like standard deviation of the close is above or below a threshold but where the trader wants the flexibility to not just change the numerical volatility threshold but also to be able to filter out higher volatility entries or lower volatility entries based on whether an input parameter’s check box is checked or unchecked.
Other Techniques Demonstrated in This Strategy
- Users can change the color, plot style, and line width of the Upper and Lower Bollinger Bands® indicator plots by changing the value of input parameters in the TradeStation® user interface. This is made possible because Quagensia T Edition supports color and drop-down list input parameters (as well as color and drop-down list internal variables, but these are not used in this strategy). Note that the other Bollinger Bands® indicator plot used by this strategy, the Bollinger Bands® indicator’s Middle Band, shows how to style an indicator plot with “hard-coded values” instead of passing the styling information as input parameters, so you can compare both techniques and understand how color and drop-down list input parameters can replace “hard-coded” colors and drop-down lists so that you can pass colors and drop-down list values from the TradeStation® user interface as input parameters and then replace any hard-coded colors or hard-coded drop-down lists in your strategy with these input parameters. Note that to replace a hard-coded drop-down list with a drop-down list value input parameter they need to be the same type of drop-down list. I.e. you cannot replace a drop-down list of the bar period types with a drop-down list of the plot styles.
- The bars whose “Standard Deviation of the Close” value is above or below the “Std Dev Threshold to Enter Trade” threshold (based on whether or not the “Enter If Std Dev Is Below, Not Above, Threshold” input parameter is set to False or True) have a translucent (semi-transparent) yellow dot on their lows. Quagensia T Edition’s support for translucent colors is useful for drawing dots or other tiny shapes on top of bar open, high, low, or close values because these tiny shapes can be drawn on top of one of these prices of a price bar without covering up the exact value of the price on top of which it is drawn since the shape is partially transparent.
Copyright © 2024 Quagensia, Inc. All rights reserved.
How to Get the Quagensia Strategies
This point-and-click trading strategy is built into Quagensia T Edition (for TradeStation®).
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.


