
この戦略は,4つの異なる周期のSMMA ((スムーズ移動平均) と1つのEMA指標に基づく移動平均システムである.これは,複数の証券技術分析ツールを組み合わせて,トレンドを判断して取引戦略を形成する.この戦略は,主に高レバレッジ口座のEURUSD15分債券の日内取引に適用される.
この戦略は,4つの異なるパラメータのSMMA ((3,6,9,50) と1つのEMA ((200)) を使って,複数の階層の移動平均システムを構築する.SMMA指標は,市場の騒音を効果的にフィルターし,トレンドの方向を判断する.EMA指標は,長期のトレンドを検出する.具体的取引の論理は:
短周期移動平均 ((例えば3周期SMMA) の上に長い周期移動平均 ((例えば200周期EMA) を穿越すると買入シグナルが生じます。短周期移動平均の下の長い周期移動平均を穿越すると売り出せシグナルが生じます。このように複数の移動平均の並列関係を判断することでトレンドの方向が決定されます。
また,リスク管理のためにストップ・ストップ・ポイントを設定します.
この戦略の利点は以下の通りです.
多層移動平均構造は,トレンドの方向を効果的に判断し,偽信号を減らすことができます.
SMMA指数は市場のノイズを効果的にフィルターし,EMA指数は長線トレンドを検出する.
取引の利潤を拡大する高レバレッジ口座に適しています.
ストップ・ストラスト・ポイントを設定することで,リスクを効果的にコントロールできます.
取引品種 (EURUSD) と周期 (15分) を最適化して,より優位にしました.
この戦略には以下のリスクもあります.
移動平均を大量に使うと,短期的な反転の機会を逃してしまうかもしれない.
高利権は損失を大きくし,同時に利益も大きくする.
移動平均が信号を発する時には,短期的な動きは既に反転しているかもしれない.
ユーロ/米ドル (EUR/USD) の為替レートの変動は,より大きなリスクをもたらします.
これらのリスクに対して,レバレッジ倍数を適切に調整し,移動平均のパラメータを最適化し,市場の逆転を判断する他の指標を導入して最適化することができます.
この戦略の主要な最適化方向は以下の通りです.
各種と周期のパフォーマンスを評価し,最適なパラメータを選択します.
異なるパラメータの組み合わせと数値の移動平均をテストする.
取引量または変動率の指標を増加させ,短期的な転換点を判断する.
ストップ・ストップ・損失の幅を増加させる動的調整
ENUの指数判断の転換点に
多面的なテストと最適化によって,戦略の安定性と収益性を大幅に向上させることができます.
この移動平均戦略は均線指標の優位性を統合して,堅牢なトレンド判断システムを形成する.それは取引品種と周期を最適化し,高レバレッジの日内取引に適しています.パラメータ調整と最適化テストにより,この戦略は高効率で信頼性の高いアルゴリズム取引戦略になることができます.
/*backtest
start: 2023-10-24 00:00:00
end: 2023-11-23 00:00:00
period: 1h
basePeriod: 15m
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/
// © SoftKill21
//@version=4
strategy("Money maker EURUSD 15min" )
fromDay = input(defval = 1, title = "From Day", minval = 1, maxval = 31)
fromMonth = input(defval = 1, title = "From Month", minval = 1, maxval = 12)
fromYear = input(defval = 2000, title = "From Year", minval = 1970)
// To Date Inputs
toDay = input(defval = 1, title = "To Day", minval = 1, maxval = 31)
toMonth = input(defval = 8, title = "To Month", minval = 1, maxval = 12)
toYear = input(defval = 2021, title = "To Year", minval = 1970)
startDate = timestamp(fromYear, fromMonth, fromDay, 00, 00)
finishDate = timestamp(toYear, toMonth, toDay, 00, 00)
len = input(3, minval=1, title="Length")
src = input(hl2, title="Source")
smma = 0.0
sma1 = sma(src, len)
smma := na(smma[1]) ? sma1 : (smma[1] * (len - 1) + src) / len
len2 = input(6, minval=1, title="Length")
src2 = input(hl2, title="Source")
smma2 = 0.0
sma2 = sma(src2, len2)
smma2 := na(smma2[1]) ? sma2 : (smma2[1] * (len2 - 1) + src2) / len2
len3 = input(9, minval=1, title="Length")
src3 = input(hl2, title="Source")
smma3 = 0.0
sma3 = sma(src3, len3)
smma3 := na(smma3[1]) ? sma3 : (smma3[1] * (len3 - 1) + src3) / len3
len4 = input(50, minval=1, title="Length")
src4 = input(close, title="Source")
smma4 = 0.0
sma4 = sma(src4, len4)
smma4 := na(smma4[1]) ? sma4 : (smma4[1] * (len4 - 1) + src4) / len4
len5 = input(200, minval=1, title="Length")
src5 = input(close, title="Source")
out5 = ema(src5, len5)
timeinrange(res, sess) => time(res, sess) != 0
london=timeinrange(timeframe.period, "0300-1045")
londonEntry=timeinrange(timeframe.period, "0300-0845")
extraEntry =timeinrange(timeframe.period, "0745-1030")
time_cond = true
//time_cond2 = time >= startDate and time <= finishDate and extraEntry
//
longCond = close > out5 and close > smma4 and close > smma3 and close > smma2 and close > smma and smma > smma2 and smma2>smma3 and smma3>smma4 and smma4>out5 and time_cond
shortCond = close < out5 and close < smma4 and close < smma3 and close < smma2 and close < smma and smma < smma2 and smma2<smma3 and smma3<smma4 and smma4<out5 and time_cond
//longCond = close > out5 and close > smma4 and close > smma3 and close > smma2 and close > smma and smma > smma2 and smma2>smma3 and smma3>smma4 and smma4>out5 and time_cond2
//shortCond = close < out5 and close < smma4 and close < smma3 and close < smma2 and close < smma and smma < smma2 and smma2<smma3 and smma3<smma4 and smma4<out5 and time_cond2
//longCond2 = crossover(close,out5) and crossover(close,smma4) and crossover(close,smma3) and crossover(close,smma2) and crossover(close,smma) and time_cond
//shortCond2 = crossunder(close,out5) and crossunder(close,smma4) and crossunder(close,smma3) and crossunder(close,smma2) and crossunder(close,smma) and time_cond
tp=input(300,title="tp")
sl=input(300,title="sl")
strategy.initial_capital = 50000
//MONEY MANAGEMENT--------------------------------------------------------------
balance = strategy.netprofit + strategy.initial_capital //current balance
floating = strategy.openprofit //floating profit/loss
risk = input(1,type=input.float,title="Risk %")/100 //risk % per trade
//Calculate the size of the next trade
temp01 = balance * risk //Risk in USD
temp02 = temp01/sl //Risk in lots
temp03 = temp02*100000 //Convert to contracts
size = temp03 - temp03%1000 //Normalize to 1000s (Trade size)
if(size < 1000)
size := 1000 //Set min. lot size
dataL = (close-out5)*100000
dataS = (out5-close)*100000
minDistanceL = (smma4 - out5)*100000
minDistanceS= (out5 - smma4)*100000
strategy.entry("long",1,1,when=longCond )
strategy.exit("closelong","long", profit=tp,loss=sl)
strategy.entry("short",0,1,when=shortCond )
strategy.exit("closeshort","short", profit=tp,loss=sl)
strategy.close_all(when = not london, comment="london finish")
//strategy.close_all(when = not extraEntry, comment="london finish")
// maxEntry=input(2,title="max entries")
// strategy.risk.max_intraday_filled_orders(maxEntry)