Sma-Ema Crossover - usage example of indie.Var[T]

loading

With the recent update to Indie language 4.3, we've introduced the indie.Var[T] container. This new container type functions similarly to indie.MutSeries[T], but it has a single-value history depth, making it ideal for storing and updating the current state without accumulating historical values. Although indie.Var[T] does not store historical values, it differs significantly from a primitive field of type T of an Algorithm/Context or a global variable. The key difference lies in its behavior during real-time calculations. indie.Var[T] retains only the values set on closing bar updates, reverting to the previous value before each intrabar update.

The "SMA-EMA Crossover" indicator demonstrates the use of indie.Var[T] through the algorithm CrossoverWithVar, which detects and retains values on specific crossover events. It also includes the algorithm CrossoverWithSeries to illustrate how to achieve the same result without using indie.Var[T].

TA TakeProfit
TakeProfit
Updated Nov 13, 2024
education
indie
Share icon

to activate earnings with sharing

Comments

loading