Getting Dates of Specific Criteria

TradeValue = 30000;
EmaPeriod_1 = 10;
EmaPeriod_2 = 25;
RSIPeriods = 14;

RSIValue = RSI( RSIPeriods );

x = EMA(Close,EmaPeriod_1);
y = EMA(Close,EmaPeriod_2);

Buy = Cross(x, y);
Sell = Cross(y, x);

Buy = ExRem(Buy, Sell);
Sell = ExRem(Sell, Buy);

BuyPrice=ValueWhen(Buy,C);
SellPrice=ValueWhen(Sell,C);

ExitPrice = Null;
ExitBar = Null;
RSI_below_33 = Null;
AvgClose = Null;
AvgCloseBar = Null;

for (i = 1; i < BarCount; i++) {
    if (Buy[i]) {
        j = i;
        while (j < BarCount) {
            if (Close[j] >= Close[i] * 1.05) {
                ExitPrice[i] = Close[j];
                ExitBar[i] = j;
                break;
            }
            j++;
        }
        
        j = i;
        while (j < BarCount) {
            if (RSIValue[j] < 33) {
                if (ExitBar[i] < j) {
                    RSI_below_33[i] = Null;
                } else {
                    RSI_below_33[i] = RSIValue[j];
                    AvgClose[i] = Close[j];
                    AvgCloseBar[i] = j;         
                }
                break;
            }
            j++;
        }
    }
}

bi = BarIndex();
dt = DateTime();
AvgCloseDate = ValueWhen(bi == AvgCloseBar, dt);

// Exploration
Filter = Buy;
AddColumn( IIf( Buy, 66, 83 ), "Action", formatChar, colorDefault, IIf( Buy, colorGreen, colorRed ) );
AddColumn( AvgCloseDate, "AvgDate", formatDateTime );

I am Trying to get Dates of AvgClose, However the dates the not populating in the column, kindly help on that part

The code is wrong in many ways.

What you should do is to use the guidance below to DEBUG ALL your variables. Specifically use Exploration and Filter = 1 to display content of ALL INTERMEDIATE VARIABLES (not just result) for ALL bars, so you actually see what is happening in your code.

To get better understanding of what is happening in your code and how functions work, use advice given here: How do I debug my formula?

Once you display ALL variables you will see why it doesn't work.