Interface Indicators

interface Indicators {
    ATR(name: "string", props: {
        smoothingPeriod?: number;
        smoothingType?: "SMA" | "EMA" | "RMA";
        symbol?: string;
        timeframe?: string;
    }): void;
    ATRP(name: "string", props: {
        smoothingPeriod?: number;
        smoothingType?: "SMA" | "EMA" | "RMA";
        symbol?: string;
        timeframe?: string;
    }): void;
    BAR(name: "string", props: {
        formatBar?:
            | "high"
            | "low"
            | "close"
            | "open"
            | "volume"
            | "hlc3";
        symbol?: string;
        timeframe?: string;
    }): void;
    DMI(name: "string", props: {
        DILength?: number;
        DIMAType?: "SMA" | "EMA" | "RMA";
        smoothingPeriod?: number;
        smoothingType?: "SMA" | "EMA" | "RMA";
        symbol?: string;
        timeframe?: string;
    }): void;
    EMA(name: "string", props: {
        smoothingPeriod?: number;
        sourceType?:
            | "high"
            | "low"
            | "close"
            | "open";
        symbol?: string;
        timeframe?: string;
    }): void;
    MACD(name: "string", props: {
        fastLength?: number;
        oscillatorMAType?: "SMA" | "EMA" | "RMA";
        signalLength?: number;
        signalMAType?: "SMA" | "EMA" | "RMA";
        slowLength?: number;
        sourceType?:
            | "high"
            | "low"
            | "close"
            | "open";
        symbol?: string;
        timeframe?: string;
    }): void;
    OBV(name: "string", props: {
        smoothingPeriod: number;
        smoothingType:
            | "SMA"
            | "EMA"
            | "RMA"
            | "None";
        symbol?: string;
        timeframe?: string;
    }): void;
    RMA(name: "string", props: {
        smoothingPeriod?: number;
        sourceType?:
            | "high"
            | "low"
            | "close"
            | "open";
        symbol?: string;
        timeframe?: string;
    }): void;
    RSI(name: "string", props: {
        loseGainPeriod?: number;
        loseGainType?: "SMA" | "EMA" | "RMA";
        smoothingPeriod?: number;
        smoothingType?:
            | "SMA"
            | "EMA"
            | "RMA"
            | "None";
        sourceType?:
            | "high"
            | "low"
            | "close"
            | "open"
            | "OBV";
        symbol?: string;
        timeframe?: string;
    }): void;
    RVWAP(name: "string", props: {
        bandMultiplier1?: number;
        bandMultiplier2?: number;
        bandMultiplier3?: number;
        period?: number;
        symbol?: string;
        timeframe?: string;
    }): void;
    SMA(name: "string", props: {
        smoothingPeriod?: number;
        sourceType?:
            | "high"
            | "low"
            | "close"
            | "open";
        symbol?: string;
        timeframe?: string;
    }): void;
}

Methods

  • ATR (Average True Range) indicator (https://www.investopedia.com/terms/a/atr.asp).

    Parameters

    • name: "string"
    • props: {
          smoothingPeriod?: number;
          smoothingType?: "SMA" | "EMA" | "RMA";
          symbol?: string;
          timeframe?: string;
      }
      • OptionalsmoothingPeriod?: number

        integer min 1 max 1999

        14

      • OptionalsmoothingType?: "SMA" | "EMA" | "RMA"

        "SMA"

      • Optionalsymbol?: string

        current bot symbol

      • Optionaltimeframe?: string

        "1Min"

    Returns void

    To use, add/import the indicator, define name, and optionally define the props. Default props only:

    ATR('atr_'); // smoothingPeriod 14, smoothingType SMA, current bot symbol, timeframe 1Min
    

    Modifying smoothingPeriod:

    ATR('atr_sp21', {smoothingPeriod: 21}); // smoothingPeriod of 21
    

    Modifying smoothingType:

    ATR('atr_stEMA', {smoothingType: 'EMA'}); // smoothingType EMA
    

    Modifying symbol/ticker:

    ATR('atr_AAPL', {symbol: 'AAPL'}); // AAPL symbol/ticker
    

    Modifying timeframe:

    ATR('atr_tf5Min', {timeframe: '5Min'}); // 5Min timeframe
    

    Modifying all props:

    ATR('atr_sp21_stEMA_AAPL_tf5Min', {smoothingPeriod: '21', smoothingType: 'EMA', symbol: 'AAPL', timeframe: '5Min'});
    
  • Parameters

    • name: "string"
    • props: {
          smoothingPeriod?: number;
          smoothingType?: "SMA" | "EMA" | "RMA";
          symbol?: string;
          timeframe?: string;
      }
      • OptionalsmoothingPeriod?: number

        integer min 1 max 1999

        14

      • OptionalsmoothingType?: "SMA" | "EMA" | "RMA"

        "SMA"

      • Optionalsymbol?: string

        current bot symbol

      • Optionaltimeframe?: string

        "1Min"

    Returns void

    To use, add/import the indicator, define name, and optionally define the props. Default props only:

    ATRP('atrp_'); // smoothingPeriod 14, smoothingType SMA, current bot symbol, timeframe 1Min
    

    Modifying smoothingPeriod:

    ATRP('atrp_sp21', {smoothingPeriod: 21}); // smoothingPeriod of 21
    

    Modifying smoothingType:

    ATRP('atrp_stEMA', {smoothingType: 'EMA'}); // smoothingType EMA
    

    Modifying symbol/ticker:

    ATRP('atrp_AAPL', {symbol: 'AAPL'}); // AAPL symbol/ticker
    

    Modifying timeframe:

    ATRP('atrp_tf5Min', {timeframe: '5Min'}); // 5Min timeframe
    

    Modifying all props:

    ATRP('atrp_sp21_stEMA_AAPL_tf5Min', {smoothingPeriod: '21', smoothingType: 'EMA', symbol: 'AAPL', timeframe: '5Min'});
    
  • ATR (Average True Range) indicator (https://www.investopedia.com/terms/a/atr.asp).

    Parameters

    • name: "string"
    • props: {
          formatBar?:
              | "high"
              | "low"
              | "close"
              | "open"
              | "volume"
              | "hlc3";
          symbol?: string;
          timeframe?: string;
      }
      • OptionalformatBar?:
            | "high"
            | "low"
            | "close"
            | "open"
            | "volume"
            | "hlc3"

        "close"

      • Optionalsymbol?: string

        current bot symbol

      • Optionaltimeframe?: string

        "1Min"

    Returns void

    To use, add/import the indicator, define name, and optionally define the props. Default props only:

    BAR('tickerOnClose'); // current bot symbol, timeframe 1Min
    

    Modifying symbol/ticker:

    BAR('tickerOnClose_aapl', {symbol: 'AAPL'}); // AAPL symbol/ticker
    

    Modifying timeframe:

    BAR('tickerOnClose_5Min', {timeframe: '5Min'}); // 5Min timeframe
    

    Modifying all props:

    BAR('tickerOnClose_aapl_5Min', {symbol: 'AAPL', timeframe: '5Min'});
    
  • DMI (Directional Movement Index) indicator (https://www.investopedia.com/terms/d/dmi.asp).

    Parameters

    • name: "string"
    • props: {
          DILength?: number;
          DIMAType?: "SMA" | "EMA" | "RMA";
          smoothingPeriod?: number;
          smoothingType?: "SMA" | "EMA" | "RMA";
          symbol?: string;
          timeframe?: string;
      }
      • OptionalDILength?: number

        integer min 1 max 1999

        14

      • OptionalDIMAType?: "SMA" | "EMA" | "RMA"

        "SMA"

      • OptionalsmoothingPeriod?: number

        integer min 1 max 1999

        14

      • OptionalsmoothingType?: "SMA" | "EMA" | "RMA"

        "SMA"

      • Optionalsymbol?: string

        current bot symbol

      • Optionaltimeframe?: string

        "1Min"

    Returns void

    To use, add/import the indicator, define name, and optionally define the props. Default props only:

    DMI('dmi_'); // DILength 14, DIMAType SMA, smoothingPeriod 14, smoothingType SMA, current bot symbol, timeframe 1Min
    

    Modifying DILength:

    DMI('dmi_diLength9', {DILegnth: 9}); // DILength of 9
    

    Modifying DIMAType:

    DMI('dmi_ema', {DIMALength: 'EMA'}); // DIMALength EMA
    

    Modifying smoothingPeriod

    DMI('dmi_sp7', {smoothingPeriod: 7}); // smoothingPeriod 7
    

    Modifying smoothingType

    DMI('dmi_stRMA', {smoothingType: 'RMA'}); // smoothingType RMA
    

    Modifying symbol/ticker:

    DMI('dmi_AAPL', {symbol: 'AAPL'}); // AAPL symbol/ticker
    

    Modifying timeframe:

    DMI('dmi_tf5Min', {timeframe: '5Min'}); // 5Min timeframe
    

    Modifying all props:

    DMI('dmi_diLength9_ema_sp7_stRMA_AAPL_tf5Min', {DILength: 9, DIMALength: 'EMA', smoothingPeriod: '7', smoothingType: 'RMA', sourceType: 'open', symbol: 'AAPL', timeframe: '5Min'});
    
  • EMA (Exponential Moving Average) indicator (https://www.investopedia.com/terms/e/ema.asp).

    Parameters

    • name: "string"
    • props: {
          smoothingPeriod?: number;
          sourceType?:
              | "high"
              | "low"
              | "close"
              | "open";
          symbol?: string;
          timeframe?: string;
      }
      • OptionalsmoothingPeriod?: number

        integer min 1 max 1999

        14

      • OptionalsourceType?:
            | "high"
            | "low"
            | "close"
            | "open"

        "close"

      • Optionalsymbol?: string

        current bot symbol

      • Optionaltimeframe?: string

        "1Min"

    Returns void

    To use, add/import the indicator, define name, and optionally define the props. Default props only:

    EMA('ema_'); // smoothingPeriod 14, smoothingType SMA, sourceType close, current bot symbol, timeframe 1Min
    

    Modifying smoothingPeriod:

    EMA('ema_sp9', {smoothingPeriod: 9}); // smoothingPeriod of 9
    

    Modifying smoothingType:

    EMA('ema_stEMA', {smoothingType: 'EMA'}); // smoothingType EMA
    

    Modifying sourceType

    EMA('ema_open', {sourceType: 'open'}); // sourceType open
    

    Modifying symbol/ticker:

    EMA('ema_AAPL', {symbol: 'AAPL'}); // AAPL symbol/ticker
    

    Modifying timeframe:

    EMA('ema_tf5Min', {timeframe: '5Min'}); // 5Min timeframe
    

    Modifying all props:

    EMA('ema_sp9_stEMA_open_AAPL_tf5Min', {smoothingPeriod: '9', smoothingType: 'EMA', sourceType: 'open', symbol: 'AAPL', timeframe: '5Min'});
    
  • MACD (Moving Average Convergence/Divergence) indicator (https://www.investopedia.com/terms/m/macd.asp).

    Parameters

    • name: "string"
    • props: {
          fastLength?: number;
          oscillatorMAType?: "SMA" | "EMA" | "RMA";
          signalLength?: number;
          signalMAType?: "SMA" | "EMA" | "RMA";
          slowLength?: number;
          sourceType?:
              | "high"
              | "low"
              | "close"
              | "open";
          symbol?: string;
          timeframe?: string;
      }
      • OptionalfastLength?: number

        integer min 1 max 1999

        12

      • OptionaloscillatorMAType?: "SMA" | "EMA" | "RMA"

        "EMA"

      • OptionalsignalLength?: number

        integer min 1 max 1999

        9

      • OptionalsignalMAType?: "SMA" | "EMA" | "RMA"

        "EMA"

      • OptionalslowLength?: number

        integer min 1 max 1999

        26

      • OptionalsourceType?:
            | "high"
            | "low"
            | "close"
            | "open"

        "close"

      • Optionalsymbol?: string

        current bot symbol

      • Optionaltimeframe?: string

        "1Min"

    Returns void

    To use, add/import the indicator, define name, and optionally define the props. Default props only:

    MACD('macd_'); // fastLength 12, oscillatorMAType EMA, signalLength 9, signalMAType EMA, slowLength 26, sourceType close, current bot symbol, timeframe 1Min
    

    Modifying fastLegnth and slowLegnth:

    MACD('macd_fl9_sl21_signall5', {fastLength: 9, slowLength: 21, signalLength: 5}); // fastLength 9 and slowLength 21 and signalLength 5
    
    • Modifying oscillator MA Types:
    MACD('macd_oRMA_sRMA', {oscillatorMAType: RMA, signalMAType: RMA}); // oscillatorMAType RMA and signalMAType RMA
    

    Modifying symbol/ticker:

    MACD('macd_AAPL', {symbol: 'AAPL'}); // AAPL symbol/ticker
    

    Modifying timeframe:

    MACD('macd_tf5Min', {timeframe: '5Min'}); // 5Min timeframe
    

    Modifying all props:

    MACD('macd_fl9_sl21_signall5_oRMA_sRMA_stClose_AAPL_tf5Min', {fastLegnth: 9, slowLength: 21, signalLength: 5, oscialltorMAType: 'RMA', signalMAType: 'RMA, symbol: 'AAPL', timeframe: '5Min'});
    
  • OBV (On Balance Volume) indicator (https://www.investopedia.com/terms/o/onbalancevolume.asp).

    Parameters

    • name: "string"
    • props: {
          smoothingPeriod: number;
          smoothingType:
              | "SMA"
              | "EMA"
              | "RMA"
              | "None";
          symbol?: string;
          timeframe?: string;
      }
      • smoothingPeriod: number

        integer min 1 max 1999

        14

      • smoothingType:
            | "SMA"
            | "EMA"
            | "RMA"
            | "None"

        "None"

      • Optionalsymbol?: string

        current bot symbol

      • Optionaltimeframe?: string

        "1Min"

    Returns void

    To use, add/import the indicator, define name, and optionally define the props. Default props only:

    OBV('obv_'); // smoothingPeriod 14, smoothingType none, current bot symbol, timeframe 1Min
    

    Modifying smoothingPeriod:

    OBV('obv_sp7', {smoothingPeriod: 7}); // smoothingPeriod of 7
    

    Modifying smoothingType:

    OBV('obv_stEMA', {smoothingType: 'EMA'}); // smoothingType EMA
    

    Modifying symbol/ticker:

    OBV('obv_AAPL', {symbol: 'AAPL'}); // AAPL symbol/ticker
    

    Modifying timeframe:

    OBV('obv_tf5Min', {timeframe: '5Min'}); // 5Min timeframe
    

    Modifying all props:

    OBV('obv_sp7_stEMA_AAPL_tf5Min', {smoothingPeriod: '7', smoothingType: 'EMA', symbol: 'AAPL', timeframe: '5Min'});
    
  • RMA (Relative Moving Average) indicator (https://www.tradingcode.net/tradingview/ema-versus-rma/).

    Parameters

    • name: "string"
    • props: {
          smoothingPeriod?: number;
          sourceType?:
              | "high"
              | "low"
              | "close"
              | "open";
          symbol?: string;
          timeframe?: string;
      }
      • OptionalsmoothingPeriod?: number

        integer min 1 max 1999

        14

      • OptionalsourceType?:
            | "high"
            | "low"
            | "close"
            | "open"

        "close"

      • Optionalsymbol?: string

        current bot symbol

      • Optionaltimeframe?: string

        "1Min"

    Returns void

    To use, add/import the indicator, define name, and optionally define the props. Default props only:

    RMA('rma_'); // smoothingPeriod 14, smoothingType SMA, sourceType close, current bot symbol, timeframe 1Min
    

    Modifying smoothingPeriod:

    RMA('rma_sp9', {smoothingPeriod: 9}); // smoothingPeriod of 9
    

    Modifying smoothingType:

    RMA('rma_stEMA', {smoothingType: 'EMA'}); // smoothingType EMA
    

    Modifying sourceType

    RMA('rma_open', {sourceType: 'open'}); // sourceType open
    

    Modifying symbol/ticker:

    RMA('rma_AAPL', {symbol: 'AAPL'}); // AAPL symbol/ticker
    

    Modifying timeframe:

    RMA('rma_tf5Min', {timeframe: '5Min'}); // 5Min timeframe
    

    Modifying all props:

    RMA('rma_sp9_stEMA_open_AAPL_tf5Min', {smoothingPeriod: '9', smoothingType: 'EMA', sourceType: 'open', symbol: 'AAPL', timeframe: '5Min'});
    
  • RSI (Relative Strength Index) indicator (https://www.investopedia.com/terms/r/rsi.asp).

    Parameters

    • name: "string"
    • props: {
          loseGainPeriod?: number;
          loseGainType?: "SMA" | "EMA" | "RMA";
          smoothingPeriod?: number;
          smoothingType?:
              | "SMA"
              | "EMA"
              | "RMA"
              | "None";
          sourceType?:
              | "high"
              | "low"
              | "close"
              | "open"
              | "OBV";
          symbol?: string;
          timeframe?: string;
      }
      • OptionalloseGainPeriod?: number

        integer min 1 max 1999

        14

      • OptionalloseGainType?: "SMA" | "EMA" | "RMA"

        "RMA"

      • OptionalsmoothingPeriod?: number

        integer min 1 max 1999

        14

      • OptionalsmoothingType?:
            | "SMA"
            | "EMA"
            | "RMA"
            | "None"

        "None"

      • OptionalsourceType?:
            | "high"
            | "low"
            | "close"
            | "open"
            | "OBV"

        "close"

      • Optionalsymbol?: string

        current bot symbol

      • Optionaltimeframe?: string

        "1Min"

    Returns void

    To use, add/import the indicator, define name, and optionally define the props. Default props only:

    RSI('rsi_'); // loseGainPeriod 14, loseGainType RMA, smoothingPeriod 14, smoothingType none, sourceType close, current bot symbol, timeframe 1Min
    

    Modifying loseGainPeriod:

    RSI('rsi_lgp3', {loseGainPeriod: 3}); // loseGainPeriod of 3
    

    Modifying loseGainType:

    RSI('rsi_lgt3', {loseGainType: 'EMA'}); // loseGainType EMA
    

    Modifying smoothingPeriod:

    RSI('rsi_sp3', {smoothingPeriod: 3}); // smoothingPeriod of 3
    

    Modifying smoothingType:

    RSI('rsi_stEMA', {smoothingType: 'EMA'}); // smoothingType EMA
    

    Modifying sourceType:

    RSI('rsi_sttOBV', {sourceType: 'OBV'}); // sourceType OBV
    

    Modifying symbol/ticker:

    RSI('rsi_AAPL', {symbol: 'AAPL'}); // AAPL symbol/ticker
    

    Modifying timeframe:

    RSI('rsi_tf5Min', {timeframe: '5Min'}); // 5Min timeframe
    

    Modifying all props:

    RSI('rsi_lgp3_lgt3_sp3_stEMA_sttOBV_AAPL_tf5Min', {loseGainPeriod: 3, loseGainType: 'EMA', smoothingPeriod: '3', smoothingType: 'EMA', sourceType: 'OBV', symbol: 'AAPL', timeframe: '5Min'});
    
  • RVWAP

    Parameters

    • name: "string"
    • props: {
          bandMultiplier1?: number;
          bandMultiplier2?: number;
          bandMultiplier3?: number;
          period?: number;
          symbol?: string;
          timeframe?: string;
      }
      • OptionalbandMultiplier1?: number

        integer min 0 max 100

        1.618

      • OptionalbandMultiplier2?: number

        integer min 0 max 100

        2

      • OptionalbandMultiplier3?: number

        integer min 0 max 100

        2.3819

      • Optionalperiod?: number

        integer min 1 max 1999

        calculated based on timeframe

      • Optionalsymbol?: string

        current bot symbol

      • Optionaltimeframe?: string

        "1Min"

    Returns void

    To use, add/import the indicator, define name, and optionally define the props. Default props only:

    RVWAP('rvwap')

    tick = (i, b) => {
    i.rvwap().rollingVWAP // Decimal;
    i.rvwap().upperBand1 // Decimal;
    i.rvwap().lowerBand1 // Decimal;
    i.rvwap().upperBand2 // Decimal;
    i.rvwap().lowerBand2 // Decimal;
    i.rvwap().upperBand3 // Decimal;
    i.rvwap().lowerBand3 // Decimal;
    }
  • SMA (Simple Moving Average) indicator (https://www.investopedia.com/terms/s/sma.asp).

    Parameters

    • name: "string"
    • props: {
          smoothingPeriod?: number;
          sourceType?:
              | "high"
              | "low"
              | "close"
              | "open";
          symbol?: string;
          timeframe?: string;
      }
      • OptionalsmoothingPeriod?: number

        integer min 1 max 1999

        14

      • OptionalsourceType?:
            | "high"
            | "low"
            | "close"
            | "open"

        "close"

      • Optionalsymbol?: string

        current bot symbol

      • Optionaltimeframe?: string

        "1Min"

    Returns void

    To use, add/import the indicator, define name, and optionally define the props. Default props only:

    SMA('sma_'); // smoothingPeriod 14, smoothingType SMA, sourceType close, current bot symbol, timeframe 1Min
    

    Modifying smoothingPeriod:

    SMA('sma_sp9', {smoothingPeriod: 9}); // smoothingPeriod of 9
    

    Modifying smoothingType:

    SMA('sma_stEMA', {smoothingType: 'EMA'}); // smoothingType EMA
    

    Modifying sourceType

    SMA('sma_open', {sourceType: 'open'}); // sourceType open
    

    Modifying symbol/ticker:

    SMA('sma_AAPL', {symbol: 'AAPL'}); // AAPL symbol/ticker
    

    Modifying timeframe:

    SMA('sma_tf5Min', {timeframe: '5Min'}); // 5Min timeframe
    

    Modifying all props:

    SMA('sma_sp9_stEMA_open_AAPL_tf5Min', {smoothingPeriod: '9', smoothingType: 'EMA', sourceType: 'open', symbol: 'AAPL', timeframe: '5Min'});