exploration for the RSI wall, breakout/penetration and divergence
// RSI Breakout, Wall, Divergence Exploration
period = Param("Period", 30);
r = RSI(period);
p2 = period / 2;
// breakout
bullish_break = r > Ref( HHV(r, p2),-1 ); // breakout from resistance
bearish_break = r < Ref( LLV(r, p2),-1 ); // penetration of support
// wall
bullish_wall = r == Ref( HHV(r, p2),-1 ); // at the resistance wall
bearish_wall = r == Ref( LLV(r, p2),-1 ); // at the support wall
// divergence
bullish_divergence1 = r >= HHV(r, p2) AND C < HHV(C, p2);
bullish_divergence2 = C <= LLV(C, p2) AND r > LLV(r, p2);
bearish_divergence1 = C >= HHV(C, p2) AND r < HHV(r, p2);
bearish_divergence2 = r <= LLV(r, p2) AND C > LLV(C, p2);
Filter = 1;
walltxt = WriteIf( bullish_wall, "Bullish",
WriteIf( bearish_wall, "Bearish", "None" ));
breaktxt = WriteIf( bullish_break, "Bullish",
WriteIf( bearish_break, "Bearish", "None" ));
divtxt = WriteIf( bullish_divergence1 OR bullish_divergence2, "Bullish",
WriteIf( bearish_divergence1 OR bearish_divergence2, "Bearish", "None" ));
AddTextColumn(walltxt, "Wall");
AddTextColumn(breaktxt, "Breakout");
AddTextColumn(divtxt, "Divergence");
AddColumn(C, "Close", 1.4);
AddColumn(LLV(C, p2), "Lowest Close", 1.4);
AddColumn(HHV(C, p2), "Highest Close");
AddColumn(r, "RSI");
AddTextColumn( WriteIf( ROC(r,1) > 0, "Up", "Down" ), "Slope" );
AddColumn(LLV(r, p2), "Lowest RSI");
AddColumn(HHV(r, p2), "Highest RSI");