trading

Creating custom blocks from SR Percent Rank

SR Percent Rank

First, let’s explain how SR Percent Rank works. The indicator makes a loop over x bars into the past and calculates the percentage of times the current closing price has been between the high and the closing price in the x bars before that.

Thanks to this, we can determine the percent rank of current close price occurrences in the range of past prices and assume that we are in the support, resistance, or breakout zone.

 

The indicator has two modes:

  1. Percentage occurrence of current close between high and low X bars back
  2. Percentage occurrence of current close between high + Current ATR and low – Current ATR X bars back.

 

There are four predefined conditions

  • SR Percent Rank is above/below the level
  • SR Percent Rank is above/below the level for X bars

 

SR Percent Rank as a breakout indicator

 

 

In the above image, you can see the SR Percent Rank on the EURUSD chart with the indicator setting Mode = 2, LookBack Period = 120 bars, and ATR with a period of 120.

If the SR Percent Rank falls to values close to zero, this means that the current closing price has not moved in this range in the past and we are therefore in a breakout situation.

 

These situations are defined by the condition SR Percent Rank is below level, which is part of the default building blocks in StrategyQuantX.

From the above figure, we can also see that SR Percent Rank is a not – symmetric indicator. This means that in order to determine in which direction the breakout occurs, another indicator is required.

 

Good candidates may be:

  • Hull Moving Average
  • KAMA
  • Ulcer Index

 

In the chart below you can see the combination of SR Percent Rank and Hull Moving Average.

 

In StrategyQuantX / Algo Wizard in custom blocks, this block will look like this:

 

 

  1. We have created two symmetric blocks SRPrcHullDown and SRPrcHullUP
  2. We created them from two existing conditions – SR Percent rank is below X and HMA is rising
  3. We parameterized the SR Percent Rank lookback period and the HMA period

 

SR Percent Rank as an indicator of mean-reverting market

 

If the SR Percent Rank moves a higher value or rises over a longer period of time, it means that the price is in the range of past prices.

 

From this assumption, we can draw two conclusions

 

  1. The price will continue to oscillate.
  2. The price is preparing for a breakout

 

 

In the above chart, we can see that when SR Percent Rank was at higher levels for a longer time, the price tended to fluctuate. Then a breakout occurred, the SR Percent Rank dropped to levels close to zero. This situation is repeated two times in the above figure.

 

This situation is captured by the predefined condition block SR Percent Rank is above the level for X bars.

 

Trading Mean Reversion is not easy, generally, oscillators help in such situations:

  • Laguerre RSI
  • Stochastic
  • RSI

 

In the following chart, we can see how the combination of SR Percent Rank is above the level for X bars, and Laguerre RSI might look on the chart.

Combine the Custom block in StrategyQuantX AlgoWizard as follows:

 

Conclusion

Custom blocks allow you to create the basic building blocks of your future strategy, which you can build directly in Algowizard or StrategyQuantX Builder. We believe that the more targeted and specific the blocks you use, the lower the risk of overfitting.

 

Subscribe
Notify of
1 Comment
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
eastpeace
eastpeace
6. 6. 2021 12:24 pm

current closing price has been between the high and the closing price in the x bars before that.

->current closing price has been between the high and the low price in the x bars before that.

It’s like inside bar occurrences. The higher value means convergence, and lower value means strong trend.

Continue reading