この戦略は,典型的なEMAトレンド追跡戦略である.これは,速いEMAと遅いEMAの金叉を使用して,上向きのトレンドに入ることを判断し,速いEMAと遅いEMAの死叉を使用して,下向きのトレンドに入ることを判断し,それに応じて多空を行う.この戦略は,中長線のトレンドを追跡するより信頼性が高く,中長線のポジション取引に適している.
この戦略の核心的な論理は:
異なる速度のEMAを計算することで,市場のトレンドの変化を効果的に識別することができる.高速EMAは価格変化に敏感であり,新しいトレンドを早期に発見するのに役立ちます.遅いEMAは偽の信号をフィルターして,トレンドが確認されていることを確認できます.両者は協力して使用され,信頼性の高いトレンド判断システムを形成します.
2つのEMAが金叉が発生したときは,価格が継続的に上昇し始めることを示す,多方向を確立する;デッドフォークが発生したときは,価格が継続的に下落し始めることを示す,空白方向を確立する.急速なEMAの再デッドフォークによって,現在のポジションから退出し,損失を拡大しないように,時宜に止めてしまうことができる.
どう対処するか?
この戦略は,以下の側面から拡張され,最適化することができます.
機械学習の方法を使用してEMAパラメータを自動的に最適化し,パラメータの適応性を向上させる
波動率に基づく保有ポジションの調整を増やし,市場の波動性に応じてポジションを調整する
局所的な調整のタイミングを判断するポイント数振動指数などの組み合わせで,入場点位置を最適化します.
移動ストップを増やし,利益の後にストップポイントを調整するなど,ストップストップ戦略
資金の流入と流出を判断するための取引量の変化を研究し,トレンド判断を補助する
他の非関連戦略の組み合わせで,引き下がりを軽減し,全体的な利益の安定性を向上させる
EMAトレンド追跡戦略は,シンプルで実用的なトレンドフォロー戦略である.それは,EMA金叉死叉によって入場タイミングを判断するために,中長線トレンドを高速にEMAで追跡する.戦略は,実行しやすいが,多次元拡張と最適化によって,より多くの市場環境に適合させることができる.この戦略は,中長線ポジションを追跡する傾向的な行動に非常に適しています.
/*backtest
start: 2023-09-11 00:00:00
end: 2023-09-18 00:00:00
period: 10m
basePeriod: 1m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © HomoDeus666
//@version=5
strategy("EMA12/26 with date backtest range (BTCpair)", overlay=true,initial_capital = 1,commission_type = strategy.commission.percent,currency = currency.BTC)
//input date and time
useDateFilter = input.bool(true, title="Filter Date Range of Backtest",
group="Backtest Time Period")
backtestStartDate = input(timestamp("1 Jan 2021"),
title="Start Date", group="Backtest Time Period",
tooltip="This start date is in the time zone of the exchange " +
"where the chart's instrument trades. It doesn't use the time " +
"zone of the chart or of your computer.")
backtestEndDate = input(timestamp("1 Jan 2022"),
title="End Date", group="Backtest Time Period",
tooltip="This end date is in the time zone of the exchange " +
"where the chart's instrument trades. It doesn't use the time " +
"zone of the chart or of your computer.")
//check date and time option
inTradeWindow = true
/// plot and indicator
fastEMA = ta.ema(close,12), slowEMA=ta.ema(close,26)
plot(fastEMA,color=color.green,linewidth = 2)
plot(slowEMA,color=color.red,linewidth=2)
//entry when condition
longCondition = ta.crossover(fastEMA,slowEMA)
if (longCondition) and inTradeWindow
strategy.entry("buy", strategy.long)
if ta.crossunder(ta.ema(close, 12), ta.ema(close, 26)) and inTradeWindow
strategy.close("buy")
// trades and cancel all unfilled pending orders
if not inTradeWindow and inTradeWindow[1]
strategy.cancel_all()
strategy.close_all(comment="Date Range Exit")