Trouble with column in scan

Ricorichie

New member
I've been searching the forum for a while now and have come up short. :)

I'm working on building a watchlist column. I'm trying to get the range of each weekly candle going back 10 weeks. Using GetWeek I can get the range for the current week but it won't allow me to go back in time any further. I must be doing something wrong, but can't put my finger on it. Please help!! :)

This line works and returns the range for the current week that just ended:
plot W8 = if GetWeek() then high-low else Double.NaN;


While testing I try to change to this:

plot W7 = if GetWeek() [7] then high-low else Double.NaN;
Thinking this to be the previous week's number to get the prior week's range, but it still returns the current week's range.

I'm sure I'm making a mistake somewhere, I just can't see it. Maybe I should be using something other than GetWeek.

R
 

Pensar

Active member
VIP
@Ricorichie Since you are working with a watchlist column, maybe try just referencing high[1] - low[1], high[2] - low[2], and so on? I'm guessing that your watchlist column aggregation is set to weekly, so it should pull the weekly high and low values from each past high or low that is referenced.
 
Last edited:

Ricorichie

New member
Hmmm..... That's something to consider. I'll give it a shot, but ultimately I'm not sure it's gonna give me what I need. I tried to reference a study, but I kept getting float errors so I decided to try another route. :)
 

XeoNoX

Well-known member
VIP
Here is code for range below

JS9FWqX.jpeg



Code:
AddChartBubble(low, high, high-low +"  Range ", color.plum);
 

Similar threads

Top