Using code for backtest as automation

I have made several backtests, both with EOD bars and intraday bars. Now I want to go live with all these strategies. However, I have some problems with EOD bars.

I download quotes using 1 min data from IB. Using my backtest to create live code for automation goes fine when coding intraday strategies. But when coding automation for my EOD bars I don’t get it to work. I thought as long as I check for “daily” in the settings it would work? Apparantly it does not. Most likely I’m missing something elementary here, but not sure what.

Any thoughts appreciated. Unfortunately, I’m not a guru on AFL programming.

Ok, seems like i have to reference the previous bar to solve this.

Example: let’s assume buy condition is cross(c,ref(c,-1)). To avoid Amibroker sending order before last bar is finished, the code needs to be written cross(ref(c,-1),ref(c,-2)).

I guess we can also use this:

…depending on the timeframe.