
이 전략은 4개의 서로 다른 주기 SMMA (Smooth Moving Average) 와 1개의 EMA 지표에 기반한 이동 평균 시스템이다. 이 전략은 여러 증권 기술 분석 도구를 결합하여 트렌드를 판단하여 거래 전략을 형성한다. 이 전략은 주로 높은 레버리지 계정의 EURUSD 15분 채권에 대해 일간 거래한다.
이 전략은 4개의 다른 변수인 SMMA ((3,6,9,50) 와 1개의 EMA ((200) 를 사용하여 다단계 이동 평균 시스템을 구축한다. SMMA 지표는 시장의 소음을 효과적으로 필터링하여 트렌드 방향을 판단한다. EMA 지표는 장기적인 트렌드를 탐지한다. 구체적인 거래 논리는 다음과 같다:
짧은 주기 이동 평균 (예: 3 주기 SMMA) 위를 더 긴 주기 이동 평균 (예: 200 주기 EMA) 을 가로질러 구매 신호가 발생한다. 짧은 주기 이동 평균 아래를 가로질러 더 긴 주기 이동 평균이 발생하면 판매 신호가 발생한다. 이렇게 여러 이동 평균의 배열 관계를 판단하여 트렌드 방향을 결정한다.
또한, 전략은 위험을 통제하기 위해 스톱 스톱 손실 지점을 설정합니다.
이 전략은 다음과 같은 장점을 가지고 있습니다.
다단계 이동 평균 구조는 트렌드 방향을 효과적으로 판단하여 잘못된 신호를 줄일 수 있다.
SMMA 지표는 시장 소음을 효과적으로 필터링하고, EMA 지표는 긴 줄 트렌드를 검출한다.
높은 레버리드 계정에 적합하여 거래 수익을 확대할 수 있습니다.
스톱 스톱 손실 지점을 설정하여 위험을 효과적으로 제어할 수 있습니다.
거래 종류 (EURUSD) 와 주기를 (EURUSD) (15분) 최적화하여 더 우수하게 만듭니다.
이 전략에는 다음과 같은 위험도 있습니다.
이동 평균을 많이 사용해서 단기 반전 기회를 놓칠 수 있습니다.
높은 레버리지는 손실을 증가시키면서 동시에 수익을 증가시킵니다.
이동 평균이 신호를 내놓을 때, 단기 시장은 이미 반전된 상태일 수 있다.
EURUSD의 환율이 급격하게 변동할 수 있기 때문에 더 큰 위험을 초래할 수 있습니다.
이러한 위험에 대해, 적절한 리버리지 배수를 조정하고, 이동 평균의 파라미터를 최적화하고, 시장의 역전 등을 판단하는 다른 지표를 도입하여 최적화 할 수 있습니다.
이 전략의 주요 최적화 방향은 다음과 같습니다.
다양한 품종과 주기의 성능을 평가하고 최적의 매개 변수를 선택하십시오.
다양한 변수 조합과 수의 이동 평균을 테스트한다.
거래량이나 변동률 지표의 증가로 단기 전환점을 판단한다.
정지 손실을 증가시키는 동적 조정.
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)