Strategi Stochastic Berbilang Jangka Masa

Penulis:ChaoZhang, Tarikh: 2024-02-29 12:11:23
Tag:

img

Ringkasan

Logika Strategi

Analisis Kelebihan

  1. Jangka masa semasa membolehkan entri berisiko rendah untuk menangkap pembalikan jangka pendek dalam trend.

Analisis Risiko

  1. Pembalikan trend tiba-tiba mungkin tidak ditangkap lebih awal oleh penunjuk jangka masa yang lebih tinggi, meningkatkan kerugian dari suis arah lewat. Parameter jangka masa perlu dioptimumkan untuk mendapatkan data pasaran yang cukup tepat pada masanya.
  2. Penunjuk jangka masa semasa boleh menjadi terlalu sensitif, meningkatkan kekerapan perdagangan dan kos. Parameter memerlukan kalibrasi untuk menapis bunyi bising yang tidak penting.

Arahan pengoptimuman

Arah pengoptimuman utama termasuk:

  1. Menyesuaikan parameter jangka masa semasa dan ambang penembusan untuk mengurangkan isyarat palsu.
  2. Uji kombinasi jangka masa untuk mencari keseimbangan yang optimum.

Kesimpulan


/*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)
    



Lebih lanjut