nerdytrader
New member
This is a scanner code I found on the thinkscript cloud for a flag scan. I was tinkering with it and noticed something strange so I kept tinkering with it. No matter what values I enter for the input = n and input =s , I got the same results. I put the code directly in the scanner under the study filter, I made a study for the code and made a scan using the condition wizard, still same results. Then I deleted the input = n and ran the scan. Same results as if it was not deleted. Then I deleted the input = s value and no change. Still getting the same results.
Then I deleted a big chunk of the code, same results. I'm baffeled.
Heres the original code from the thinkscript_cloud:
No matter what, when you scan using the same time frames, all of the results will be the same. That makes no sense to me. What are the inputs for if they don't change the results at all? And or, what is the rest of the code for if it has no impact at all on the scan/ Are the results that the scan displays even related to the scan critera itself? Furthermore, what's strange is oddly enough, the results that are displayed are more so actual flag patterns. So I'm very confused about this.
Does anyone have any idea what is going on? I've always wondered how accurately the scanner tool actually utilized the custom filters to give results that match the filters used, so this makes me wonder
Then I deleted a big chunk of the code, same results. I'm baffeled.
Heres the original code from the thinkscript_cloud:
Code:
# Bull Flag on Pole - SCAN
# Mobius
# V01.02.2014
# Price trend - Upward leading to the pattern. The price should rise by at least 90% in less than 2 months.
# Shape - A consolidation pattern forms after price doubles. It usually doesn't look like a flag or pennant, just a pause in the price rise.
# Volume - Recedes for best performance
# Confirmation - The pattern confirms as valid when price closes above the highest peak in the pattern.
input n = 21;
input s = 55;
def upward = IsAscending(HL2, 65);
def p = (highest(high, 21) / close[65]) > 1.1;
def o = open;
def h = high;
def l = low;
def c = close;
def HH = if h < highest(h, 51) * .75
then 0
else if h > HH[1]
then h
else HH[1];
def CIB = Inertia(((Log(Sum(TrueRange(h, c, l), n) /
(Highest(if h >= c[1] then h else c[1], n) -
Lowest(if l <= c[1] then l else c[1], n))) /
Log(10)) / (Log(n) / Log(10))) * 100, s);
def CI = if CIB > CIB[1]
then 1 else Double.NaN;
plot Flag = if upward and p
then 1
else Double.NaN;
##############################
Here are the different ways I edited and messed with the code, only to recieve the same exact results as the original code. Which makes zero sense.
##########################################
Flag code with input n and it's counterparts ommited:
#input n = 0;
input s = 0;
def upward = IsAscending(HL2, 65);
def p = (highest(high, 21) / close[65]) > 1.1;
def o = open;
def h = high;
def l = low;
def c = close;
def HH = if h < highest(h, 51) * .75
then 0
else if h > HH[1]
then h
else HH[1];
def CIB = Inertia(((Log(Sum(TrueRange(h, c, l)) /
(Highest(if h >= c[1] then h else c[1])-
Lowest(if l <= c[1] then l else c[1]))) /
Log(10)) / (Log(10))) * 100, s);
def CI = if CIB > CIB[1]
then 1 else Double.NaN;
plot Flag = if upward and p
then 1
else Double.NaN;
####################
flag scan with both s and n edited out along with CIB deleted
#######################
#input n = 0;
#input s = 0;
def upward = IsAscending(HL2, 65);
def p = (highest(high, 21) / close[65]) > 1.1;
def o = open;
def h = high;
def l = low;
def c = close;
def HH = if h < highest(h, 51) * .75
then 0
else if h > HH[1]
then h
else HH[1];
plot Flag = if upward and p
then 1
else Double.NaN;
#########################
No matter what, when you scan using the same time frames, all of the results will be the same. That makes no sense to me. What are the inputs for if they don't change the results at all? And or, what is the rest of the code for if it has no impact at all on the scan/ Are the results that the scan displays even related to the scan critera itself? Furthermore, what's strange is oddly enough, the results that are displayed are more so actual flag patterns. So I'm very confused about this.
Does anyone have any idea what is going on? I've always wondered how accurately the scanner tool actually utilized the custom filters to give results that match the filters used, so this makes me wonder
Last edited by a moderator: