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