Interface IndicatorContext

interface IndicatorContext {
    live: (() => Decimal | Record<string, Decimal>);
    (): Decimal | Record<string, Decimal>;
}
  • Returns Decimal | Record<string, Decimal>

     // Import indicators
    BAR('tickerOnClose', {symbol: 'QQQ'});
    ATR('atr_'); // smoothingPeriod 14, smoothingType SMA, current bot symbol, timeframe 1Min
    RSI('rsi_lgp3', {loseGainPeriod: 3}); // default except for loseGainPeriod of 3
    EMA('ema_tf5Min', {timeframe: '5Min'}); // default except for 5Min timeframe

    // Debug IndicatorContext (optional, displays values visually on Bot screen)
    debug = {}

    // tick globals for indicatorsContext, botContext, and utilsContext
    // example focus is on indicatorsContext
    tick = (i, bot, utils) => {
    debug.tickerOnClose = i.tickerOnClose();
    debug.atrp_ = i.atrp_();
    debug.rsi_ = i.rsi_();
    debug.ema_tf5Min = i.ema_tf5Min();
    }

Properties

Properties

live: (() => Decimal | Record<string, Decimal>)

In this example, the live method is used to access the live values of various indicators within a tick function, which is presumably executed at each tick of market data.