本策略基于自适应移动平均指标(AIOMA)和加权移动平均指标(WMA)实现交易信号。它通过 AIOMA 和 WMA 的交叉来产生买入和卖出信号。
AIOMA-WMA 自适应交叉策略
该策略主要包含以下部分:
AIOMA 指标计算
WMA 指标计算
交易信号生成
交易逻辑
可以通过适当优化参数,设置止损点,或结合其他指标过滤来减少风险。
本策略整合 AIOMA 和 WMA 两个指标的优势,通过交叉产生交易信号。相比单一移动平均线,可以提高信号质量。通过参数优化、止损策略和波动性过滤等进一步完善,可以成为一个稳定可靠的交易系统。
/*backtest start: 2023-12-01 00:00:00 end: 2023-12-31 23:59:59 period: 1h basePeriod: 15m exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}] */ // This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © SDTA //@version=5 strategy("AIOMA-WMA Strategy", overlay=true) // Parametreler aioma_length = input(14, "AIOMA Length") wma_length = input(21, "WMA Length") // AIOMA hesaplama length1 = aioma_length ema1 = ta.ema(close, length1) length2 = aioma_length ema2 = ta.ema(ema1, length2) length3 = aioma_length ema3 = ta.ema(ema2, length3) length4 = aioma_length ema4 = ta.ema(ema3, length4) aioma = ta.ema(ema4, aioma_length) // WMA hesaplama wma = ta.wma(close, wma_length) // Kesişim kontrolü cross_up = ta.crossover(wma, aioma) cross_down = ta.crossunder(wma, aioma) // İşlem fonksiyonu enterTrade(dir, price, signalText, color) => if dir strategy.entry("Enter", strategy.long) label.new(x = bar_index, y = price, text = signalText, color = color, textcolor = color, style = label.style_label_up, size = size.small, tooltip = "Entry Signal") else if not dir strategy.entry("Exit", strategy.short) label.new(x = bar_index, y = price, text = signalText, color = color, textcolor = color, style = label.style_label_down, size = size.small, tooltip = "Exit Signal") // Long pozisyon girişi if cross_up enterTrade(true, low, "Buy Signal", color.green) // Short pozisyon girişi if cross_down enterTrade(false, high, "Sell Signal", color.red) // Pozisyon kapatma if cross_up and strategy.position_size > 0 strategy.close("Enter") if cross_down and strategy.position_size < 0 strategy.close("Exit") // Grafiğe plot plot(aioma, color=color.blue, linewidth=2, title="AIOMA") plot(wma, color=color.red, linewidth=2, title="WMA")