This strategy combines multiple technical indicators to generate more precise and reliable trading signals. It consists of two parts: the first part uses 123 reversal strategy, and the second part uses TEMA indicator. The trading signals generated by both are combined to filter out wrong signals and improve signal quality.
The first part uses 123 reversal strategy. It is based on the stochastic indicator. When the closing price shows reversal for two consecutive days (e.g. turning from rise to fall), and the stochastic indicator shows overbought or oversold signal, it generates buy or sell signals.
Specifically, when the closing price is higher than the previous day’s and the stochastic slow line is below 50, it generates a buy signal. When the closing price is lower than the previous day’s and the stochastic fast line is above 50, it generates a sell signal.
The second part uses the TEMA indicator. TEMA stands for Triple Exponential Moving Average, and is calculated as:
TEMA = 3EMA(CLOSE, N) - 3EMA(EMA(CLOSE, N), N) + EMA(EMA(EMA(CLOSE, N), N), N)
Where N is the parameter length. If closing price is above TEMA value, it generates a buy signal. If closing price is below TEMA value, it generates a sell signal.
Finally, the signals from the two indicators are combined. Only when both indicators generate consistent signals (both buy or both sell), actual trading signals are generated.
This strategy improves signal quality through reasonable combination of multiple indicators, making it a very effective quantitative trading strategy. But risk management is still needed, like fine tuning parameters or adding other components for optimization, so that the strategy can keep stable performance across different markets.
/*backtest start: 2023-09-29 00:00:00 end: 2023-10-06 00:00:00 period: 45m basePeriod: 5m exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}] */ //@version=4 //////////////////////////////////////////////////////////// // Copyright by HPotter v1.0 24/11/2021 // This is combo strategies for get a cumulative signal. // // First strategy // This System was created from the Book "How I Tripled My Money In The // Futures Market" by Ulf Jensen, Page 183. This is reverse type of strategies. // The strategy buys at market, if close price is higher than the previous close // during 2 days and the meaning of 9-days Stochastic Slow Oscillator is lower than 50. // The strategy sells at market, if close price is lower than the previous close price // during 2 days and the meaning of 9-days Stochastic Fast Oscillator is higher than 50. // // Second strategy // This study plots the TEMA1 indicator. TEMA1 ia s triple MA (Moving Average), // and is calculated as 3*MA - (3*MA(MA)) + (MA(MA(MA))) // // WARNING: // - For purpose educate only // - This script to change bars colors. //////////////////////////////////////////////////////////// Reversal123(Length, KSmoothing, DLength, Level) => vFast = sma(stoch(close, high, low, Length), KSmoothing) vSlow = sma(vFast, DLength) pos = 0.0 pos := iff(close[2] < close[1] and close > close[1] and vFast < vSlow and vFast > Level, 1, iff(close[2] > close[1] and close < close[1] and vFast > vSlow and vFast < Level, -1, nz(pos[1], 0))) pos TEMA(Length) => pos = 0.0 xPrice = close xEMA1 = ema(xPrice, Length) xEMA2 = ema(xEMA1, Length) xEMA3 = ema(xEMA2, Length) nRes = 3 * xEMA1 - 3 * xEMA2 + xEMA3 pos := iff(close > nRes, 1, iff(close < nRes, -1, nz(pos[1], 0))) pos strategy(title="Combo Backtest 123 Reversal & TEMA1", shorttitle="Combo", overlay = true) line1 = input(true, "---- 123 Reversal ----") Length = input(14, minval=1) KSmoothing = input(1, minval=1) DLength = input(3, minval=1) Level = input(50, minval=1) //------------------------- line2 = input(true, "---- TEMA1 ----") LengthTEMA = input(26, minval=1) reverse = input(false, title="Trade reverse") posReversal123 = Reversal123(Length, KSmoothing, DLength, Level) posT3A = TEMA(LengthTEMA) pos = iff(posReversal123 == 1 and posT3A == 1 , 1, iff(posReversal123 == -1 and posT3A == -1, -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) if (possig == 0) strategy.close_all() barcolor(possig == -1 ? #b50404: possig == 1 ? #079605 : #0536b3 )