Range Finder indicator

Talky_Zebra
Posts: 45
Joined: 07 Mar 2024
Has thanked: 13 times
Been thanked: 1 time

Range Finder indicator

Postby Talky_Zebra » 26 Apr 2024

I had to learn several new C# and Multicharts concepts for this, but its been fun. Please try this out, let me know if there are bugs to be fixed, but hopefully someone will find use for this as a filter on trades.
RangeFinder.pln
(5.67 KiB) Downloaded 11 times
Some example settings:
GBPJPY_1Hour.JPG
(200.54 KiB) Not downloaded yet
GBPUSD_1Day_with_consolidations.JPG
(172.12 KiB) Not downloaded yet
GBPUSD_1Day_no_consolidations.JPG
(164.56 KiB) Not downloaded yet

Summary:
This indicator identifies "ranges" and "consolidations". It primarily uses AMA and
ATR to measure "range-ness".

A "range" is defined by flatter areas of an Adaptive Moving Average. With "flatness"
measured by line slope. The high and low of any bar is compared to range_atr_multiplier
and if it is less than that variable, it is a range.

A "consolidation" is actually a range, but with a tighter upper and lower limits as
defined by consolidation_atr_multiplier.

This indicator uses a List of objects to track the ranges, and then draws rectangles
per those ranges. The trick was cleanly determining if a "new range" was contiguous
with the prior range object or not. If it was, then the prior range object is updated
with the new highs, lows and bar time, and then the last rectangle is deleted and
reformed based on the updated range object info.

Plots 0 and 1 provide true/false (ie 1 or 0) values if a bar is part of a range or
consolidation, respectively.

The properties:
There is no "magic set" of properties that will universally define a great range between
markets and timeframes. The combination of these settings need to be tuned for each
situation. That said, similarites will be found between markets using the same timeframe.

atr_period_length: the period of the ATR used in the calculations. I choose a longer
period length (50) so that this is not affected dramatically by bursts of volatility
range_atr_multiplier: based on the above ATR, a range is constrained by this variable.
For instance, "range_atr_multiplier = 4" means that the highs and lows must be under
4x the ATR to be considered a range
consolidation_atr_multiplier: similar to the above, except that it should be a smaller
value than the range_atr_multiplier, to show a narrower range. For instance, if the
range multiplier is 4, then we might set "consolidation_atr_multiplier = 1.5"
ama_effratio: this sets how close the AMA follows the Close prices. (Apply the "Mov_Avg_Adaptive"
indicator to a chart and change the effratio to experiment with this.) The effect of
higher values on this indicator *generally* increases the number of contiguous bars selected as
a range. However if the number is too high, the indicator may miss some ranges that
you would like to capture, especially at the turning point when a trend turns into a range.
slope_percentile: this is the primary selector for a range. The number here selects any
slope that falls under this percentile. So, from the previous 100 slopes calculated,
"slope_percentile = 80" will identify any slope under the 80%ile as a range candidate.
From a usage standpoint, starting at ~70 and up to 100 is where most of the useful
ranges are found. The higher the number, the more ranges will be found
show_boxes: there are some times when you'd like to turn off the boxes. This allows you
to do that.

In practice:
The default settings work pretty well on forex 1 Hour timeframe. But, I found the following
useful when calibrating this indicator for the first time.
1. Set the props to the following:
atr_period_length = 50;
range_atr_multiplier = 100;
consolidation_atr_multiplier = 0;
ama_effratio = 5;
slope_percentile = 70;
show_boxes = true;

This basically removes the high-low range constraints on a range, and ignores all consolidations.

2. Then, start adjusting slope_percentile in increments of 5, the useful limits are 70 - 90.
Make sure to scroll to left on the chart to see the effect on different market conditions
after each change.
IGNORE the highs and lows of the boxes at this stage. When you see that ranges are selected with
"pretty good" fidelity, then go on to the next prop.

3. Adjust ama_effratio in increments of 1, the most useful limits are between 2 - 15, but you
might see some use above 15. Again, IGNORE the highs and lows of the boxes, and just see
the effect on the range selection

4. Now, reduce the range_atr_multiplier. With an atr_period_length = 50, a good range on forex
is 3 - 7. You should see your range selections decrease the lower these values go. You goal
is to exclude extreme spikes in volatility. You will not be able to get rid of all spikes
without choking out your ranges. So, at this point, you may want to increase your
slope_percentile (above) in increments of 1 to find the balance between filtering the spikes
and getting continuous ranges that make sense.

5. Finally, adjust the consolidation_atr_multiplier, if you want to identify them. The useful
range with the ATR atr_period_length = 50 is from 0.5 to the size of the range_atr_multiplier.
Note that this will break up your ranges into smaller visual chunks. But, the plot on the
bottom will be able to distinguish between ranges and consolidations.

Remember to always check numerous points in the chart history to the left and right after each
change to make sure your settings are applicable in *most* cases. There will always be
sections where identification is not pretty as you'd like.

Return to “User Contributed Studies”