that would depend on your scan if its different or not, your comparing bars ago to price range now which is totally different. its like comparing apples to oranges.It really wouldn't be that different from doing this right?
I did not ask that . what I want to do is scan different ranges of time (10 bars ago, 11, bars ago, 12 bars ago) not time frames. having all the different ranges like in ur screenshot under one scanner will only output tickers that qualify for literally all of the filter time ranges.for all of them to be true under different time frames
you want to scan different ranges of time for what?
you want to scan different ranges of what against what
you want to scan different ranges of time for what? you want to scan different ranges of what against what? what do you want to scan ranges of time against?
so it sounded like you wanted them all in one scan and for all of them to be true under different time frames
without thorough explanation its hard to tell what your trying to do. your going to have to explain thoroughly. whats defines qualify? and if it qualifies what are you trying to do? your explanations earlier are too vague to interpret to be able to code or help.to see if it qualifys for the qualifications I had in the script I posted earlier.
my script...
What my script does is take a particular range of bars. in this case 21 bars, then takes the highest close and compares it to the the lowest close that comes after that high in this case in my picture it has to be greater than 3%. then takes that same low point that comes after the high and compares it to the first bar from the left (see picture) and make sure that it's greater than it. what my problem is tickers dont perfectly match my pattern, sometimes it shows in in the last 10 bars 11 bars 12 bars etc and instead of making multiple scanners which will create alot of emails because you would have tickers that qualify for the pattern in multiple time ranges creating alot of emails so I want it to be done under one scriptwithout thorough explanation its hard to tell what your trying to do. your going to have to explain thoroughly. what's defines qualify? and if it qualifies what are you trying to do? your explanations earlier are too vague to interpret to be able to code or help.
it already is in one script and I already posted it but here it isso the pattern is:
21 bars, then takes the highest close and compares it to the the lowest close that comes after that high in this case in my picture it has to be greater than 3%. then takes that same low point that comes after the high and compares it to the first bar from the left (see picture) and make sure that it's greater than it.
so your code already scans for that pattern?
and if so what do you want it to do? how do you want to get it into one script? Define the criteria you want to use to get it into one script
#--------------------------SCANNER CODE----------------------------------------------------------------------------
input length = 21;
input pct=3;
def corr=1+(pct/100);
def lastbar = if IsNaN(close[-1]) and !IsNaN(close) then BarNumber() else lastbar[1];
def from = (HighestAll(lastbar) - length);
def hi = if BarNumber() >= (HighestAll(lastbar) - length) and high > hi[1] then high else hi[1];
def hibar = if BarNumber() > (HighestAll(lastbar) - length) and high == hi then BarNumber() else hibar[1];
def lo = if BarNumber() > (HighestAll(hibar)) and lo[1] == 0 then low else if BarNumber() > (HighestAll(hibar)) and low < lo[1] then low else lo[1];
def fhi=if !IsNaN(close) then high[20] else fhi[1];
def con= hi/lo>=corr and lo>0 and lo>fhi ;
plot scan=con;
Condition1 = scan the last 10 bars for the patternHow do you want to get it into one script? Define the criteria you want to use to get it into one script
input length = 21;
input pct=3;
def corr=1+(pct/100);
def lastbar = if IsNaN(close[-1]) and !IsNaN(close) then BarNumber() else lastbar[1];
def from = (HighestAll(lastbar) - length);
def hi = if BarNumber() >= (HighestAll(lastbar) - length) and high > hi[1] then high else hi[1];
def hibar = if BarNumber() > (HighestAll(lastbar) - length) and high == hi then BarNumber() else hibar[1];
def lo = if BarNumber() > (HighestAll(hibar)) and lo[1] == 0 then low else if BarNumber() > (HighestAll(hibar)) and low < lo[1] then low else lo[1];
def fhi=if !IsNaN(close) then high[20] else fhi[1];
def con= hi/lo>=corr and lo>0 and lo>fhi ;
def scan=con;
#true in last 12 bars
input barsago = 12;
def var =scan >=1;
def count = Sum(var, barsago);
plot finalscan = count >0;
so I would have to keep repeating parts of it all the way from 10 to 20?here is the code for your scan is True in the last 12 bars;
Code:input length = 21; input pct=3; def corr=1+(pct/100); def lastbar = if IsNaN(close[-1]) and !IsNaN(close) then BarNumber() else lastbar[1]; def from = (HighestAll(lastbar) - length); def hi = if BarNumber() >= (HighestAll(lastbar) - length) and high > hi[1] then high else hi[1]; def hibar = if BarNumber() > (HighestAll(lastbar) - length) and high == hi then BarNumber() else hibar[1]; def lo = if BarNumber() > (HighestAll(hibar)) and lo[1] == 0 then low else if BarNumber() > (HighestAll(hibar)) and low < lo[1] then low else lo[1]; def fhi=if !IsNaN(close) then high[20] else fhi[1]; def con= hi/lo>=corr and lo>0 and lo>fhi ; def scan=con; #true in last 12 bars input barsago = 12; def var =scan >=1; def count = Sum(var, barsago); plot finalscan = count >0;
repeat what part of 10 or 20? and 10 or 20 of what? and to do what?so I would have to keep repeating parts of it all the way from 10 to 20?
repeat what part of 10 or 20? and 10 or 20 of what? and to do what?
Condition1 = scan the last 10 bars for the pattern
Condition2 = scan for the last 11 bars for the pattern
Condition 3= scan the last 12 bars for the pattern
Plot scan =condition1 or condition2 or condition3
something like this
the scan i posted scan each bar for the last 12 bars to see if the scan happened at the time of that bar.
in other words if at for the past 12 bars, if at ANY TIME within the last 12 bars your scan was true it will come up on the scanner
thats a error in your original code for the scan. your going to have to look into it, the code is too complex for me to to follow.greater than the open of that bar btw
Join useThinkScript to post your question to a community of 21,000+ developers and traders.
Thread starter | Similar threads | Forum | Replies | Date |
---|---|---|---|---|
T | How t o find 4th highest close in last 100 bars? | Questions | 7 | |
M | Highest of the Time Interval | Questions | 1 | |
highest closing for any prior Quarter | Questions | 1 | ||
Scan for highest volume ever In a stock? | Questions | 3 | ||
S | highest volume labels | Questions | 14 |
Start a new thread and receive assistance from our community.
useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.
We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.
If you are new, or just looking for guidance, here are some helpful links to get you started.