Enter trades based on candle count

I am trying to migrate myself from esginal to Amibroker. Esignal is good but very costly.

I have been doing reading on amibroker, but couldn't find answer to following questions for my candlestick chart:

1. Independent of my chart time frame, how do I write afl to ask amibroker to wait for todays two candles to close completely before making any trading decision?

2. How does the afl code flow work? I mean, is the afl code processed for every tick, or is the code processed on candle close only? If it is processed for every tick, then how do I make certain section of code not to execute..
For example, if i set a variable named "X=0" at the very first line on afl code. Later somewhere I set X=1. Now, I dont want value of X to change at all... will that work if entire afl code or will X=0 be hit all the time?

3. Can I share a variable across indicators that are applied to charts?

Appreciate any assistance here...

Similar threads

Broker Special Offers

Intraday Higher Leverage

Save up to 90% in brokerage and get higher leverage for intraday trades.

Are you a day trader?