The core of this strategy is to implement breakout trading using adaptive moving averages and momentum indicators. Firstly, the strategy constructs adaptive moving averages with Heiken Ashi weighted average price and triple exponential smoothing; then, combined with momentum indicators, it judges breakout signals and makes trading decisions.
The strategy consists of three main parts:
Construction of adaptive moving averages. The strategy builds three adaptive moving averages using Heiken Ashi price and triple exponential smoothing. These moving averages can respond quickly to price changes.
Calculation of momentum indicators. The strategy uses the difference between triple exponential smoothing of prices as the momentum indicator. This indicator can highlight changes in price trends.
Moving average crossover as trading signals. When the fast moving average crosses over the slow one, a buy signal is generated. When the fast crosses below the slow one, a sell signal is generated.
By combining adaptive moving averages and momentum indicators, this strategy can quickly capture trend changes in prices and generate trading signals. The main advantages are:
This strategy integrates adaptive moving averages and momentum indicators to generate efficient trading signals by quickly responding to price changes. Through parameter tuning, it can be adaptive to different market environments. This is a very practical breakout trading strategy.
/*backtest start: 2024-01-20 00:00:00 end: 2024-02-19 00:00:00 period: 1h basePeriod: 15m exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}] */ //@version=5 strategy("YASIN Crossover Strategy", overlay=true) EMAlength = input(55, 'EMA LENGTH?') src = ohlc4 var float haOpen = na haOpen := na(haOpen[1]) ? src : (src + haOpen[1]) / 2 haC = (ohlc4 + haOpen + ta.highest(high, 1) + ta.lowest(low, 1)) / 4 EMA1 = ta.ema(haC, EMAlength) EMA2 = ta.ema(EMA1, EMAlength) EMA3 = ta.ema(EMA2, EMAlength) TMA1 = 3 * EMA1 - 3 * EMA2 + EMA3 EMA4 = ta.ema(TMA1, EMAlength) EMA5 = ta.ema(EMA4, EMAlength) EMA6 = ta.ema(EMA5, EMAlength) TMA2 = 3 * EMA4 - 3 * EMA5 + EMA6 IPEK = TMA1 - TMA2 YASIN = TMA1 + IPEK EMA7 = ta.ema(hlc3, EMAlength) EMA8 = ta.ema(EMA7, EMAlength) EMA9 = ta.ema(EMA8, EMAlength) TMA3 = 3 * EMA7 - 3 * EMA8 + EMA9 EMA10 = ta.ema(TMA3, EMAlength) EMA11 = ta.ema(EMA10, EMAlength) EMA12 = ta.ema(EMA11, EMAlength) TMA4 = 3 * EMA10 - 3 * EMA11 + EMA12 IPEK1 = TMA3 - TMA4 YASIN1 = TMA3 + IPEK1 t1 = time(timeframe.period, "0020-0030") // بررسی شرایط سیگنال خرید و فروش buyCondition = YASIN1 > YASIN and YASIN1[1] <= YASIN[1] sellCondition = YASIN1 < YASIN and YASIN1[1] >= YASIN[1] // اعمال سیگنال خرید و فروش strategy.entry("Buy", strategy.long, when = buyCondition) strategy.entry("Sell", strategy.short, when = sellCondition)template: strategy.tpl:40:21: executing "strategy.tpl" at <.api.GetStrategyListByName>: wrong number of args for GetStrategyListByName: want 7 got 6