Variable share between custom backtest and AFL main code

Hi

I am performing some position sizing on a position exit in the custom backtest and then entering in a new symbol based on similar criteria. However my entry/exit criteria is in the main AFL code outside. I want to use the custom backtest variable to enter a position in my main code. \

how can i use the same custom backtest variable in my AFL buy/sell code.

…new to AFL programming and custom backtest…

1 Like

The custom backtest code runs AFTER all of your “main” or Phase 1 AFL has been executed for each symbol. Rather than trying to generate a new Buy signal in your Phase 1 code, you would just need to call bo.EnterTrade() on the new symbol from within the CBT.

1 Like