I got this thought that; there are studies where you have a zero-line and then inputs for overbought ( = 80 usually) and oversold ( = 20 usually). But instead of such fixed values, why not have a Median (not a moving average) but a static value across for the Aggregation period and Time frame. I do understand that for a 20 year chart this may not make sense, but I intend to use it only for shorter periods like 5-days or 10-days..
Then, I will enhance such that, instead of overbought and oversold - I would have inputs for factor above and below that median price. This piece, I think, I can figure out looking at the code of some indicators where input is standard deviation (for e.g VWAP). What I am not being able to get to is the static Median line (instead of a zero line). I did try to use the Median* functions but those use price and for me it could be volume or it just could be an oscillator value or any other calculated value.
See below, so something similar to this but median value.
plot RS = if stddevVol == 0 then 0 else stddevVol;
RS.setDefaultColor(GetColor(6));
def sr = CompoundValue("historical data" = RS, "visible data" = if isNaN(sr[1]) then RS else sr[1]);
So, above generates a static value across the aggregation and time frame selected. But, I don't believe, from what I read in ThinkScript help, this result in a Median, But I think you get the point.
I did search 'Media' in thread titles and didn't find a result that would lead me to above.
Then, I will enhance such that, instead of overbought and oversold - I would have inputs for factor above and below that median price. This piece, I think, I can figure out looking at the code of some indicators where input is standard deviation (for e.g VWAP). What I am not being able to get to is the static Median line (instead of a zero line). I did try to use the Median* functions but those use price and for me it could be volume or it just could be an oscillator value or any other calculated value.
See below, so something similar to this but median value.
plot RS = if stddevVol == 0 then 0 else stddevVol;
RS.setDefaultColor(GetColor(6));
def sr = CompoundValue("historical data" = RS, "visible data" = if isNaN(sr[1]) then RS else sr[1]);
So, above generates a static value across the aggregation and time frame selected. But, I don't believe, from what I read in ThinkScript help, this result in a Median, But I think you get the point.
I did search 'Media' in thread titles and didn't find a result that would lead me to above.