Histogram at Previous Day High and Low

Hi
I want to draw a vertical line, histogram at Previous Day High and Low in RSI indicator. I find it difficult to get it with my little knowledge in afl coding.

Any help in this regard will be of great help in my trading

Thanks in advance.

I use AI to learn AFL :grinning_face: Try it as bellow :

_SECTION_BEGIN("RSI Histogram with Prev Day High/Low Levels");

period = Param("RSI Period", 14, 2, 100, 1); // Adjust RSI period as needed

r = RSI(period);

// Compress intraday RSI to get daily high and low
daily_high_rsi = TimeFrameCompress(r, inDaily, compressHigh);
daily_low_rsi = TimeFrameCompress(r, inDaily, compressLow);

TimeFrameRestore();

// Expand to get previous day's values (shift by -1 to exclude current incomplete day)
prev_high_rsi = TimeFrameExpand(Ref(daily_high_rsi, -1), inDaily, expandLast);
prev_low_rsi = TimeFrameExpand(Ref(daily_low_rsi, -1), inDaily, expandLast);

// Plot RSI as histogram
Plot(r, "RSI Histogram", ParamColor("Histogram Color", colorBlue), styleHistogram | styleThick | styleNoLabel);

// Plot previous day RSI high and low as horizontal lines
Plot(prev_high_rsi, "Prev Day RSI High", colorGreen, styleLine | styleThick);
Plot(prev_low_rsi, "Prev Day RSI Low", colorRed, styleLine | styleThick);

// Add standard overbought/oversold grids for reference
PlotGrid(30, colorLightGrey);
PlotGrid(50, colorLightGrey);
PlotGrid(70, colorLightGrey);

_SECTION_END();