I'm testing this indicator that show possible buy triggers based on various conditions. I've added a label to show when the ADX breakouts by +30% change from previous candle. However, I'm having issues about the label not repainting. Is there a way to force the repaint at the start of the next candle?
Here's the code:
input length = 14;
input RSI_Label = Yes;
input ADX_Breakout = Yes;
def aggperiod = AggregationPeriod.MIN;
def RSI1 = RSI();
def RVI1 = RelativeVolatilityIndex();
def EMA9 = ExpAverage(close, 9);
def EMA20 = ExpAverage(close, 20);
def ADX1 = ADX();
def AOx = Average(hl2, 5) - Average(hl2, 34);
#Conditions
def closeAboveLast2 = if close > close[1] and close > close[2] then 1 else Double.NaN;
def closeAboveEMA9EMA20 = close > EMA9 and close > EMA20;
def ADXHigh = if ADX1 > ADX1[1] or ADX1 > .5 then 1 else Double.NaN;
def AOUp = if AOx > AOx[1] then 1 else Double.NaN;
#new Condition Body of Candle must below above the EMA9
def Body50ofEMA9 = if ((close + open)/2) > EMA9 then 1 else Double.NAN;
plot GapUp = if RSI1 > RSI1[1] and RVI1 > RVI1[1] and closeAboveLast2 == 1 and closeAboveEMA9EMA20 and ADXHigh == 1 and AOUp == 1 and Body50ofEMA9 == 1 then low - TickSize() * 2 else Double.NaN;
GapUp.SetPaintingStrategy(PaintingStrategy.TRIANGLES);
GapUp.SetDefaultColor(Color.ORANGE);
GapUp.SetLineWeight(5);
#RSI Info Above 50%
def RSIAbove50 = if RSI1 > .50 then round(RSI1,0) Else Double.NAN;
AddLabel(RSI_Label, "RSI: "+RSIAbove50, Color.GREEN);
#ADX Info When ADX Rips Higher from previous candle
def ADXRip = if ((ADX1[1]/ADX1) - 1) > .3 then 1 else Double.NAN;
AddLabel(ADX_Breakout, "ADX Breakout", Color.LIME);
Here's the code:
input length = 14;
input RSI_Label = Yes;
input ADX_Breakout = Yes;
def aggperiod = AggregationPeriod.MIN;
def RSI1 = RSI();
def RVI1 = RelativeVolatilityIndex();
def EMA9 = ExpAverage(close, 9);
def EMA20 = ExpAverage(close, 20);
def ADX1 = ADX();
def AOx = Average(hl2, 5) - Average(hl2, 34);
#Conditions
def closeAboveLast2 = if close > close[1] and close > close[2] then 1 else Double.NaN;
def closeAboveEMA9EMA20 = close > EMA9 and close > EMA20;
def ADXHigh = if ADX1 > ADX1[1] or ADX1 > .5 then 1 else Double.NaN;
def AOUp = if AOx > AOx[1] then 1 else Double.NaN;
#new Condition Body of Candle must below above the EMA9
def Body50ofEMA9 = if ((close + open)/2) > EMA9 then 1 else Double.NAN;
plot GapUp = if RSI1 > RSI1[1] and RVI1 > RVI1[1] and closeAboveLast2 == 1 and closeAboveEMA9EMA20 and ADXHigh == 1 and AOUp == 1 and Body50ofEMA9 == 1 then low - TickSize() * 2 else Double.NaN;
GapUp.SetPaintingStrategy(PaintingStrategy.TRIANGLES);
GapUp.SetDefaultColor(Color.ORANGE);
GapUp.SetLineWeight(5);
#RSI Info Above 50%
def RSIAbove50 = if RSI1 > .50 then round(RSI1,0) Else Double.NAN;
AddLabel(RSI_Label, "RSI: "+RSIAbove50, Color.GREEN);
#ADX Info When ADX Rips Higher from previous candle
def ADXRip = if ((ADX1[1]/ADX1) - 1) > .3 then 1 else Double.NAN;
AddLabel(ADX_Breakout, "ADX Breakout", Color.LIME);