Overview
This node executes various trend trading strategies on financial OHLCV (Open, High, Low, Close, Volume) data using the indicatorts library. It analyzes historical price and volume data to generate trading signals such as BUY, SELL, or HOLD based on selected technical indicators. This is useful for traders and analysts who want to automate or backtest trading strategies within their workflows.
Common scenarios include:
- Backtesting different trend strategies on historical market data.
- Generating actionable trading signals for algorithmic trading.
- Analyzing market trends with multiple technical indicators to inform manual trading decisions.
For example, a user can input OHLCV data from a cryptocurrency exchange and select the MACD strategy to receive buy/sell signals based on Moving Average Convergence Divergence analysis.
Properties
| Name | Meaning |
|---|---|
| Strategy | The trend strategy to apply. Options: Absolute Price Oscillator, Aroon, Balance of Power, Chande Forecast Oscillator, KDJ, MACD, Parabolic SAR, Typical Price, Vortex, VWMA. |
| OHLCV Data | JSON string containing an array of OHLCV data points. Each data point is expected to be an array with at least open, high, low, close, and optionally volume values. |
| Date Data | JSON string containing an array of dates corresponding to the OHLCV data points. Optional; if not provided, dates are generated based on current date minus index days. |
| APO Fast Period | Fast period parameter for Absolute Price Oscillator strategy (only shown if that strategy is selected). |
| APO Slow Period | Slow period parameter for Absolute Price Oscillator strategy. |
| Aroon Period | Period parameter for Aroon indicator strategy. |
| KDJ R Period | R period parameter for KDJ indicator strategy. |
| KDJ K Period | K period parameter for KDJ indicator strategy. |
| KDJ D Period | D period parameter for KDJ indicator strategy. |
| MACD Fast Period | Fast period parameter for MACD strategy. |
| MACD Slow Period | Slow period parameter for MACD strategy. |
| MACD Signal Period | Signal period parameter for MACD strategy. |
| PSAR Step | Step value parameter for Parabolic SAR strategy. |
| PSAR Max | Maximum value parameter for Parabolic SAR strategy. |
| Vortex Period | Period parameter for Vortex indicator strategy. |
| VWMA Period | Period parameter for Volume Weighted Moving Average strategy. |
| Options > Return Type | Determines output format: "Actions Only" returns just BUY/SELL/HOLD signals; "With Metadata" includes additional analysis metadata. |
| Options > Include Gains Calculation | If enabled (and Return Type is "With Metadata"), calculates and includes gains based on the generated actions. |
Output
The node outputs an array of JSON objects, each representing the result of applying the selected strategy to the input data. Each output object contains:
strategy: The name of the applied strategy.parameters: The parameters used for the strategy calculation.actions: An array of action strings ("BUY", "SELL", "HOLD") corresponding to each data point.actionValues: The raw action values as returned by the underlying indicator library (numeric or enum values).- If "With Metadata" return type is selected:
metadata: Object containing summary statistics such as total actions, counts and percentages of each signal type, input length, and timestamp.- If gains calculation is enabled:
gains: Array of calculated gains over time based on the actions.totalGain: Final cumulative gain value.
- If gains calculation fails,
gainsErrorcontains the error message.
The node does not output binary data.
Dependencies
- Requires the
indicatortslibrary for technical indicator calculations. - Input data must be provided as JSON strings representing arrays of OHLCV data and optionally dates.
- No external API keys or credentials are required.
- Runs entirely within n8n environment without external service calls.
Troubleshooting
- Failed to parse OHLCV data: Ensure the OHLCV input is a valid JSON string representing a non-empty array of arrays with correct numeric values.
- Unsupported strategy: Verify the selected strategy matches one of the supported options.
- Date parsing warnings: If date data is invalid or missing, the node defaults to generating dates based on current date minus index days.
- Gains calculation errors: If enabled, gains calculation may fail due to inconsistent data; check input data integrity.
- Use "Continue On Fail" option in n8n to handle errors gracefully during batch processing.
Links and References
- indicatorts GitHub repository — Source of the technical indicator implementations used.
- Technical indicator references:
- MACD
- Parabolic SAR
- Aroon Indicator
- Others can be found via standard technical analysis resources.