资源加载中... loading...

SMI Ergodic Oscillator Momentum Trading Strategy

Author: ChaoZhang, Date: 2023-11-01 11:19:18
Tags:

img

Overview

This strategy builds a trend following system based on the Superior Momentum Index (SMI) and Ergodic Line, generating trading signals through the combination of fast and slow moving averages. It belongs to a high-frequency momentum trading system.

Strategy Logic

The strategy mainly utilizes the Superior Momentum Index (SMI) and Ergodic Line to construct trading signals.

The SMI measures the speed of price changes by calculating the difference between two exponential moving averages of different periods divided by the absolute difference. Its formula is:

SMI = (Fast EMA - Slow EMA) / Abs(Fast EMA - Slow EMA)

Where Fast EMA is the short-period EMA and Slow EMA is the long-period EMA.

By gauging the speed of price movements, SMI can determine the trend changes in the market. A cross above 0 suggests an uptrend while a cross below 0 signals a downtrend.

The Ergodic Line is an EMA of SMI, which generates trade signals. A cross above the Ergodic Line is a buy signal while a cross below is a sell signal.

By combining SMI and the Ergodic Line, the strategy forms a lag-free trend following system, making it a high-frequency momentum trading strategy.

Advantages

  1. Sensitive to trend changes based on price velocity.

  2. Ergodic Line filters fake signals from SMI, forming reliable trade signals.

  3. Clear buy/sell signals generated by the double rail structure.

  4. High trading frequency to capture fast price movements within trends.

  5. No lagging, able to capture turning points in a timely manner.

Risks

  1. Prone to frequent stop loss in ranging markets as a momentum system.

  2. Improper double rail settings may cause excessive trading due to frequent signals.

  3. Bad short-term parameter tuning can lead to excessive false signals.

  4. No consideration of major trend direction may lead to counter-trend trades.

  5. Strict stop loss rules must be followed, otherwise losses could mount.

To address the risks, the following aspects can be considered for optimization:

  1. Optimize double rail parameters to reduce false signals.

  2. Add trend filter to avoid counter-trend trades.

  3. Implement stop loss strategies to control single trade loss.

Optimization Directions

The strategy can be improved in the following aspects:

  1. Optimize fast and slow EMA parameters to find the optimal parameter combination.

  2. Test different price inputs like open, high, low prices etc.

  3. Incorporate machine learning algorithms to auto-optimize parameters.

  4. Add trend filters to avoid counter-trend trades.

  5. Implement stop loss strategies to strictly control single trade loss.

  6. Consider trading frequency and profit factor to prevent over-trading.

  7. Test applicability across different products to find the optimal asset.

  8. Explore combinations with other indicators to build a more comprehensive system.

Conclusion

The strategy constructs a lag-free trend following system using SMI and Ergodic Line, generating clear trade signals through the double rail structure. It belongs to a high-frequency momentum trading strategy. The advantage is quickly capturing trend changes while the disadvantages include over-trading and counter-trend trades. Improvements can be made through parameter optimization, stop loss, trend filters etc. to build a more robust quantitative trading system.


/*backtest
start: 2023-10-01 00:00:00
end: 2023-10-31 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=2
////////////////////////////////////////////////////////////
//  Copyright by HPotter v1.0 03/11/2017
// The SMI Ergodic Indicator is the same as the True Strength Index (TSI) developed by 
// William Blau, except the SMI includes a signal line. The SMI uses double moving averages 
// of price minus previous price over 2 time frames. The signal line, which is an EMA of the 
// SMI, is plotted to help trigger trading signals. Adjustable guides are also given to fine 
// tune these signals. The user may change the input (close), method (EMA), period lengths 
// and guide values.
// You can use in the xPrice any series: Open, High, Low, Close, HL2, HLC3, OHLC4 and ect...
//
// You can change long to short in the Input Settings
// WARNING:
// - For purpose educate only
// - This script to change bars colors.
////////////////////////////////////////////////////////////
strategy(title="SMI Ergodic Oscillator")
fastPeriod = input(4, minval=1)
slowPeriod = input(8, minval=1)
SmthLen = input(3, minval=1)
TopBand = input(0.5, step=0.1)
LowBand = input(-0.5, step=0.1)
reverse = input(false, title="Trade reverse")
// hline(0, color=gray, linestyle=dashed)
// hline(TopBand, color=red, linestyle=line)
// hline(LowBand, color=green, linestyle=line)
xPrice = close
xPrice1 = xPrice - xPrice[1]
xPrice2 = abs(xPrice - xPrice[1])
xSMA_R = ema(ema(xPrice1,fastPeriod),slowPeriod)
xSMA_aR = ema(ema(xPrice2, fastPeriod),slowPeriod)
xSMI = xSMA_R / xSMA_aR
xEMA_SMI = ema(xSMI, SmthLen)
pos = iff(xEMA_SMI < LowBand, -1,
	   iff(xEMA_SMI > TopBand, 1, nz(pos[1], 0))) 
possig = iff(reverse and pos == 1, -1,
          iff(reverse and pos == -1, 1, pos))	   
if (possig == 1) 
    strategy.entry("Long", strategy.long)
if (possig == -1)
    strategy.entry("Short", strategy.short)	   	    
barcolor(possig == -1 ? red: possig == 1 ? green : blue )  
plot(xSMI, color=green, title="Ergotic SMI")
plot(xEMA_SMI, color=red, title="SigLin")

More