Twin Range Filter Free Indicator

The “Twin Range Filter Free indicator for Ninja Trader” is essentially a trend-following logic combined with adaptive volatility filters.
  1. The indicator starts with a given price series, usually the close of each bar (the source). All calculations are based on this input.

TwinRangeFilter

FREE DOWNLOAD

Send download link to:

 

Same indicator for TradingView can be found  HERE

Range Trading Explained HERE

 

  1. Computing the Smoothed Range :
    The indicator calculates two “smoothed ranges” based on two different periods (a fast period and a slow period) and then averages them.

    • Fast Range: Uses a shorter period and a multiplier to measure recent volatility.
    • Slow Range: Uses a longer period and a multiplier to gauge a more extended volatility measure.

    The process involves:
    a. Taking the absolute difference between the current price and the previous bar’s price.
    b. Applying exponential moving averages (EMAs) twice: once over that absolute difference to get a baseline volatility measure, and then another EMA to smooth it further.
    c. Scaling the result by the multiplier.

    After computing these two smoothed ranges, it takes the average . This final averaged smoothed range represents a dynamically adjusting “range” that adapts to current market volatility.

  2. Range Filter Line :
    Using the computed smoothed range, the indicator creates a “filter” line . This line is not just a simple moving average; it adapts to price action by allowing for a certain range of movement.The logic is something like this:

    • If the price is currently above yesterday’s Range filter, then the filter tries to follow the price up but doesn’t drop below a certain threshold.
    • If the price is currently below yesterday’s Range filter the filter moves down but is constrained by the algo.

    In other words, the Range filter line tries to “hug” the price, but within a controlled band defined by the adaptive range. When price moves strongly in one direction, the filter line follows, but when price whipsaws, the filter line helps smooth out the noise.

  3. Direction Counters (upward and downward):
    The indicator keeps track of how many consecutive bars the filter line has been moving upward or downward:These counters reset whenever the filter changes direction. They help confirm the strength or continuity of a move.
Signals Plotting Twin Range Filter Indicator
Signals Plotting Twin Range Filter Indicator
  1. Conditions for Long and Short Signals:
    The indicator defines conditions for potential long and short trades based on the relationship between price and the filter line, as well as the direction counters:

    • Long Condition : Occurs when the source price is above the filter line and there’s a sign of upward continuity , regardless of whether the current bar is higher or lower than the previous bar. Essentially, if price is above the filter and the filter line is drifting upward, it suggests a bullish environment.
    • Short Condition : Occurs when the source price is below the filter line and there’s downward continuity , indicating a bearish environment.

    An internal state variable helps determine when a direction changes from bullish to bearish or vice versa. It stores the values   and by comparing the current condition to the previous Condition state, the code identifies genuine shifts in direction to generate entries rather than false signals.

  2. Generating Signals (Long/Short):
    Once a long or short condition is met and it represents a change from the opposite condition, a signal is generated:
  3. Visualization:
    • A green upward arrow when a long condition arises.
    • A red downward arrow when a short condition appears.

In Summary:

  • The indicator first measures volatility using a combination of fast and slow range calculations, smoothing them to avoid noise.
  • It creates a dynamic filter line that tries to capture the underlying trend direction while accounting for volatility.
  • Upward and downward counters track how persistently the filter line has been moving in one direction.
  • Signals (Long/Short) appear when the price position relative to the filter and the persistence of the trend (via counters) indicate a probable shift in market direction.

This combination allows the Twin Range Filter to attempt to filter out choppy market behavior and only signal when there is a more meaningful directional move underway.

 

Scroll to Top
Disclaimer
Risk Disclosure: Futures and forex trading contains substantial risk and is not for every investor. An investor could potentially lose all or more than the initial investment. Risk capital is money that can be lost without jeopardizing ones’ financial security or life style. Only risk capital should be used for trading and only those with sufficient risk capital should consider trading. Past performance is not necessarily indicative of future results. Hypothetical Performance Disclosure: Hypothetical performance results have many inherent limitations, some of which are described below. No representation is being made that any account will or is likely to achieve profits or losses similar to those shown; in fact, there are frequently sharp differences between hypothetical performance results and the actual results subsequently achieved by any particular trading program. One of the limitations of hypothetical performance results is that they are generally prepared with the benefit of hindsight. In addition, hypothetical trading does not involve financial risk, and no hypothetical trading record can completely account for the impact of financial risk of actual trading. for example, the ability to withstand losses or to adhere to a particular trading program in spite of trading losses are material points which can also adversely affect actual trading results. There are numerous other factors related to the markets in general or to the implementation of any specific trading program which cannot be fully accounted for in the preparation of hypothetical performance results and all which can adversely affect trading results. Live Trade Room Disclosure:  This presentation is for educational purposes only and the opinions expressed are those of the presenter only. All trades presented should be considered hypothetical and should not be expected to be replicated in a live trading account. Testimonial Disclosure:  Testimonials appearing on this website may not be representative of other clients or customers and is not a guarantee of future performance or success.