Type/to search

Price EMA with stochastic optimization based on machine learning

Common strategy
Created: 2024-01-26 14:57:08
Last modified: 3 years ago
1
Follow
1802
Followers

img

Overview

This strategy combines Smooth Moving Average with the Stochastic indicator to capture more opportunities in trends. It mainly uses two exponential moving averages with different periods to generate trading signals, together with the crossover of K line and D line in Stochastic indicator for entry timing selection, in order to obtain higher profitability in trends.

Strategy Principle

The strategy uses 12-period and 26-period smooth moving averages. When the fast line crosses above the slow line from the bottom, go long. When the fast line crosses below the slow line from the top, go short. To filter fake signals, it requires the fast and slow lines to be in the same direction, with the fast line above the slow line for long, and the fast line below the slow line for short.

The crossover of K line and D line in Stochastic indicator is used for entry timing selection. When K line crosses above D line from below the overbought line, go long. When K line crosses below D line from above the oversold line, go short.

Smooth moving average determines the trend direction, while Stochastic indicator filters Noise and selects entry timing. Their combination could obtain more profitable opportunities in trends.

Advantages of the Strategy

  • Smooth moving average itself has the characteristic of trend-following, easy to track trends
  • Utilize Stochastic to filter Noise and improve profitability
  • The combination of fast and slow MAs allows entering when fast MA pulls back to slow MA, obtaining better risk-reward
  • The crossover of K line and D line provides further timing optimization

Therefore, this strategy could follow the trend selectively to capture opportunities, obtaining higher profitability.

Risk Analysis

  • High risk of premature exit in the short term. Signals may be denied or trapped when fast MA pulls back to slow MA
  • As it follows the trend, it cannot adapt quickly to drastic trend reversal, leading to large loss

To reduce those risks, we could set stop loss, or adopt more moderate MA parameters.

Optimization Directions

The strategy could be further optimized from the follows aspects:

  1. Test different combinations of MA parameters to find the optimal
  2. Test different combinations of Stochastic parameters
  3. Add stop loss strategy
  4. Add dynamic stop loss based on volatility
  5. Test parameter optimization across different products and time frames
  6. Utilize machine learning algorithms to optimize parameters

By testing different parameter combinations, better parameters could be found. Also, stop loss strategies could effectively reduce risk and enhance stability.

Conclusion

The strategy integrates the strengths of Smooth Moving Average and Stochastic for trend-following, while selecting better entry timing. It is easy to operate, with controllable risk and great practical value. Its performance could be further improved through continuous testing and optimization. It provides quant traders an efficient and stable trend tracking model.

Source
Pine
/*backtest
start: 2024-01-18 00:00:00
end: 2024-01-25 00:00:00
period: 1m
basePeriod: 1m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=4
// author SoftKill

strategy(title="Price EMA with stock", shorttitle="EMA STOCH", overlay=true)
Strategy parameters
Strategy parameters
Source
Length
Source
len100
Source
Length
Source
length
OverBought
OverSold
Fast Length
Slow Length
Source
Signal Smoothing
Simple MA(Oscillator)
Simple MA(Signal Line)
tp
sl
Comment
All comments (0)
No data
No data
  • 1
Forums
PINE Language
Get the app
iPhone Download
© 2015 - ∞ INVENTOR PTE LTD (SG)