이 전략은 복수 평균선, 무작위 지표 및 MACD 지표를 통합하여 짧은 라인 거래 기회를 식별합니다.
이 전략은 다음과 같은 몇 가지 원칙에 기초하고 있습니다.
50주기 및 100주기 EMA 평균선을 사용하여 트렌드 방향을 판단한다. EMA 평균선은 짧은 주기를 가지고 있으며, 가격 변화에 빠르게 반응한다. 50주기선 상단 100주기선 상단 100주기선 상단 100주기선 상단 100주기선 상단 100주기선 상단 100주기선 상단 100주기선 상단 100주기선 상단 100주기선 상단 100주기선 상단 100주기선 상단 100주기선 상단 100주기선 상단 100주기선 상단 100주기선 상단 100주기선 상단 100주기선 상단 100주기선 상단 100주기선 상단 100주기선 상단 100주기선 상단 100주기선 상단 100주기선 상단 100주기선 상단 100주기선 상단 100주기선 상단 100주기선 상단 100주기선 상단 100주기선 상단 100주기선 상단 100주기선 상단 100주기선 상단 50주기선 상단 100주기선 상단 100주기선 상단 100주기선
MACD 지표의 이차값을 사용하여 매매 시기를 판단한다. 이차값이 상단 0을 지나면 다단 힘이 증가하고, 더 많은 것을 한다. 이차값이 하단 0을 지나면 공백 힘이 증가하고, 공백을 한다.
스토카스틱 RSI 지표와 결합하여 과매매를 판단한다. 이 지표는 KDJ 지표와 RSI 지표의 장점을 결합하여 시장의 과매매 과매매 상황을 보여줄 수 있다. 지표가 20보다 낮으면 과매로, 다른 지표와 결합하면 과매로; 지표가 80보다 높으면 과매로, 다른 지표와 결합하면 공백으로.
포지션 개시 방향을 결정한 후, 만약 최근 5개의 K선에서 4개의 종결 가격이 평균선에 닿아 있다면, 평균선 근처에 지지 또는 압력이 있음을 나타내는 경우, 포지션을 개시할 수 있다.
스톱포인트를 사용하여 위험을 관리하십시오.
이 전략은 다음과 같은 장점을 가지고 있습니다.
다중 지표 조합, 종합 사용 평균선, 과매도 과매도 지표 및 에너지 지표, 거래 승률을 높인다.
평균선 주기가 짧고, 트렌드를 빠르게 파악하고 반전할 수 있다. MACD 파라미터를 최적화하고, 매매 시기를 정확하게 식별한다.
스토카스틱 RSI 지표의 매개 변수들이 최적화되어 있어 과매매 현상을 잘 식별할 수 있다.
평균선 근처의 지지 압력을 사용하여 리듬 조절을 하고, 무효 뚫림에 갇히지 않도록 한다.
합리적인 스톱로스, 단일 거래의 위험을 효과적으로 제어한다.
이 전략에는 몇 가지 위험도 있습니다.
하지만 여전히 가짜 침입으로 인한 손실을 완전히 피할 수는 없습니다.
다중 지표 조합은 부조화가 발생할 수 있으며, 이는 거래 신호의 불일치를 초래한다.
고정 스톱 스톱 손실 지점은 시장의 변화에 적응하지 못할 수 있습니다.
코드 구현은 복잡하고, 변수가 많으며, 최적화하기가 쉽지 않다.
위험의 해결책은 다음과 같습니다.
파라미터를 최적화하여 신호 품질을 높이고, 가짜 돌파 확률을 감소시킨다.
지표 간의 우선순위를 설정하여 신호 충돌을 피하십시오.
스톱 스톱 손실의 동적 추적을 가능하게 하고, ATR 등의 지표에 따라 스톱 스톱 손실 범위를 설정한다.
코드 논리를 단순화하고, 테스트 및 최적화를 위해 핵심 변수를 추출한다.
이 전략은 다음과 같은 방향으로 최적화될 수 있습니다.
평균선 주기, MACD 변수를 테스트하여 최적의 변수 조합을 찾습니다.
다른 과매매 과매매 지표를 테스트하는 것 대신에 스토카스틱 RSI .
다이내믹 스톱, 모바일 스톱을 사용해 손해배상 관리를 더 똑똑하게 할 수 있습니다.
거래량 증가와 같은 필터링 조건을 추가하여 신호 품질을 향상시킵니다.
포지션 개시 논리를 최적화하여 무효 돌파구를 방지한다. 더 많은 지표 판단 트렌드를 도입할 수 있다.
계좌 자금 규모, 일일 거래 수 등에 대한 중지 손실 제한을 설정하고, 전반적인 위험을 제어한다.
이 전략은 여러 지표의 장점을 통합하여 짧은 라인 거래에서 강력한 실용성을 가지고 있습니다. 매개 변수를 계속 최적화하고, 엄격한 포지션 논리, 손실 관리 전략을 개선함으로써 전략의 안정성과 수익성을 더욱 향상시킬 수 있습니다. 이 전략은 약간의 기초가있는 짧은 라인 거래자의 사용에 적합하지만, 큰 손실이 발생하지 않도록 위험 제어에 주의해야합니다.
/*backtest
start: 2023-01-01 00:00:00
end: 2023-10-08 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=4
strategy(title="Forex scalper 2xEMA + SRSI + MACD", shorttitle="Forex scalper 5-15min", overlay=true)
src = input(title="Source", type=input.source, defval=close)
src_0 = src[0]
src_1 = src[1]
src_2 = src[2]
src_3 = src[3]
src_4 = src[4]
len50 = input(50, minval=1, title="Length")
src50 = input(close, title="Source")
out50 = ema(src50, len50)
len100 = input(100)
src100 = input(close, title="Source")
out100 = ema(src100, len100)
len1 = input(1, minval=1, title="Length")
src1 = input(close, title="Source")
out1 = sma(src1, len1)
length = input(4, minval=1)
OverBought = input(80)
OverSold = input(20)
smoothK = 3
smoothD = 3
k = sma(stoch(close, high, low, length), smoothK)
d = sma(k, smoothD)
cu = crossover(k,OverSold)
co = crossunder(k,OverBought)
sma_down = crossunder(out1, out50)
sma_up = crossover(out1,out50)
//if (not na(k) and not na(d))
// if (co and k < OverSold)
// strategy.entry("StochLE", strategy.long, comment="StochLE")
//if (cu and k > OverBought)
// strategy.entry("StochSE", strategy.short, comment="StochSE")
crossCandle_4 = crossover(src[4],out50)
crossCandleUnder_4= cross(src[4],out50)
crossCandle_3 = crossover(src[3],out50)
crossCandleUnder_3= crossunder(src[3],out50)
crossCandle_2 = crossover(src[2],out50)
crossCandleUnder_2= crossunder(src[2],out50)
crossCandle_1 = crossover(src[1],out50)
crossCandleUnder_1= crossunder(src[1],out50)
crossCandle_0 = crossover(src[0],out50)
crossCandleUnder_0= crossunder(src[0],out50)
conditionOver = (crossCandle_4 or crossCandle_3 or crossCandle_2 or crossCandle_1 or crossCandle_0)
conditionUnder =(crossCandleUnder_4 or crossCandleUnder_3 or crossCandleUnder_2 or crossCandleUnder_1 or crossCandleUnder_0)
touch4 = (cross(low[4],out50) or cross(high[4],out50))
touch3 = (cross(low[3],out50) or cross(high[3],out50))
touch2 = (cross(low[2],out50) or cross(high[2],out50))
touch1 = (cross(low[1],out50) or cross(high[1],out50))
touch = touch1 or touch2 or touch3 or touch4
//and sma_up
//and sma_down
// Getting inputs
fast_length = input(title="Fast Length", type=input.integer, defval=12)
slow_length = input(title="Slow Length", type=input.integer, defval=26)
src_macd = input(title="Source", type=input.source, defval=close)
signal_length = input(title="Signal Smoothing", type=input.integer, minval = 1, maxval = 50, defval = 10)
sma_source = input(title="Simple MA(Oscillator)", type=input.bool, defval=false)
sma_signal = input(title="Simple MA(Signal Line)", type=input.bool, defval=false)
// Plot colors
col_grow_above = #26A69A
col_grow_below = #FFCDD2
col_fall_above = #B2DFDB
col_fall_below = #EF5350
col_macd = #0094ff
col_signal = #ff6a00
// Calculating
fast_ma = sma_source ? sma(src_macd, fast_length) : ema(src_macd, fast_length)
slow_ma = sma_source ? sma(src_macd, slow_length) : ema(src_macd, slow_length)
macd = fast_ma - slow_ma
signal = sma_signal ? sma(macd, signal_length) : ema(macd, signal_length)
hist = macd - signal
//plot(hist, title="Histogram", style=plot.style_columns, color=(hist>=0 ? (hist[1] < hist ? col_grow_above : col_fall_above) : (hist[1] < hist ? col_grow_below : col_fall_below) ), transp=0 )
//plot(macd, title="MACD", color=col_macd, transp=0)
//plot(signal, title="Signal", color=col_signal, transp=0)
// plot((conditionOver or conditionUnder or touch) and src[0] >= out50 and close >= out50 and (cu) and out50 > out100 and hist>=0 , title="Buy", style=columns, color=lime)
// plot((conditionOver or conditionUnder or touch) and src[0] <= out50 and close <= out50 and (co) and out50< out100 and hist<=0 , title="sell", style=columns, color=red)
long_cond = ((conditionOver or conditionUnder or touch) and src[0] >= out50 and close > out50 and (cu) and out50 > out100 and hist>=0)
short_cond = ((conditionOver or conditionUnder or touch) and src[0] <= out50 and close < out50 and (co) and out50< out100 and hist<=0)
tp=input(200)
sl=input(200)
strategy.entry("long",strategy.long, when=long_cond)
strategy.entry("short",strategy.short, when=short_cond)
strategy.exit("X_long", "long", profit=tp, loss=sl, when=touch )
strategy.exit("x_short", "short",profit=tp, loss=sl,when = touch )