这个策略结合了三重指数移动平均线(TEMA)和Fisher Transform这两个技术指标,通过识别趋势和动量信号来确定入场和出场时机。TEMA作为一种低延迟的趋势跟踪指标,能够有效识别市场趋势方向,而Fisher Transform通过将价格变化转换为高斯正态分布,提供了更清晰的动量信号。策略采用交叉信号作为交易触发条件,结合了趋势跟踪和动量分析的优势。
策略的核心逻辑建立在两个主要指标之上: 1. TEMA指标采用三重指数移动平均计算方法,通过”3×EMA - 3×EMA(EMA) + EMA(EMA(EMA))“的公式降低了传统移动平均线的滞后性,默认周期为21。 2. Fisher Transform指标将价格数据转换为正态分布,默认参数为10,通过对高低点价格进行标准化处理后应用对数变换,使得信号更加明确。
交易规则如下:
- 做多条件:价格上穿TEMA线且Fisher Transform上穿0轴
- 做空条件:价格下穿TEMA线且Fisher Transform下穿0轴
- 多单出场:价格下穿TEMA线或Fisher Transform下穿0轴
- 空单出场:价格上穿TEMA线或Fisher Transform上穿0轴
这是一个结合趋势和动量分析的完整交易策略,通过TEMA和Fisher Transform的配合使用,既保证了趋势跟踪能力,又提供了清晰的动量确认信号。策略设计合理,具有较好的实用性,但在实际应用中需要注意市场环境的适应性,并根据具体情况进行参数优化。通过建议的优化方向,策略的稳定性和可靠性还可以进一步提升。
/*backtest
start: 2024-02-21 00:00:00
end: 2025-02-19 00:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Binance","currency":"ETH_USDT"}]
*/
//@version=5
strategy("Triple EMA (TEMA) + Fisher Transform Strategy", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=10)
// ==== Triple EMA (TEMA) Settings ====
temaLength = input.int(21, title="TEMA Length", minval=1)
// Implementácia Triple EMA (TEMA)
// TEMA = 3 * EMA(close, length) - 3 * EMA(EMA(close, length), length) + EMA(EMA(EMA(close, length), length), length)
ema1 = ta.ema(close, temaLength)
ema2 = ta.ema(ema1, temaLength)
ema3 = ta.ema(ema2, temaLength)
tema = 3 * ema1 - 3 * ema2 + ema3
plot(tema, color=color.blue, title="TEMA")
// ==== Fisher Transform Settings ====
fisherLength = input.int(10, title="Fisher Length", minval=1)
fisherSmooth = input.int(1, title="Fisher Smoothing", minval=1) // Zvyčajne sa používa 1 alebo 2
// Výpočet Fisher Transform
// Krok 1: Normalizácia ceny
price = (high + low) / 2
maxPrice = ta.highest(price, fisherLength)
minPrice = ta.lowest(price, fisherLength)
value = 0.5 * (2 * ((price - minPrice) / (maxPrice - minPrice)) - 1)
value := math.min(math.max(value, -0.999), 0.999) // Orezanie hodnoty pre stabilitu
// Krok 2: Výpočet Fisher Transform
var float fisher = na
fisher := 0.5 * math.log((1 + value) / (1 - value)) + 0.5 * nz(fisher[1])
fisher := fisherSmooth > 1 ? ta.sma(fisher, fisherSmooth) : fisher
plot(fisher, color=color.red, title="Fisher Transform", linewidth=2)
// ==== Strategie Podmienky ====
// Long Condition: Cena prekročí TEMA smerom nahor a Fisher Transform prekročí 0 smerom nahor
longCondition = ta.crossover(close, tema) and ta.crossover(fisher, 0)
if (longCondition)
strategy.entry("Long", strategy.long)
// Short Condition: Cena prekročí TEMA smerom nadol a Fisher Transform prekročí 0 smerom nadol
shortCondition = ta.crossunder(close, tema) and ta.crossunder(fisher, 0)
if (shortCondition)
strategy.entry("Short", strategy.short)
// Exit Long Condition: Cena prekročí TEMA smerom nadol alebo Fisher Transform prekročí 0 smerom nadol
exitLong = ta.crossunder(close, tema) or ta.crossunder(fisher, 0)
if (exitLong)
strategy.close("Long")
// Exit Short Condition: Cena prekročí TEMA smerom nahor alebo Fisher Transform prekročí 0 smerom nahor
exitShort = ta.crossover(close, tema) or ta.crossover(fisher, 0)
if (exitShort)
strategy.close("Short")
// ==== Voliteľné: Vykreslenie Zero Line pre Fisher Transform ====
hline(0, "Zero Line", color=color.gray, linestyle=hline.style_dotted)