Trend Indicators icon

Trend Indicators

Calculate trend indicators using the indicatorts library

Overview

This node calculates various trend indicators based on OHLCV (Open, High, Low, Close, Volume) financial data. It supports a wide range of technical analysis indicators commonly used in trading and market analysis to identify trends, momentum, volatility, and potential reversals.

Typical use cases include:

  • Enhancing trading strategies by adding calculated indicators like Moving Averages, MACD, ADX, etc.
  • Analyzing historical price data to detect trend strength or changes.
  • Generating signals for automated trading bots or alerts.
  • Visualizing indicator values alongside price charts.

For example, a trader might input OHLCV data from a cryptocurrency exchange and calculate the Simple Moving Average (SMA) and Moving Average Convergence Divergence (MACD) to decide entry and exit points.

Properties

Name Meaning
Indicators Select one or more trend indicators to calculate. Options include: Absolute Price Oscillator, Aroon, Average Directional Index, Balance of Power, Chande Forecast Oscillator, Community Channel Index, DEMA, EMA, Mass Index, MACD, Moving Max, Moving Min, Moving Sum, Parabolic SAR, Qstick, Random Index (KDJ), Rolling Moving Average, SMA, Since, TRIMA, TRIX, TEMA, Typical Price, VWMA, Vortex. Default is Simple Moving Average.
OHLCV Data JSON string containing an array of OHLCV data points. Each data point should be an array with at least 5 elements representing Open, High, Low, Close, and Volume respectively. Default is taken from input JSON's ohlcv field.
APO Fast Period Fast EMA period for Absolute Price Oscillator calculation (default 12). Shown only if APO indicator selected.
APO Slow Period Slow EMA period for Absolute Price Oscillator calculation (default 26). Shown only if APO indicator selected.
ADX Period Period length for Average Directional Index calculation (default 14). Shown only if ADX indicator selected.
Aroon Period Period length for Aroon indicator calculation (default 14). Shown only if Aroon indicator selected.
CCI Period Period length for Community Channel Index calculation (default 20). Shown only if CCI indicator selected.
DEMA Period Period length for Double Exponential Moving Average calculation (default 20). Shown only if DEMA indicator selected.
EMA Period Period length for Exponential Moving Average calculation (default 20). Shown only if EMA indicator selected.
Mass Index EMA Period EMA period for Mass Index calculation (default 9). Shown only if Mass Index indicator selected.
Mass Index Period Period length for Mass Index calculation (default 25). Shown only if Mass Index indicator selected.
MACD Fast Period Fast period for MACD calculation (default 12). Shown only if MACD indicator selected.
MACD Slow Period Slow period for MACD calculation (default 26). Shown only if MACD indicator selected.
MACD Signal Period Signal period for MACD calculation (default 9). Shown only if MACD indicator selected.
Moving Max Period Period length for Moving Max calculation (default 20). Shown only if Moving Max indicator selected.
Moving Min Period Period length for Moving Min calculation (default 20). Shown only if Moving Min indicator selected.
Moving Sum Period Period length for Moving Sum calculation (default 20). Shown only if Moving Sum indicator selected.
PSAR Step Step value for Parabolic SAR calculation (default 0.02). Shown only if Parabolic SAR indicator selected.
PSAR Max Maximum value for Parabolic SAR calculation (default 0.2). Shown only if Parabolic SAR indicator selected.
Qstick Period Period length for Qstick calculation (default 10). Shown only if Qstick indicator selected.
KDJ R Period R period for Random Index (KDJ) calculation (default 9). Shown only if Random Index indicator selected.
KDJ K Period K period for Random Index (KDJ) calculation (default 3). Shown only if Random Index indicator selected.
KDJ D Period D period for Random Index (KDJ) calculation (default 3). Shown only if Random Index indicator selected.
RMA Period Period length for Rolling Moving Average calculation (default 14). Shown only if Rolling Moving Average indicator selected.
SMA Period Period length for Simple Moving Average calculation (default 20). Shown only if SMA indicator selected.
TRIMA Period Period length for Triangular Moving Average calculation (default 20). Shown only if TRIMA indicator selected.
TRIX Period Period length for Triple Exponential Average calculation (default 15). Shown only if TRIX indicator selected.
TEMA Period Period length for Triple Exponential Moving Average calculation (default 20). Shown only if TEMA indicator selected.
VWMA Period Period length for Volume Weighted Moving Average calculation (default 20). Shown only if VWMA indicator selected.
Vortex Period Period length for Vortex indicator calculation (default 14). Shown only if Vortex indicator selected.
Options.Return Type Choose output format: "Values Only" returns just the calculated indicator values; "With Metadata" includes additional metadata such as input length, number of indicators, and calculation timestamp. Default is "Values Only".

Output

The node outputs a JSON object with the following structure:

{
  "indicators": [
    {
      "indicator": "indicatorName",
      "parameters": { /* parameters used for this indicator */ },
      "result": [ /* array of calculated values or objects depending on indicator */ ]
    },
    ...
  ],
  "metadata": { /* optional, present if Return Type is 'With Metadata' */
    "inputLength": 123,
    "indicatorsCount": 2,
    "calculationTimestamp": "2024-06-01T12:34:56.789Z"
  }
}
  • indicators: An array where each element corresponds to one requested indicator.
    • indicator: The name of the indicator.
    • parameters: The parameters used for that indicator calculation.
    • result: The calculated values. This can be an array of numbers or objects depending on the indicator.
  • metadata (optional): Contains information about the input data length, how many indicators were calculated, and the timestamp of calculation.

The node does not output binary data.

Dependencies

  • Requires the indicatorts and technicalindicators JavaScript libraries for calculating the indicators.
  • Input data must be provided as a JSON string representing an array of OHLCV arrays.
  • No external API keys or services are required.
  • No special environment variables or n8n credentials needed.

Troubleshooting

  • Failed to parse OHLCV data: This error occurs if the input OHLCV data string is not valid JSON or not an array. Ensure the input is a correctly formatted JSON string representing an array of OHLCV data points.
  • OHLCV data must be a non-empty array: The node expects at least one OHLCV data point. Provide valid historical data.
  • Unsupported indicator: If an invalid or unsupported indicator name is specified, the node will throw an error. Verify the indicator names against the supported list.
  • Empty results or unexpected output: Check that the OHLCV data contains correct numeric values and that the periods set for indicators are appropriate relative to the data length.
  • If multiple indicators are selected, ensure all required parameters for each are properly configured.

Links and References

Discussion