Type/to search

Full Crypto Swing ALMA Cross MACD Quantitative Strategy

Common strategy
Created: 2023-12-05 10:24:34
Last modified: 3 years ago
1
Follow
1802
Followers

img

Overview

This strategy is based on the golden cross and dead cross signals of the double ALMA moving average lines, combined with the long and short signals of the MACD indicator, to achieve automatic long and short positions. The strategy is suitable for time frames of 4 hours or more, and the test data is BNB/USDT ranging from 2017 to the present, with a commission rate set at 0.03%.

Strategy Principle

The strategy uses fast and slow lines constructed from the ALMA to build the double moving average. The fast line length is 20 and the slow line is 40, both adopting an offset of 0.9 and a standard deviation of 5. When the fast line crosses over the slow line, a long signal is generated. When the fast line crosses below the slow line, a short signal is generated.

At the same time, the strategy incorporates the histogram signal of the MACD indicator. Only when the MACD histogram is positive (rising), the long signal is valid; only when the MACD histogram is negative (falling), the short signal is valid.

The strategy also sets take profit and stop loss conditions. The long take profit is 2 times and the stop loss is 0.2 times; the short take profit is 0.05 times and the stop loss is 1 time.

Advantage Analysis

The strategy combines the trend judgment of the double moving average and the energy judgment of the MACD indicator, which can effectively filter false signals and improve the accuracy of entry. The take profit and stop loss settings are reasonable to maximize locking in profits and avoid huge losses.

The backtest data is adopted since 2017, covering multiple bulls and bears conversion cycles. The strategy still performs well across periods. This proves that the strategy adapts to both the linearity and non-linearity characteristics of the market.

Risk Analysis

The strategy has the following risks:

  1. The double moving average itself has lagging effect, possibly missing short-term opportunities
  2. When the MACD histogram is zero, the strategy will not generate signals
  3. The take profit and stop loss ratios are preset, may deviate from the actual market

Solutions:

  1. Appropriately shorten the moving average cycle to improve sensitivity to the short term
  2. Optimize MACD parameters to make the histogram fluctuation more frequent
  3. Dynamically adjust the take profit and stop loss settings

Optimization Directions

The strategy can also be optimized in the following aspects:

  1. Try different types of moving averages to find better smoothing effects
  2. Optimize parameters of moving averages and MACD to fit different products and cycles
  3. Add additional conditions such as trading volume changes to filter signals
  4. Adjust take profit and stop loss ratios in real time for better adaptability

Conclusion

The strategy successfully combines the trend judgment of moving averages and the auxiliary judgment of MACD, and sets reasonable take profits and stop losses, which can obtain stable returns in various market conditions. The stability and profitability of the strategy can be further enhanced by continuous optimization of parameter settings, adding additional filtering conditions, etc.

Source
Pine
/*backtest
start: 2023-11-04 00:00:00
end: 2023-12-04 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © exlux99

//@version=4
Strategy parameters
Strategy parameters
From Day
From Month
From Year
To Day
To Month
To Year
Use Heikin Ashi Candles in Algo Calculations
Length Size Fast
Length Size Slow
Offset
Sigma
Fast Length
Slow Length
Signal Smoothing
takeProfit_long
stopLoss_long
takeProfit_short
stopLoss_short
Comment
All comments (0)
No data
No data
  • 1
Forums
PINE Language
Get the app
iPhone Download
© 2015 - ∞ INVENTOR PTE LTD (SG)