LSTM model
1. Node overview
LSTM (Long Short-Term Memory) is a recurrent neural-network architecture designed specifically to learn long-term dependencies in time-series data. Its gating mechanism addresses the vanishing-gradient problem found in conventional RNNs and retains information over long time spans. The LSTM model node performs sequence modelling on factor data from the data-processing node and outputs predictions for the strategy node.
Captures long-term temporal dependencies
Learns time-series features automatically
Handles variable-length sequence inputs
Can be trained without a GPU
Price-trend forecasting
Trend recognition and classification
Sequence-pattern learning
Time-series factor extraction
Moderate training and inference speed
Sensitive to hyperparameter tuning
Requires substantial historical data
2. Interactive configuration
The panel below is the actual LSTM model node configuration. Use it to explore every setting: prediction column name, task type, and parameter configuration mode (adaptive or advanced).
Only A-Z, a-z, 0-9, - and _ are supported; other characters are replaced with _.
Name of the model prediction output column.
2.1 Prediction column name
Set the name of the column that stores model predictionspred.pred_lstm and pred_lgb, so the strategy can distinguish them.2.2 Task type
Select the model's training objective and loss functionRanking, Binary, and Regression. LightGBM, LSTM, and Transformer default to Binary; switch explicitly to Ranking only for cross-sectional selection across multiple instruments.| Dimension | Ranking | Binary ⭐ | Regression |
|---|---|---|---|
| Primary objective | Learn relative order | Classify upward or downward direction | Predict an exact return |
| Noise robustness | ⭐⭐⭐ | ⭐⭐⭐⭐ | ⭐⭐ |
| Generalization | ⭐⭐⭐ | ⭐⭐⭐⭐ | ⭐⭐ |
| Sensitivity to outliers | Medium | Low (inherently resistant) | High |
| Fit for cryptocurrency | Multi-asset selection | Best for single-asset timing | Position-management support |
| Typical strategy | Long/short hedge or ranked selection | Trend timing or enhanced grid | Dynamic positions or risk control |
2.2.1 Ranking
Learn relative order among samples; suitable for multi-factor asset selectionRanking does not optimize the absolute prediction value. It learns relative order among samples, placing higher-return samples ahead of lower-return samples. In multi-asset cryptocurrency strategies, it can select the instruments with the greatest upside potential from dozens of pairs and is the primary driver of cross-sectional selection strategies.
| Property | Description |
|---|---|
| Label requirement | A continuous value such as return: shift(close, -5) / shift(open, -1) - 1 |
| Output range | Any real number; a larger score ranks higher |
| Use cases | Multi-factor selection, cross-sectional ranking, and long/short hedging |
| Frontend field | taskType: "ranking" |
Selecting Ranking reveals the ranking-mode option, which determines where optimization is concentrated:
2.2.2 Binary ⭐ Recommended
Predict upward or downward direction; the first choice for cryptocurrency timingBinary classification turns forecasting into an up-or-down decision. The model outputs signed confidence with a theoretical range of -1 to 1: positive is bullish, negative is bearish, and a greater absolute value means higher confidence. Because cryptocurrency has high volatility and a low signal-to-noise ratio, actual predictions usually cluster around -0.1 to 0.1; theoretical values near ±1 are almost never seen. Begin machine-learning models with entry thresholds around 0.03 / -0.03, inspect the prediction distribution after the first backtest, and recalibrate. Do not start from theoretical thresholds such as 0.2 or 0.5, which may trigger extremely rarely or never. Direction still has a much better signal-to-noise ratio than magnitude, making Binary the most practical task.
| Property | Description |
|---|---|
| Label requirement | A Boolean value or continuous return; continuous values are converted to 0/1 using > 0 |
| Output range | Theoretical -1 to 1 confidence; generally -0.1 to 0.1 in practice because financial signal-to-noise is low |
| Use cases | Direction forecasting, timing signals, and trend classification |
| Frontend field | taskType: "binary" (system default) |
label = shift(close, -5) / shift(open, -1) - 1 means buying at the next candlestick's open and selling five periods later. The engine converts returns > 0 to positive class 1 and returns ≤ 0 to negative class 0.Binary output is signed confidence in the range -1 to 1: confidence = 2 × probability - 1.
| Probability | 30% | 40% | 50% | 55% | 60% |
|---|---|---|---|---|---|
| Confidence | -0.4 | -0.2 | 0 | 0.1 | 0.2 |
Strategy example: pred > 0.2 opens a long position (60% bullish probability), while pred < -0.2 closes it (only 40% bullish probability).
2.2.3 Regression
Predict an exact return and optimize absolute accuracyRegression requires the model to predict an exact return value. Unlike Ranking, it minimizes the absolute error between prediction and target. Frequent extreme cryptocurrency moves, such as flash crashes and sudden rallies, can dominate regression training, so generalization is often weaker than Binary. The output nevertheless has a clear physical meaning and is useful as an auxiliary signal for position sizing and risk control.
| Property | Description |
|---|---|
| Label requirement | A continuous return such as shift(close, -5) / shift(open, -1) - 1 |
| Output range | Any real number representing predicted return |
| Use cases | Position sizing, risk assessment, and expected-return calibration |
| Frontend field | taskType: "regression" |
2.3 Parameter configuration mode
Choose system-adaptive or manually configured parametersAdaptive mode, which tunes parameters from the data size, and Advanced parameter configuration, which exposes every model parameter. Adaptive mode is the default and is suitable for new users and rapid strategy validation.2.3.1 Adaptive mode
The system chooses parameters automatically from the data sizeThe system calculates model parameters from the number of training samples and features. This is suitable for new users and rapid strategy validation and does not require detailed knowledge of LSTM model parameters.
No tuning experience required
Start training quickly
Lower overfitting risk
No fine-grained model control
Parameters may not be optimal
2.3.2 Advanced parameter configuration
Configure every parameter manually for fine-grained tuningAdvanced mode displays the full panel in three parts: model architecture, training parameters, and regularization. It is intended for experienced users performing detailed tuning.
These parameters control the complexity of the LSTM network. Larger hidden states and more layers produce a more complex model, but also increase the risk of overfitting. Leave a field blank to let the system calculate it adaptively.
| Parameter | Allowed range | Adaptive range | Description |
|---|---|---|---|
| Sequence length | 3–360 | 7–30 | Length of the input time-series window |
| Hidden size | 8–512 | 32–256 | Dimension of the LSTM hidden state |
| LSTM layers | 1–6 | Fixed at 2 | Number of stacked LSTM layers |
These parameters control model training. A smaller learning rate requires more epochs, but usually produces better results.
| Parameter | Default | Allowed range | Description |
|---|---|---|---|
| Epochs | Adaptive | 1–500 | Training iterations; SWA is disabled below 2 epochs |
| Learning rate | Adaptive | 0.00001–0.01 | Gradient update step size |
| Validation split | 0.2 | 0–0.5 | Used for early stopping; 0 disables validation |
| Early-stopping patience | 7 | 1–50 | Stop after N epochs without improvement |
| Batch size | Adaptive | 1–2048 | Number of samples per batch |
Regularization prevents overfitting. Higher dropout applies stronger regularization and produces a simpler model. Leave a field blank to let the system calculate it adaptively.
| Parameter | Allowed range | Adaptive range | Description |
|---|---|---|---|
| Sample dropout | 0–0.6 | 0.10–0.25 | Random dropout ratio along the time dimension |
| Feature dropout | 0–0.5 | 0.10–0.25 | Random dropout ratio along the feature dimension |
3. Output data structure
The LSTM model node adds a prediction column to its input data and returns the following structure:
| Column | Type | Source | Description |
|---|---|---|---|
| datetime | datetime | Passed through | Timestamp |
| symbol | string | Passed through | Trading pair |
| open/high/low/close/volume | float | Passed through | Raw OHLCV data |
| [factor columns…] | float | Passed through | Factors calculated by the data-processing node |
| pred | float | Added | Model prediction; the name is controlled by predictionColumn |