#---------- RVI Section 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; #---------- RelativeVolumeStDev Section input length = 60; input numDev = 2.0; input allowNegativeValues = no; def rawRelVol = (volume - Average(volume, length)) / StDev(volume, length); def RelVol = if allowNegativeValues then rawRelVol else Max(0, rawRelVol); #---------- Percent Change Section def percentChange = 100 * (close[1] / close - 1); #---------- Conditions def up = RVI >= 55.0 and RelVol >= 2 and AbsValue(percentChange) <= 9.0; def down = RVI <= 55.0 and RelVol >= 2 and AbsValue(percentChange) <= 9.0; def halt = RVI <= 55.0 and RelVol >= 2 and AbsValue(percentChange) > 9.0; def volumeCondition = volume > 50000; def up = volumeCondition and RVI >= 55.0 and RelVol >= 2 and AbsValue(percentChange) <= 9.0; def down = volumeCondition and RVI <= 55.0 and RelVol >= 2 and AbsValue(percentChange) <= 9.0; def halt = volumeCondition and RVI <= 55.0 and RelVol >= 2 and AbsValue(percentChange) > 9.0; #---------- Display Text AddLabel(yes, if up then "Massive volume surging up" else if down then "Massive volume surging down" else if halt then "HALT WARNING" else "None", if up or down or halt then Color.BLACK else Color.CURRENT); AssignBackgroundColor(if up then Color.GREEN else if down then Color.RED else if halt then Color.YELLOW else Color.CURRENT); Identifier Already Used: up at 23:5 Identifier Already Used: down at 24:5 Identifier Already Used: halt at 25:5 Already assigned: up at 23:5 Already assigned: down at 24:5 Already assigned: halt at 25:5 Identifier Already Used: up at 23:5 Identifier Already Used: down at 24:5 Identifier Already Used: halt at 25:5 Already assigned: up at 23:5 Already assigned: down at 24:5 Already assigned: halt at 25:5