Daily range script scan - Error / Omission

SCALPER

New member
Hello,

Today 4/9/21, I found an error / omission using the following daily range script -

(((highest(high[1],20) – lowest(low[1],20)) / lowest(low[1],20)) * 100) >= 100

Specifically, it omitted BTX with a 20 day range from 3.59 - 10.28 or 186.4%

Any help with a modification or working script is greatly appreciated.


Direct link to the Scan Query
Screenshots of the results w/ and w/out the script -
ndI2X6a.png
 

SCALPER

New member
@rad14733 ... Hi, I asked for basic code to determine the highest / lowest values in the thinkScript Lounge chat in TOS and pieced together the script using a percentage formula to define the range. I wasn't able to find much regarding ranges in here and hope someone is able to solve the error.
 

rad14733

Well-known member
VIP
@rad14733 ... Hi, I asked for basic code to determine the highest / lowest values in the thinkScript Lounge chat in TOS and pieced together the script using a percentage formula to define the range. I wasn't able to find much regarding ranges in here and hope someone is able to solve the error.

I don't bother with Thinkscript Lounge... I've visited several times but have found it to be a waste, overall...

That being said, we can't help if you don't post images of the Thinkscript or Condition Wizard code from your custom filters...
 

SCALPER

New member
I hear you and appreciate the assistance. I'm a noob when it comes to coding but I believe the logic is sound.

Here is the Scan Query. To simplify things I deleted the additional custom filters except for the predefined parameters and the custom range script -
(((highest(high[1],20) – lowest(low[1],20)) / lowest(low[1],20)) * 100) >= 100

The screenshot shows BTX is not listed when the custom range script is run, yet it should be included since its 20 day range is 3.59 - 10.28 or 186.4%. Chances are I am using the wrong code to define the highest high and lowest low of the range resulting in the error / omission.

K6Jhw9O.png
 

MerryDay

Well-known member
VIP
@SCALPER Good News Bad News
Good News, your logic and syntax in your script is doing just what you want it to.
zbNOWmc.png

In my personal experience, pasting scripts directly into the scanner can hide issues and sometimes give unreliable results. So I put your code into a study.
Ruby:
input length = 20;

plot LowerBand = Lowest(low[1], length);
plot UpperBand = Highest(high[1], length);
plot Diff      = UpperBand - LowerBand ;
plot range = Diff / Lowerband *100 ;
range.hide();
plot test = range > 100 ;
AddChartBubble(IsNaN(close[-1]), close, "HighestHi: " + Highest(high[1], 20) + " |" + "LowestLow: " + Lowest(low[1], 20) + " | " + "Range: " +range  , color = Color.ORANGE);
I ran the study through the scanner. It got really ugly. I got the following error AND it froze and corrupted my TOS app.
ecmRMKu.png

My experience has been that scripts that result in the above error message mean that your code will not run in the TOS scanner. It might be taking too many resources. I have no idea, when people start explaining program errors to me, my brain turns off. If you are intensely interested in why this code will not run, you could try calling TOS support.
Sorry, it was a neat idea for a code.
 

XeoNoX

Well-known member
VIP
its the golden study! they dont want you to have it! its the secret to profitability! :ROFLMAO:

yea you will have to call tos support if it errors on your TOS as well, since im not willing to corrupt my TOS app im not really trying to test it, ill take @MerryDay 's word for it :oops:
 

SCALPER

New member
@MerryDay I piggybacked off the idea to reformat. The updated study yields the omitted ticker without an unexpected error. @XeoNoX behold the "golden study" -

Code:
# Range >= %
# Scalper - 04/11/2021
# Change 20 / 50 in example below to desired time interval / percentage
# Maximum time limitation undetermined

Def H = highest(high[1],20);
Def L = lowest(low[1],20);
Def Range = ((H – L) / L) *100;

Plot scan = Range >= 50;

If anyone finds a glitch / omission please chime in.
Cheers
 
Last edited:

Similar threads

Top