Last updated 20 June 2026
AmiBroker scanner fires orders only for first symbol
When you run a strategy in the AmiBroker scanner across many symbols, orders fire for only the first symbol because the AFL functions use chart-level parameters that stay the same for every stock. The fix is to pass the Name() function as the symbol in your placeOrder*() call, so each stock gets its own order.
Why this happens
The AutoTrader AFL functions in algotrader-util.afl use chart-level parameters. This means the same parameters are used for all symbols.
In a scanner, this is a problem. A scanner runs over many symbols, but the symbol you pass stays fixed, so AutoTrader keeps placing orders for the same (first) stock.
To make it work, the symbol passed to a placeOrder*() function must be different for each stock.
Solution
No matter which placeOrder*() function you use, always pass the symbol using the Name() function.
See at-ema-crossover-scanner.afl in the AutoTrader samples folder:
C:\autotrader\scripts\amibroker\Formulas\AutoTrader
A typical call uses a fixed symbol like this:
placeOrder(AT_EXCHANGE , AT_INSTRUMENT, AT_SYMBOL , “BUY”, AT_PRODUCT_TYPE , AT_ORDER_TYPE, 10, 0, 0, AT_OPTION_TYPE, AT_STRIKE_PRICE , AT_EXPIRY );
Change AT_SYMBOL to the Name() function in your AmiBroker AFL:
placeOrder(AT_EXCHANGE , AT_INSTRUMENT, Name(), “BUY”, AT_PRODUCT_TYPE , AT_ORDER_TYPE, 10, 0, 0, AT_OPTION_TYPE, AT_STRIKE_PRICE , AT_EXPIRY );
After this change, the scanner uses the correct symbol for each stock, so orders fire for every symbol instead of only the first.