I'd like to create a simple script that'll have a point @ close at the HIGHEST point of each intraday everyday on my screen.
Can someone help with creation of this script.
Thank You!
# High RTH
# tomsk
# 1.6.2020
declare hide_on_daily;
def active = GetTime() >= RegularTradingStart(GetYYYYMMDD());
def H = if active and !active[1]
then high
else if active and high > H[1]
then high
else H[1];
def Hbn = if high == H then barNumber() else Double.NaN;
plot HLine = if barNumber() >= HighestAll(Hbn) then H else Double.NaN;
HLine.SetDefaultColor(Color.Yellow);
# High RTH
Join useThinkScript to post your question to a community of 21,000+ developers and traders.
# High Previous Day
# tomsk
# 1.7.2020
declare hide_on_daily;
def active = GetTime() >= RegularTradingStart(GetYYYYMMDD());
plot PH = if active then high(period = AggregationPeriod.Day)[1] else Double.NaN;
PH.SetLineWeight(2);
PH.SetDefaultColor(Color.Yellow);
# End High Previous Day
Lets say im scanning the last 20 bars to find the highest close and it just so happens to be in the 7th candle counting from the right. how do I get the bar number of that particular candle
#Defines the Barnumber of the Highest CLOSE of the last XYZ bars
#By XeoNoX Via Usethinkscript.com
input barsago = 20;
def hc = highest(close,barsago);
def hcBar = if high == hc then BarNumber() else hcbar[1];
def scan = hcbar;
AddLabel (yes, " Barnumber of the Highest Close of the last " + barsago + " bars is Bar# " + (scan) );
Could you also make another part of code that takes the lowest close that comes after the highest close and calculates the percentage difference for example be at least 5%and also take that same lowest point that comes after the high and make sure its greater than the open of the first bar from the left (i dont know from where bar numbers are counted). and could it also be possible to check for this pattern in range of time frames lets say the last 10 to 20 bars?Defines the Barnumber of the Highest CLOSE of the last XYZ bars
Code:#Defines the Barnumber of the Highest CLOSE of the last XYZ bars #By XeoNoX Via Usethinkscript.com input barsago = 20; def hc = highest(close,barsago); def hcBar = if high == hc then BarNumber() else hcbar[1]; def scan = hcbar; AddLabel (yes, " Barnumber of the Highest Close of the last " + barsago + " bars is Bar# " + (scan) );
The last bar counting from the current bar I meanyou got me there buddy, although possible the amount of time it would take me would be a few days, maybe someone else can code that for you more efficiently. btw you are going to have to define "first bar from the left " better as in the first bar from the left of what?
could you make this code work in multiple ranges instead of just 21? maybe just 10 to 20? I could make a new scanner for every time frame but the emails would be over whelmingyou got me there buddy, although possible the amount of time it would take me would be a few days, maybe someone else can code that for you more efficiently. btw you are going to have to define "first bar from the left " better as in the first bar from the left of what?
input length = 21;
input pct=1.8;
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;
yea but the emails would be pretty overwhelming because there's gunna be alot of repeatsyoude have to have them individual as your practically scanning for a range or within average is what it appears like
no I mean different ranges like 10 bars ago. 11 bars ago 12 bars ago etc. right now the script scans the last 21 bars for the pattern. I could make a bunch of scanners individually from 10 all the way to 20 but like I said before it would alot of emails as there's will be repeatsi assume what you mean is your trying to use the AND feature as in the same scan is true under the 1 min 2 min 5 min etc, you can add them manually to each time frame to also filter those specific time frames you want... just add the code again and select the timeframe.
If I did that wouldn't it only output tickers that qualify for all of the time frames?just change the length and add the code again to another line as shown in the screenshot
It really wouldn't be that different from doing this right?just change the length and add the code again to another line as shown in the screenshot
yes that sounds like what you wanted because i mentioned in a earlier post in post #14 if you did them separate scans you would get more emails. so it sounded like you wanted them all in one scan and for all of them to be true under different time frames. so i explained how to do it.If I did that wouldn't it only output tickers that qualify for all of the time frames?
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.