Trade Smarter with Automation

Charts & Indicators

Alta5 supports technical analysis using historical and intraday charts with indicators.

Loading a chart

Charts are generally loaded in a bot's wake event using the $data.chart function:

// 10 day chart with 1 day bars
var query = {
    id: 'chart',
    symbol: 'JPM',
    interval: '1d',
    period: '10d'
};
$data.chart(query).then($done);

For a detailed explanation of the options available for loading charts, see $data.chart.

Using indicators

Over 200 indicators are bundled with Alta5 for technical analysis. Indicators are calculated using the open source TA-Lib library.

Indicators are defined in the indicators array when loading a chart. Each indicator consists of a JavaScript object with name:value pairs. The options available for each type of indicator are listed in the Indicator Reference.

Reading Values

Indicator values are available for each Bar in the Chart by calling the indicator(id, output) function with the id of the indicator and the name of the output value you want to retrieve. To get the default output value, you can omit the output argument (like RSI in the example below). Indicator outputs are listed for each indicator in the reference.

Example
// Last 30 days, 1 day bars, 2 indicators
var query = {
    symbol: 'JPM',
    interval: '1d',
    period: '30d',

    indicators: [{
        type: 'bbands',      // Bollinger Bands
        timePeriod: 20,
        devUp: 2,
        devDown: 2,
        maType: 'sma'
    },{
        type: 'rsi',         // RSI indicator
        timePeriod: 14
    }]
};

$data.chart(query).then(function(chart){
    var bar = chart.lastBar;

    // read indicators
    var rsi = bar.indicator('rsi');
    var upper = bar.indicator('bbands', 'upperBand');

    // ... do something useful with the values
});
Moving Averages

Indicators with a moving average option (maType) accept one of the following values:

  • Simple = 'sma'
  • Exponential = 'ema'
  • Weighted = 'wma'
  • Triple Exponential = 't3'

Chart API

  • Array

    An array containing all of the bars in the chart, oldest to newest.

  • Number

    The close value of lastBar.

  • Bar

    The first bar in the chart.

  • Number

    The highest high of any bars in the chart.

  • Bar

    The last bar in the chart.

  • Number

    The lowest low of any bars in the chart.

  • Number

    The total number of bars in the chart.

  • Number

    The open value of firstBar.

Bar API

  • Number

    The price change from the previous bar's lose.

  • Number

    The price change % from the previous bar's close.

  • Number

    The close value for this Bar.

  • Date

    A Date object containing the time and date for this bar.

  • Number

    The close value for this bar.

  • Number

    The index of this bar in the chart.

  • Number

    Gets the specified output value for indicator with id.

    Returns the value of the default output if the output argument is omitted.

    var upper = chart.lastBar.indicator('bbands', 'upperBand');
    // no output arg returns the default output
    var rsi = chart.lastBar.indicator('rsi');
  • Number

    The low value for this bar.

  • Bar

    The bar after this one in the chart.

  • Number

    The open value for this bar.

  • Bar

    The bar before this one in the chart.

  • Number

    The volume value for this bar.

Indicator Reference

Momentum Indicators adxAverage Directional Movement IndexLearn more about Average Directional Movement Index at tadoc.org.
  • timePeriod
adxrAverage Directional Movement Index RatingLearn more about Average Directional Movement Index Rating at tadoc.org.
  • timePeriod
apoAbsolute Price OscillatorLearn more about Absolute Price Oscillator at tadoc.org.
  • fastPeriod
  • slowPeriod
  • maType
aroonAroonLearn more about Aroon at tadoc.org.
  • timePeriod
  • aroonDown
  • aroonUp
  • aroonDown
aroonoscAroon OscillatorLearn more about Aroon Oscillator at tadoc.org.
  • timePeriod
bopBalance Of PowerLearn more about Balance Of Power at tadoc.org. cciCommodity Channel IndexLearn more about Commodity Channel Index at tadoc.org.
  • timePeriod
cmoChande Momentum OscillatorLearn more about Chande Momentum Oscillator at tadoc.org.
  • timePeriod
dxDirectional Movement IndexLearn more about Directional Movement Index at tadoc.org.
  • timePeriod
imiIntraday Momentum IndexLearn more about Intraday Momentum Index at tadoc.org.
  • timePeriod
macdMoving Average Convergence/DivergenceLearn more about Moving Average Convergence/Divergence at tadoc.org.
  • fastPeriod
  • slowPeriod
  • signalPeriod
  • macd
  • signal
  • histogram
  • macd
macdextMACD with controllable MA typeLearn more about MACD with controllable MA type at tadoc.org.
  • fastPeriod
  • fastMAType
  • slowPeriod
  • slowMAType
  • signalPeriod
  • signalMAType
  • macd
  • signal
  • histogram
  • macd
macdfixMoving Average Convergence/Divergence Fix 12/26Learn more about Moving Average Convergence/Divergence Fix 12/26 at tadoc.org.
  • signalPeriod
  • macd
  • signal
  • histogram
  • macd
mfiMoney Flow IndexLearn more about Money Flow Index at tadoc.org.
  • timePeriod
minus_diMinus Directional IndicatorLearn more about Minus Directional Indicator at tadoc.org.
  • timePeriod
minus_dmMinus Directional MovementLearn more about Minus Directional Movement at tadoc.org.
  • timePeriod
momMomentumLearn more about Momentum at tadoc.org.
  • timePeriod
plus_diPlus Directional IndicatorLearn more about Plus Directional Indicator at tadoc.org.
  • timePeriod
plus_dmPlus Directional MovementLearn more about Plus Directional Movement at tadoc.org.
  • timePeriod
ppoPercentage Price OscillatorLearn more about Percentage Price Oscillator at tadoc.org.
  • fastPeriod
  • slowPeriod
  • maType
rocRate of change : ((price/prevPrice)-1)*100Learn more about Rate of change : ((price/prevPrice)-1)*100 at tadoc.org.
  • timePeriod
rocpRate of change Percentage: (price-prevPrice)/prevPriceLearn more about Rate of change Percentage: (price-prevPrice)/prevPrice at tadoc.org.
  • timePeriod
rocrRate of change ratio: (price/prevPrice)Learn more about Rate of change ratio: (price/prevPrice) at tadoc.org.
  • timePeriod
rocr100Rate of change ratio 100 scale: (price/prevPrice)*100Learn more about Rate of change ratio 100 scale: (price/prevPrice)*100 at tadoc.org.
  • timePeriod
rsiRelative Strength IndexLearn more about Relative Strength Index at tadoc.org.
  • timePeriod
stochStochasticLearn more about Stochastic at tadoc.org.
  • fastKPeriod
  • slowKPeriod
  • slowKMAType
  • slowDPeriod
  • slowDMAType
  • slowK
  • slowD
  • slowK
stochfStochastic FastLearn more about Stochastic Fast at tadoc.org.
  • fastKPeriod
  • fastDPeriod
  • fastDMAType
  • fastK
  • fastD
  • fastK
stochrsiStochastic Relative Strength IndexLearn more about Stochastic Relative Strength Index at tadoc.org.
  • timePeriod
  • fastKPeriod
  • fastDPeriod
  • fastDMAType
  • fastK
  • fastD
  • fastK
trix1-day Rate-Of-Change (ROC) of a Triple Smooth EMALearn more about 1-day Rate-Of-Change (ROC) of a Triple Smooth EMA at tadoc.org.
  • timePeriod
ultoscUltimate OscillatorLearn more about Ultimate Oscillator at tadoc.org.
  • timePeriod1
  • timePeriod2
  • timePeriod3
willrWilliams' %RLearn more about Williams' %R at tadoc.org.
  • timePeriod
Overlap Studies accbandsAcceleration BandsLearn more about Acceleration Bands at tadoc.org.
  • timePeriod
  • upperBand
  • middleBand
  • lowerBand
  • upperBand
bbandsBollinger BandsLearn more about Bollinger Bands at tadoc.org.
  • timePeriod
  • devUp
  • devDown
  • maType
  • upperBand
  • middleBand
  • lowerBand
  • upperBand
demaDouble Exponential Moving AverageLearn more about Double Exponential Moving Average at tadoc.org.
  • timePeriod
emaExponential Moving AverageLearn more about Exponential Moving Average at tadoc.org.
  • timePeriod
ht_trendlineHilbert Transform - Instantaneous TrendlineLearn more about Hilbert Transform - Instantaneous Trendline at tadoc.org. kamaKaufman Adaptive Moving AverageLearn more about Kaufman Adaptive Moving Average at tadoc.org.
  • timePeriod
maMoving averageLearn more about Moving average at tadoc.org.
  • timePeriod
  • maType
mamaMESA Adaptive Moving AverageLearn more about MESA Adaptive Moving Average at tadoc.org.
  • fastLimit
  • slowLimit
  • mama
  • fama
  • mama
mavpMoving average with variable periodLearn more about Moving average with variable period at tadoc.org.
  • minPeriod
  • maxPeriod
  • maType
midpointMidPoint over periodLearn more about MidPoint over period at tadoc.org.
  • timePeriod
midpriceMidpoint Price over periodLearn more about Midpoint Price over period at tadoc.org.
  • timePeriod
sarParabolic SARLearn more about Parabolic SAR at tadoc.org.
  • acceleration
  • maximum
sarextParabolic SAR - ExtendedLearn more about Parabolic SAR - Extended at tadoc.org.
  • startValue
  • offsetOnReverse
  • accelerationInitLong
  • accelerationLong
  • accelerationMaxLong
  • accelerationInitShort
  • accelerationShort
  • accelerationMaxShort
smaSimple Moving AverageLearn more about Simple Moving Average at tadoc.org.
  • timePeriod
t3Triple Exponential Moving Average (T3)Learn more about Triple Exponential Moving Average (T3) at tadoc.org.
  • timePeriod
  • vFactor
temaTriple Exponential Moving AverageLearn more about Triple Exponential Moving Average at tadoc.org.
  • timePeriod
trimaTriangular Moving AverageLearn more about Triangular Moving Average at tadoc.org.
  • timePeriod
wmaWeighted Moving AverageLearn more about Weighted Moving Average at tadoc.org.
  • timePeriod
Pattern Recognition cdl2crowsTwo CrowsLearn more about Two Crows at tadoc.org.
  • value
cdl3blackcrowsThree Black CrowsLearn more about Three Black Crows at tadoc.org.
  • value
cdl3insideThree Inside Up/DownLearn more about Three Inside Up/Down at tadoc.org.
  • value
cdl3linestrikeThree-Line Strike Learn more about Three-Line Strike at tadoc.org.
  • value
cdl3outsideThree Outside Up/DownLearn more about Three Outside Up/Down at tadoc.org.
  • value
cdl3starsinsouthThree Stars In The SouthLearn more about Three Stars In The South at tadoc.org.
  • value
cdl3whitesoldiersThree Advancing White SoldiersLearn more about Three Advancing White Soldiers at tadoc.org.
  • value
cdlabandonedbabyAbandoned BabyLearn more about Abandoned Baby at tadoc.org.
  • penetration
  • value
cdladvanceblockAdvance BlockLearn more about Advance Block at tadoc.org.
  • value
cdlbeltholdBelt-holdLearn more about Belt-hold at tadoc.org.
  • value
cdlbreakawayBreakawayLearn more about Breakaway at tadoc.org.
  • value
cdlclosingmarubozuClosing MarubozuLearn more about Closing Marubozu at tadoc.org.
  • value
cdlconcealbabyswallConcealing Baby SwallowLearn more about Concealing Baby Swallow at tadoc.org.
  • value
cdlcounterattackCounterattackLearn more about Counterattack at tadoc.org.
  • value
cdldarkcloudcoverDark Cloud CoverLearn more about Dark Cloud Cover at tadoc.org.
  • penetration
  • value
cdldojiDojiLearn more about Doji at tadoc.org.
  • value
cdldojistarDoji StarLearn more about Doji Star at tadoc.org.
  • value
cdldragonflydojiDragonfly DojiLearn more about Dragonfly Doji at tadoc.org.
  • value
cdlengulfingEngulfing PatternLearn more about Engulfing Pattern at tadoc.org.
  • value
cdleveningdojistarEvening Doji StarLearn more about Evening Doji Star at tadoc.org.
  • penetration
  • value
cdleveningstarEvening StarLearn more about Evening Star at tadoc.org.
  • penetration
  • value
cdlgapsidesidewhiteUp/Down-gap side-by-side white linesLearn more about Up/Down-gap side-by-side white lines at tadoc.org.
  • value
cdlgravestonedojiGravestone DojiLearn more about Gravestone Doji at tadoc.org.
  • value
cdlhammerHammerLearn more about Hammer at tadoc.org.
  • value
cdlhangingmanHanging ManLearn more about Hanging Man at tadoc.org.
  • value
cdlharamiHarami PatternLearn more about Harami Pattern at tadoc.org.
  • value
cdlharamicrossHarami Cross PatternLearn more about Harami Cross Pattern at tadoc.org.
  • value
cdlhighwaveHigh-Wave CandleLearn more about High-Wave Candle at tadoc.org.
  • value
cdlhikkakeHikkake PatternLearn more about Hikkake Pattern at tadoc.org.
  • value
cdlhikkakemodModified Hikkake PatternLearn more about Modified Hikkake Pattern at tadoc.org.
  • value
cdlhomingpigeonHoming PigeonLearn more about Homing Pigeon at tadoc.org.
  • value
cdlidentical3crowsIdentical Three CrowsLearn more about Identical Three Crows at tadoc.org.
  • value
cdlinneckIn-Neck PatternLearn more about In-Neck Pattern at tadoc.org.
  • value
cdlinvertedhammerInverted HammerLearn more about Inverted Hammer at tadoc.org.
  • value
cdlkickingKickingLearn more about Kicking at tadoc.org.
  • value
cdlkickingbylengthKicking - bull/bear determined by the longer marubozuLearn more about Kicking - bull/bear determined by the longer marubozu at tadoc.org.
  • value
cdlladderbottomLadder BottomLearn more about Ladder Bottom at tadoc.org.
  • value
cdllongleggeddojiLong Legged DojiLearn more about Long Legged Doji at tadoc.org.
  • value
cdllonglineLong Line CandleLearn more about Long Line Candle at tadoc.org.
  • value
cdlmarubozuMarubozuLearn more about Marubozu at tadoc.org.
  • value
cdlmatchinglowMatching LowLearn more about Matching Low at tadoc.org.
  • value
cdlmatholdMat HoldLearn more about Mat Hold at tadoc.org.
  • penetration
  • value
cdlmorningdojistarMorning Doji StarLearn more about Morning Doji Star at tadoc.org.
  • penetration
  • value
cdlmorningstarMorning StarLearn more about Morning Star at tadoc.org.
  • penetration
  • value
cdlonneckOn-Neck PatternLearn more about On-Neck Pattern at tadoc.org.
  • value
cdlpiercingPiercing PatternLearn more about Piercing Pattern at tadoc.org.
  • value
cdlrickshawmanRickshaw ManLearn more about Rickshaw Man at tadoc.org.
  • value
cdlrisefall3methodsRising/Falling Three MethodsLearn more about Rising/Falling Three Methods at tadoc.org.
  • value
cdlseparatinglinesSeparating LinesLearn more about Separating Lines at tadoc.org.
  • value
cdlshootingstarShooting StarLearn more about Shooting Star at tadoc.org.
  • value
cdlshortlineShort Line CandleLearn more about Short Line Candle at tadoc.org.
  • value
cdlspinningtopSpinning TopLearn more about Spinning Top at tadoc.org.
  • value
cdlstalledpatternStalled PatternLearn more about Stalled Pattern at tadoc.org.
  • value
cdlsticksandwichStick SandwichLearn more about Stick Sandwich at tadoc.org.
  • value
cdltakuriTakuri (Dragonfly Doji with very long lower shadow)Learn more about Takuri (Dragonfly Doji with very long lower shadow) at tadoc.org.
  • value
cdltasukigapTasuki GapLearn more about Tasuki Gap at tadoc.org.
  • value
cdlthrustingThrusting PatternLearn more about Thrusting Pattern at tadoc.org.
  • value
cdltristarTristar PatternLearn more about Tristar Pattern at tadoc.org.
  • value
cdlunique3riverUnique 3 RiverLearn more about Unique 3 River at tadoc.org.
  • value
cdlupsidegap2crowsUpside Gap Two CrowsLearn more about Upside Gap Two Crows at tadoc.org.
  • value
cdlxsidegap3methodsUpside/Downside Gap Three MethodsLearn more about Upside/Downside Gap Three Methods at tadoc.org.
  • value
Price Transform avgdevAverage DeviationLearn more about Average Deviation at tadoc.org.
  • timePeriod
avgpriceAverage PriceLearn more about Average Price at tadoc.org. medpriceMedian PriceLearn more about Median Price at tadoc.org. typpriceTypical PriceLearn more about Typical Price at tadoc.org. wclpriceWeighted Close PriceLearn more about Weighted Close Price at tadoc.org.
Statistic Functions betaBetaLearn more about Beta at tadoc.org.
  • timePeriod
correlPearson's Correlation Coefficient (r)Learn more about Pearson's Correlation Coefficient (r) at tadoc.org.
  • timePeriod
linearregLinear RegressionLearn more about Linear Regression at tadoc.org.
  • timePeriod
linearreg_angleLinear Regression AngleLearn more about Linear Regression Angle at tadoc.org.
  • timePeriod
linearreg_interceptLinear Regression InterceptLearn more about Linear Regression Intercept at tadoc.org.
  • timePeriod
linearreg_slopeLinear Regression SlopeLearn more about Linear Regression Slope at tadoc.org.
  • timePeriod
stddevStandard DeviationLearn more about Standard Deviation at tadoc.org.
  • timePeriod
  • dev
tsfTime Series ForecastLearn more about Time Series Forecast at tadoc.org.
  • timePeriod
varVarianceLearn more about Variance at tadoc.org.
  • timePeriod
  • dev
Volatility Indicators atrAverage True RangeLearn more about Average True Range at tadoc.org.
  • timePeriod
natrNormalized Average True RangeLearn more about Normalized Average True Range at tadoc.org.
  • timePeriod
trangeTrue RangeLearn more about True Range at tadoc.org.
Volume Indicators adChaikin A/D LineLearn more about Chaikin A/D Line at tadoc.org. adoscChaikin A/D OscillatorLearn more about Chaikin A/D Oscillator at tadoc.org.
  • fastPeriod
  • slowPeriod
obvOn Balance VolumeLearn more about On Balance Volume at tadoc.org.