Scanning for increased range


Category:
0
0

This is a follow up to a recent post. I tried to add comments to the same post and for some reason it stated that my response was invalid. I am looking for a simple scanner that meets these two criteria.

1.This week’s range is greater than last weeks range by at least 25% (1.25). AND
2. (This week’s close minus this week’s low) divided by (This week’s high minus this week’s low) is less than .25

Attachments:
Marked as spam
Posted by (Questions: 2, Answers: 1)
Asked on December 19, 2020 6:04 am
89 views
0
To be a little more specific, this week's range is not only 125% (1.25) of last week's range, but is 125% (1.25) greater than the average of the last 14 weekly candles.
( at December 19, 2020 6:07 am)
0
Private answer

Quickest solution is to use the Condition Wizard to build the line of code for the range. I have selected to use the study named ATR (Average True Range). This will take into account any gaps from one bar to the next and gives a much more accurate value.

Screenshot below shows how to setup the condition. The ATR on the left side is set to a length of 1 (this is the true range of the current bar). The ATR on the right side is set to a length of 14 (this is the 14 period average of the true range). All we have to do is copy the code generated by the Condition Wizard and append "* 1.25" to the end. Viewers can adjust this value to whatever value seems appropriate to them.

ATR("length" = 1) is greater than ATR() * 1.25

Just a few clicks of the mouse and a few taps on the keyboard. You can learn about how to use the Condition Wizard in the following video:

https://www.hahn-tech.com/thinkorswim-condition-wizard/

Here is the line of code that computes the position of the close within the range (high to low) of the candle, expressed as a percent of that range:

def percentOfRange = 100 * (close - low) / (high - low);

Now we can put those together and provide the full section of code that runs as a scan.

def increasedRange = ATR("length" = 1) is greater than ATR() * 1.25;
def percentOfRange = 100 * (close - low) / (high - low);
plot scan = increasedRange and percentOfRange < 25.0;

Attachments:
Marked as spam
Posted by (Questions: 37, Answers: 4087)
Answered on December 19, 2020 10:17 am