Technical Indicators

EjChart control supports 10 types of technical indicators.

Bind data to render the indicator

You can bind the series dataSource to the indicator by setting the specific series name to the indicator by using the indicators.seriesName property.

  • ts
  • this.chartIndicators = [{
        //Set HiLo series dataSource to indicator using seriesName
        seriesName: "Hilo"
        //  ...
    }];
  • html
  • <ej-chart id="chartcontainer" [indicators]="chartIndicators">
        <e-seriescollection>
            <e-series type="hiloopenclose" name="Hilo" [dataSource]="chartData" 
                 xName= "xDate" high="High" low="Low" open="Open" close="Close">
    	    </e-series>
      </e-seriescollection>
    </ej-chart>

    Also, you can add data to the indicator directly by using the dataSource option of the indicator.

  • ts
  • this.chartIndicators = [{
        //Add dataSource to indicator directly
        dataSource: chartData,
        xName: "xDate",
        high: "High",
        low: "Low",
        open: "Open",
        close: "Close",
        //  ...
    }];
  • html
  • <ej-chart id="chartcontainer" [indicators]="chartIndicators">
    </ej-chart>

    Indicator Types

    Accumulation Distribution

    To create an Accumulation Distribution indicator, set the indicators.type as “accumulationDistribution”. Accumulation Distribution require ‘volume’ field additionally with the dataSource to calculate the signal line.

  • ts
  • //Initializing Indicators    
    this.chartIndicators = [{
        seriesName: "Hilo",
        //Set indicator type
        type: "accumulationDistribution",
        //  ...
    }];
  • html
  • <ej-chart id="chartcontainer" [indicators]="chartIndicators">
        <e-seriescollection>
            <e-series name="Hilo" [dataSource]="chartData" xName= "xDate"
                high="High"  low="Low" open="Open" close="Close" volume="Volume">
    	    </e-series>
       </e-seriescollection>
       
    </ej-chart>

    Accumulation Distribution

    Average True Range (ATR)

    You can create an ATR indicator by setting the indicators.type as “ATR” in the indicators.

  • ts
  • //Initializing Indicators    
    this.chartIndicators = [{
        seriesName: "Hilo",
        //Set indicator type
        type: "ATR",
        //  ...
    }];
  • html
  • <ej-chart id="chartcontainer" [indicators]="chartIndicators">
        <e-seriescollection>
            <e-series name="Hilo" [dataSource]="chartData" xName= "xDate"
                           high="High" low="Low" open="Open" close="Close">
    	    </e-series>
       </e-seriescollection>   
    </ej-chart>

    ATR

    Bollinger Band

    Bollinger Band indicator is created by setting the indicators.type as “bollingerBand”. It contains three lines, namely upper band, lower band and signal line. Bollinger Band default value of the period is 14 and standardDeviations is 2.

  • ts
  • //Initializing Indicators    
    this.chartIndicators = [{
        seriesName: "Hilo",
        //Set indicator type
        type: "bollingerBand",
        //  ...
    }];
  • html
  • <ej-chart id="chartcontainer" [indicators]="chartIndicators">
        <e-seriescollection>
            <e-series name="Hilo" [dataSource]="chartData" xName= "xDate"
             high="High" low="Low" open="Open" close="Close">
    	    </e-series>
       </e-seriescollection>   
    </ej-chart>

    Bollinger Band

    Exponential Moving Average (EMA)

    To render an EMA indicator, you have to set the indicators.type as “EMA”.

  • ts
  • //Initializing Indicators    
    this.chartIndicators = [{
        seriesName: "Hilo",
        //Set indicator type
        type: "EMA",
        //  ...
    }];
  • html
  • <ej-chart id="chartcontainer" [indicators]="chartIndicators">
        <e-seriescollection>
            <e-series name="Hilo" [dataSource]="chartData" xName= "xDate"
             high="High" low="Low" open="Open" close="Close">
    	    </e-series>
       </e-seriescollection>   
    </ej-chart>

    EMA

    Momentum

    Momentum Technical indicator is created by setting the indicators.type as “momentum”. The momentum indicator renders two lines, namely upper band and signal line. Upper band always rendered at the value 100 and the signal line is calculated based on the momentum of the data.

  • ts
  • //Initializing Indicators    
    this.chartIndicators = [{
        seriesName: "Hilo",
        //Set indicator type
        type: "momentum",
        //  ...
    }];
  • html
  • <ej-chart id="chartcontainer" [indicators]="chartIndicators">
        <e-seriescollection>
            <e-series name="Hilo" [dataSource]="chartData" xName= "xDate"
             high="High" low="Low" open="Open" close="Close">
    	    </e-series>
       </e-seriescollection>   
    </ej-chart>

    Momentum

    Moving Average Convergence Divergence (MACD)

    To render an MACD indicator, you have to set the indicators.type as “macd”. MACD indicator contains MACD line, Signal line and Histogram column. Histogram is used to differentiate MACD and signal line.

  • ts
  • //Initializing Indicators    
    this.chartIndicators = [{
        seriesName: "Hilo",
        //Set indicator type
        type: "macd",
        //  ...
    }];
  • html
  • <ej-chart id="chartcontainer" [indicators]="chartIndicators">
        <e-seriescollection>
            <e-series name="Hilo" [dataSource]="chartData" xName= "xDate"
                        high="High" low="Low" open="Open" close="Close">
    	    </e-series>
       </e-seriescollection>   
    </ej-chart>

    MACD

    macdType

    By using the macdType enumeration property, you can change the MACD rendering as line, histogram or both.

  • ts
  • //Initializing Indicators    
    this.chartIndicators = [{
        type: "macd",
        //Set macd draw type
        macdType: "histogram",
        //  ...
    }];

    MACD Type

    Relative Strength Index (RSI)

    To render the RSI indicator, set the indicators.type as “RSI”. It contains three lines, namely upper band, lower band and signal line. Upper and lower band always render at value 70 and 30 respectively and signal line is calculated based on the RSI formula.

  • ts
  • //Initializing Indicators    
    this.chartIndicators = [{
        seriesName: "Hilo",
        //Set indicator type
        type: "RSI",
        //  ...
    }];
  • html
  • <ej-chart id="chartcontainer" [indicators]="chartIndicators">
        <e-seriescollection>
            <e-series name="Hilo" [dataSource]="chartData" xName= "xDate"
                       high="High" low="Low" open="Open" close="Close">
    	    </e-series>
       </e-seriescollection>   
    </ej-chart>

    RSI

    Simple Moving Average (SMA)

    To render the SMA indicator, you should specify the indicators.type as “SMA”.

  • ts
  • //Initializing Indicators    
    this.chartIndicators = [{
        seriesName: "Hilo",
        //Set indicator type
        type: "SMA",
        //  ...
    }];
  • html
  • <ej-chart id="chartcontainer" [indicators]="chartIndicators">
        <e-seriescollection>
            <e-series name="Hilo" [dataSource]="chartData" xName= "xDate"
                       high="High" low="Low" open="Open" close="Close">
    	    </e-series>
       </e-seriescollection>   
    </ej-chart>

    SMA

    Stochastic

    For the Stochastic indicator, you need to set the indicators.type as “stochastic”. The Stochastic indicator renders four lines namely, upper line, lower line, stochastic line and the signal line. Upper line always rendered at value 80 and the lower line is rendered at value 20. Stochastic and Signal Lines are calculated based on the stochastic formula.

  • ts
  • //Initializing Indicators    
    this.chartIndicators = [{
        seriesName: "Hilo",
        //Set indicator type
        type: "stochastic",
        //  ...
    }];
  • html
  • <ej-chart id="chartcontainer" [indicators]="chartIndicators">
        <e-seriescollection>
            <e-series name="Hilo" [dataSource]="chartData" xName= "xDate"
                         high="High" low="Low" open="Open" close="Close">
    	    </e-series>
       </e-seriescollection>   
    </ej-chart>

    Stochastic

    Triangular Moving Average (TMA)

    To render the TMA indicator, you should specify the indicators.type as “TMA”.

  • ts
  • //Initializing Indicators    
    this.chartIndicators = [{
        seriesName: "Hilo",
        //Set indicator type
        type: "TMA",
        //  ...
    }];
  • html
  • <ej-chart id="chartcontainer" [indicators]="chartIndicators">
        <e-seriescollection>
            <e-series name="Hilo" [dataSource]="chartData" xName= "xDate"
                         high="High" low="Low" open="Open" close="Close">
    	    </e-series>
       </e-seriescollection>   
    </ej-chart>

    TMA

    Enable Tooltip

    To display the indicator tooltip, use visible option of the indicators.tooltip. Also, you can change and customize the tooltip color, border, format and font properties similar to the series tooltip.

  • ts
  • //Initializing Indicators    
    this.chartIndicators = [{
        //  ...
        tooltip: {
            //Enable tooltip for indicator
            visible: true
        },
    }];

    Indicator Tooltip