PT_Scalper
Member
I'm new to this board and relatively new to trading. Looking to see if someone can modify this RVI (Relative Volume Index) label for ToS.
The current script displays "Green" when above 50 and "Red" when below 50. I'd like to see if someone can help me here with the following;
input stDevLength = 10;
input averageLength = 14;
input averageType = AverageType.EXPONENTIAL;
def stDevHi = stDev(high, stDevLength);
def stDevLo = stDev(low, stDevLength);
def avgStDevHiUp = MovingAverage(averageType, if high > high[1] then stDevHi else 0, averageLength);
def avgStDevHiDown = MovingAverage(averageType, if high < high[1] then stDevHi else 0, averageLength);
def avgStDevLoUp = MovingAverage(averageType, if low > low[1] then stDevLo else 0, averageLength);
def avgStDevLoDown = MovingAverage(averageType, if low < low[1] then stDevLo else 0, averageLength);
def rviHi = if avgStDevHiUp + avgStDevHiDown == 0 then 50 else 100 * avgStDevHiUp / (avgStDevHiUp + avgStDevHiDown);
def rviLo = if avgStDevLoUp + avgStDevLoDown == 0 then 50 else 100 * avgStDevLoUp / (avgStDevLoUp + avgStDevLoDown);
def RVI = (rviHi + rviLo) / 2;
AddLabel(yes, Concat("RVI: ", round (RVI,2)), if RVI > 50 then Color.Green else if RVI < 50 then Color.Red else Color.Gray);
Thank you!
The current script displays "Green" when above 50 and "Red" when below 50. I'd like to see if someone can help me here with the following;
- Green is over 50 and going up
- Yellow if over 50 and going down
- Red if under 50 and going down
- Cyan if under 50 and going up
input stDevLength = 10;
input averageLength = 14;
input averageType = AverageType.EXPONENTIAL;
def stDevHi = stDev(high, stDevLength);
def stDevLo = stDev(low, stDevLength);
def avgStDevHiUp = MovingAverage(averageType, if high > high[1] then stDevHi else 0, averageLength);
def avgStDevHiDown = MovingAverage(averageType, if high < high[1] then stDevHi else 0, averageLength);
def avgStDevLoUp = MovingAverage(averageType, if low > low[1] then stDevLo else 0, averageLength);
def avgStDevLoDown = MovingAverage(averageType, if low < low[1] then stDevLo else 0, averageLength);
def rviHi = if avgStDevHiUp + avgStDevHiDown == 0 then 50 else 100 * avgStDevHiUp / (avgStDevHiUp + avgStDevHiDown);
def rviLo = if avgStDevLoUp + avgStDevLoDown == 0 then 50 else 100 * avgStDevLoUp / (avgStDevLoUp + avgStDevLoDown);
def RVI = (rviHi + rviLo) / 2;
AddLabel(yes, Concat("RVI: ", round (RVI,2)), if RVI > 50 then Color.Green else if RVI < 50 then Color.Red else Color.Gray);
Thank you!