Mark a specific date/so many days back?

Necrosway

New member
Just as the title says. I will try to script this but if anyone has done this/knows of a script please let me know. Thanks for your time.
 

rad14733

Well-known member
VIP
Just as the title says. I will try to script this but if anyone has done this/knows of a script please let me know. Thanks for your time.

A bit more detail would be helpful, like the timeframe you would be using this for... It would be fairly simple to do a specific number of days back on a daily chart but more complex if you wanted to for example highlight all candles for a specific date for all timeframes... I'm not your date guy but we have a couple members who are well versed in date and counter related code... The more information you provide, the better able we'll be able to assist you...
 

SleepyZ

Well-known member
Just as the title says. I will try to script this but if anyone has done this/knows of a script please let me know. Thanks for your time.

See is this helps. It will mark all of the candles for an input days_back.
Code:
input days_back = 3;
def ymd      = GetYYYYMMDD();
def dayCount = CompoundValue(1, if !isnan(close) and ymd != ymd[1]
                                then dayCount[1] + 1
                                else dayCount[1], 0);
def thisDay  = (HighestAll(dayCount) - dayCount) ;
assignpriceColor(if thisday==days_back then color.yellow else color.current);
 

Necrosway

New member
A bit more detail would be helpful, like the timeframe you would be using this for... It would be fairly simple to do a specific number of days back on a daily chart but more complex if you wanted to for example highlight all candles for a specific date for all timeframes... I'm not your date guy but we have a couple members who are well versed in date and counter related code... The more information you provide, the better able we'll be able to assist you...

Yeah sorry about that, I meant just a simple Daily chart lookback, SleepyZ got it though!

See is this helps. It will mark all of the candles for an input days_back.
Code:
input days_back = 3;
def ymd      = GetYYYYMMDD();
def dayCount = CompoundValue(1, if !isnan(close) and ymd != ymd[1]
                                then dayCount[1] + 1
                                else dayCount[1], 0);
def thisDay  = (HighestAll(dayCount) - dayCount) ;
assignpriceColor(if thisday==days_back then color.yellow else color.current);

This is exactly what I had in mind, tysm!
 

Similar threads

Top