This study shows how you can extend any indicator into the expansion area. It also shows how you can add Alerts to your study. These can be confirmed by also showing chart bubbles, but your charts will be cleaner with them off once you are done with this visual debugging aid.
Code
Link to the flexible grid and study
https://tos.mx/GOuPgWJ
Happy trading,
Kory Gill, @korygill

Code
Code:
#
# Enhancements to RevEngRSI study.
#
# Author: Kory Gill, @korygill
#
input length = 14;
input price = close;
input rsiValue = 50;
input onExpansion = Yes;
input smoothingType = {default Wilders, EMA};
input showChartBubbles = yes;
input showAlerts = yes;
def coeff = rsiValue / (100 - rsiValue);
def chg = price - price[1];
def diff;
switch (smoothingType) {
case Wilders:
diff = (length - 1) * (WildersAverage(Max(-chg, 0), length) * coeff - WildersAverage(Max(chg, 0), length));
case EMA:
diff = (length - 1) * (ExpAverage(Max(-chg, 0), length) * coeff - ExpAverage(Max(chg, 0), length)) / 2;
}
def value = price + if diff >= 0 then diff else diff / coeff;
def nan = double.NaN;
def lastBar = !IsNaN(price) && IsNaN(price[-1]);
def lastClose = if lastBar then value else if onExpansion and IsNaN(price) then lastClose[1] else value;
plot RevEngRSI = compoundValue(1, lastClose, Double.NaN);
RevEngRSI.DefineColor("Up", GetColor(1));
RevEngRSI.DefineColor("Down", GetColor(0));
RevEngRSI.AssignValueColor(if RevEngRSI > RevEngRSI[1] then RevEngRSI.color("Up") else RevEngRSI.color("Down"));
# alerts
def crossAbove = Crosses(price, RevEngRSI, CrossingDirection.ABOVE);
def crossBelow = Crosses(price, RevEngRSI, CrossingDirection.BELOW);
AddChartBubble(showChartBubbles and crossAbove, price, "Cross Above", GetColor(1), yes);
AddChartBubble(showChartBubbles and crossBelow, price, "Cross Below", GetColor(0), no);
Alert(showAlerts and crossAbove, "Cross Above!", Alert.BAR);
Alert(showAlerts and crossBelow, "Cross Below!", Alert.BAR);
Link to the flexible grid and study
https://tos.mx/GOuPgWJ
Happy trading,
Kory Gill, @korygill