Hello! Is there a way to get the DateTime() of a signal if there is a sig.IsEntry() in a Custom Backtest? I know there is EntryDateTime, but this works only after a trade happens for GetFirstTrade() for example as per https://www.amibroker.com/guide/a_custombacktest.html
SetCustomBacktestProc("");
if (Status("action") == actionPortfolio)
{
bo = GetBacktesterObject();
bo.PreProcess();
for (i = 0; i < BarCount; i++)
{
for (sig = bo.GetFirstSignal(i); sig; sig = bo.GetNextSignal(i))
{
if (sig.IsEntry())
{
symbol = sig.Symbol;
entry_price = sig.Price;
//DateTime???
}
}
bo.ProcessTradeSignals(i);
}
bo.PostProcess();
}
In your example code, you are looping through all the bars with your first for() loop. The date and time can be determined from the current bar. For example, add this before the loop: