
Artikel ini membahas strategi perdagangan kuantitatif yang didasarkan pada penurunan persentase. Strategi ini digunakan untuk menentukan kapan membeli dan menjual dengan menetapkan penurunan persentase dan memilih periode waktu yang sesuai.
Inti dari strategi ini adalah untuk menghasilkan sinyal perdagangan berdasarkan persentase perubahan harga. Pertama, pengguna perlu mengatur persentase penurunan yang menunjukkan seberapa besar perubahan harga relatif terhadap harga penutupan sebelumnya. Selain itu, pengguna juga harus memilih periode waktu, seperti 1 menit, 1 jam, 1 hari, dan lain-lain, untuk menghitung harga tertinggi, terendah, dan harga penutupan dalam periode waktu tersebut.
Artikel ini membahas strategi perdagangan kuantitatif berdasarkan persentase penurunan nilai, yang secara otomatis menghasilkan sinyal beli dan jual dengan menetapkan persentase penurunan nilai dan siklus waktu perubahan harga. Strategi ini sederhana, fleksibel, dan luas, tetapi juga menghadapi risiko seperti fluktuasi pasar, pengaturan parameter, dan overfitting. Dengan menambahkan mekanisme stop loss, pengaturan parameter secara dinamis, dan kombinasi dengan indikator teknis lainnya, kinerja strategi dapat dioptimalkan lebih lanjut dan meningkatkan efektivitasnya dalam perdagangan nyata.
/*backtest
start: 2023-05-28 00:00:00
end: 2024-06-02 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("GBS Percentage", overlay=true)
// Define input options for percentage settings and timeframe
percentage = input.float(1.04, title="Percentage Threshold", minval=0.01, step=0.01) / 100
timeframe = input.timeframe("D", title="Timeframe", options=["1", "3", "5", "15", "30", "60", "240", "D", "W", "M"])
// Calculate high, low, and close of the selected timeframe
high_timeframe = request.security(syminfo.tickerid, timeframe, high)
low_timeframe = request.security(syminfo.tickerid, timeframe, low)
close_timeframe = request.security(syminfo.tickerid, timeframe, close)
// Calculate the percentage threshold based on the previous close
threshold = close_timeframe[1] * percentage
// Define conditions for Buy and Sell
buyCondition = high_timeframe > (close_timeframe[1] + threshold)
sellCondition = low_timeframe < (close_timeframe[1] - threshold)
// Entry and exit rules
if (buyCondition)
strategy.entry("Buy", strategy.long)
if (sellCondition)
strategy.entry("Sell", strategy.short)
// Close the positions based on the conditions
if (sellCondition)
strategy.close("Buy")
if (buyCondition)
strategy.close("Sell")
// Plot Buy and Sell signals on the chart
plotshape(series=buyCondition, title="Buy Entry", color=color.green, style=shape.triangleup, location=location.belowbar)
plotshape(series=sellCondition, title="Sell Entry", color=color.red, style=shape.triangledown, location=location.abovebar)
// Plot the equity curve of the strategy
plot(strategy.equity, title="Equity", color=color.blue, linewidth=2)