Highest Point on each Intraday

cheual

New member
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!
 

tomsk

Well-known member
VIP
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!


@cheual Per your request here is your high during regular trading hours study being plotted on your charts. Remember to run this at intraday aggregations, e.g. 15 mins, etc

Code:
# 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
 

tomsk

Well-known member
VIP
Well that's because you were not clear when you initiated that request. That would be a different code. Next time be real explicit
Here is the high previous day - run this on an intraday aggregation, e.g. 15 min

Code:
# 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
 
Last edited:

RegularRob

New member
VIP
Hi @tomsk, I was hoping that maybe you could help me on a similar task if possible. I'm trying to define the highest point before the MACD cross. (indicated with the two red arrows). Ultimately I will add the ATR value to that point to determine my stop loss.

eMAb4Hv.png
 

booboo

New member
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
 

XeoNoX

Well-known member
VIP
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
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)  );
 

booboo

New member
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)  );
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?
 
Last edited:

XeoNoX

Well-known member
VIP
you 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?
 

booboo

New member
you 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?
The last bar counting from the current bar I mean
 

booboo

New member
you 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 whelming

Code:
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;
 

XeoNoX

Well-known member
VIP
i dont make the rules or actions, thats something youde have to limit based of rules to your scan.
and FYI if you were to add more ranges at different time frames as you were suggesting in post #11 youre just going to get even more emails
last but not least the code you have as
def from = (HighestAll(lastbar) - length);
isnt required
 

XeoNoX

Well-known member
VIP
i 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.

OFPrhkn.png
 

booboo

New member
i 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.

OFPrhkn.png
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 repeats
 

XeoNoX

Well-known member
VIP
If I did that wouldn't it only output tickers that qualify for all of the time frames?
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.
 

Similar threads

Top