High/Low of Day Column


Category:
0
0

Hey again.   I just cant seem to get steady results with  a code you suggested to me for a high/lod of day scan.

input withinBars = 10;
def newDay = GetDay() <> GetDay()[1];
rec trackHigh = if newDay then high else if high > trackHigh[1] then high else trackHigh[1];
rec countBars = if high == trackHigh then 0 else if high < trackHigh and countBars[1] < withinBars then countBars[1] + 1 else -1;
plot scan = countBars > 0 and countBars < withinBars;

Is there a way to just make a column that will signal if at HOD / LOD?

Marked as spam
Posted by (Questions: 11, Answers: 15)
Asked on January 23, 2021 1:21 pm
254 views
0
Private answer

The code works perfectly well as a custom column as it is. No changes are required. I have tested this myself and just as I explained in your previous post on this topic it works perfectly. Screenshot below shows the results.

Attachments:
Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on January 23, 2021 2:06 pm
0
I think I may be thinking of something else. This will track new highs? The high of day look to be the very first and second 15m candle of the day. So 10 bars from there and conditions are met? Sorry Im confused about this. I think maybe what I described in original post was off.
( at January 23, 2021 6:33 pm)
0
Well let us know when you determine what you want. I will schedule these last two posts to be deleted after one week since neither of them expresses what you are trying to achieve.
( at January 23, 2021 7:15 pm)
0
I think what I was going for was to have the counter start at any new high of day. So like AES and COP wouldn't be signaled because the high is was more than 10 bars away. I should add a condition to this to start the count when High of day is met right? like a start counter condition? So conditions only met when making new high of day, and counts 10 bars from there. if after 10 bars no new high of day, counting stop. But if a new high is made before 10 bars the counter restart from 0 there. I can clean this up and kindly repost if this clears thing up. I do appreciate the feedback. in mean time I will try to make a 'start counter' condition.
( at January 24, 2021 1:21 pm)
0
Private answer

Seems that I missed one very important detail in my previous solution. I spent some time to troubleshoot the code and I believe I have corrected the mistake. This code will only begin a new bar count when a new intraday high is reached.

input withinBars = 10;
def newDay = GetDay() <> GetDay()[1];
rec trackHigh = if newDay then high else if high > trackHigh[1] then high else trackHigh[1];
rec countBars = if trackHigh > trackHigh[1] then 0 else if trackHigh == trackHigh[1] and high < trackHigh then countBars[1] + 1 else -1; plot scan = countBars > 0 and countBars < withinBars;

Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on January 24, 2021 2:48 pm
0
Thank you again!!
( at January 25, 2021 4:35 pm)