Strategy functions

In Indicators this is the strategy({ ... }) declaration from ./gen/strategy beside the outputs (the engine's own setting names: capital, quantity, commission…

In Indicators this is the strategy({ ... }) declaration from ./gen/strategy beside the outputs (the engine's own setting names: capital, quantity, commission, slippage, perps margin), the order builders in finalize() (strategy.long(id) / strategy.short(id) with .qty(), .limit(), .stop(), .oca() and .send(); strategy.exit(id) with .from(), .stop(), .limit(), .trail(); strategy.close(id), strategy.closeAll(), strategy.cancel(id), strategy.cancelAll()), and the position getters valid in state() and finalize() (strategy.positionSize(), strategy.positionAvgPrice(), strategy.equity(), strategy.openProfit(), strategy.netProfit(), the trade counts, strategy.maxDrawdown()): the same broker the kScript (legacy) engine runs, driven by the host, with om backtest run <package> and the Strategy Tester replaying the trade list from the same bars, params and sheet.

Nearest form: Strategies overview is the model, Writing strategies the API page, Your first strategy the worked port.

One rule differs from kScript: orders are placed in finalize() only, and the getters read the position after the bar's fills. A watch's money step is the other lane, for a rule over a published output rather than a strategy in the file.