다중 시간 프레임 스토카스틱 전략

저자:차오장날짜: 2024-02-29 12:11:23
태그:

img

전반적인 설명

전략 논리

이점 분석

  1. 현재 시간 프레임은 트렌드 내에서 단기적 반전을 포착하기 위해 낮은 위험 항목을 허용합니다.
  2. 이중 스토카스틱 지표는 신호의 정확성을 향상시키고 잘못된 신호를 줄입니다.

위험 분석

이 전략은 몇 가지 위험을 고려해야 합니다.

  1. 현재 시간 프레임 지표는 너무 민감하여 거래 빈도와 비용을 증가시킬 수 있습니다. 매개 변수는 중요하지 않은 소음을 필터링하기 위해 캘리브레이션이 필요합니다.
  2. 이중 스토카스틱은 정확성을 향상시키지만 반응 시간을 늦추기도 합니다. 빠른 시장 움직임은 최적의 입구 지점을 놓치는 결과를 초래할 수 있습니다.

최적화 방향

주요 최적화 방향은 다음과 같습니다.

  1. 최적의 균형을 찾기 위해 시간 프레임 조합을 테스트합니다.
  2. 거래당 하락위험을 통제하기 위한 스톱 로스 전략을 포함합니다.

결론


/*backtest
start: 2023-02-22 00:00:00
end: 2024-02-28 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=3
strategy("MTF stochastic strategy", overlay=false,pyramiding=3,default_qty_type=strategy.percent_of_equity,default_qty_value=100,currency=currency.USD)
//
//this strategy is inspired to bobby thread in forexfactory forum
//
len = input(11, minval=1, title="Length for Main Stochastic") 
smoothK = input(3, minval=1, title="SmoothK for Main Stochastic")
smoothD = input(3, minval=1, title="SmoothD for Main Stochastic")
upLine = input(80, minval=50, maxval=90, title="Upper Line Value?")
lowLine = input(20, minval=10, maxval=50, title="Lower Line Value?")
trailStep=input(50,minval=10,title="Trialing step value")

// current stochastic calculation
k = sma(stoch(close, high, low, len), smoothK)
d = sma(k, smoothD)

//mtf stochastic calculation smoothed with period

mtfK= sma(stoch(close, high, low, len), smoothK*3)
mtfD= sma(k, smoothD*3)

plot(k,"current TF k",black,style=linebr)
plot(d,"current TF d",gray,style=linebr)
plot(mtfK,"MTF TF k",red,style=line)
plot(mtfD,"Multi TF d",green,style=line)
hline(upLine)
hline(50)
hline(lowLine)

longCondition = crossover(mtfK, 50) and k>50 and change(k,1)>0 and k>d and mtfK>mtfD
if (longCondition)
    strategy.entry("Lungo", strategy.long)

shortCondition = crossunder(mtfD, 50) and k<50 and change(k,1)<0 and k<d and mtfK<mtfD
if (shortCondition)
    strategy.entry("Corto", strategy.short)
    
exitlong=crossunder(mtfD, upLine)
exitshort=crossover(mtfK, lowLine)

if (exitlong)
    strategy.exit("Esci lungo","Lungo",trail_points=trailStep)
if (exitshort)
    strategy.exit("Esci corto","Corto",trail_points=trailStep)
    



더 많은