Sumber daya yang dimuat... Pemuatan...

Strategi Pembalikan Kunci Backtest

Penulis:ChaoZhang, Tanggal: 2024-01-26 16:11:28
Tag:

img

Gambaran umum

Strategi reversal key backtest mengidentifikasi sinyal reversal key dalam harga saham untuk menentukan apakah tren saat ini sedang terbalik, untuk menangkap arah pergerakan harga setelah reversal trend. Strategi ini didasarkan pada teori key reversal day.

Prinsip Strategi

Logika inti dari strategi pembalikan kunci adalah untuk mengidentifikasi hari pembalikan kunci. Menurut pergerakan harga saham, kita dapat menilai arah tren saat ini. Munculnya sinyal pembalikan kunci menunjukkan bahwa tren dapat berbalik.

Analisis Keuntungan

Analisis Risiko

Strategi pembalikan kunci backtest juga memiliki beberapa risiko:

Arahan Optimasi

Ringkasan


/*backtest
start: 2024-01-18 00:00:00
end: 2024-01-25 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=4
////////////////////////////////////////////////////////////
//  Copyright by HPotter v1.0 21/01/2020
//
// A key reversal is a one-day trading pattern that may signal the reversal of a trend. 
// Other frequently-used names for key reversal include "one-day reversal" and "reversal day."
// How Does a Key Reversal Work?
// Depending on which way the stock is trending, a key reversal day occurs when:
// In an uptrend -- prices hit a new high and then close near the previous day's lows.
// In a downtrend -- prices hit a new low, but close near the previous day's highs
// WARNING:
// - For purpose educate only
// - This script to change bars colors.
////////////////////////////////////////////////////////////
strategy(title="Key Reversal Up Backtest", shorttitle="KRU Backtest", overlay = true) 
nLength = input(1, minval=1, title="Enter the number of bars over which to look for a new low in prices.")
input_takeprofit = input(20, title="Take Profit pip", step=0.01)
input_stoploss = input(10, title="Stop Loss pip", step=0.01)
xLL = lowest(low[1], nLength)
C1 = iff(low < xLL and close > close[1], true, false)
plotshape(C1, style=shape.triangleup, size = size.small, color=color.green, location = location.belowbar )
posprice = 0.0
pos = 0
barcolor(nz(pos[1], 0) == -1 ? color.red: nz(pos[1], 0) == 1 ? color.green : color.blue ) 
posprice := iff(C1== true, close, nz(posprice[1], 0)) 
pos := iff(posprice > 0, 1, 0)
if (pos == 0) 
    strategy.close_all()
if (pos == 1)
    strategy.entry("Long", strategy.long)
posprice := iff(low <= posprice - input_stoploss and posprice > 0, 0 ,  nz(posprice, 0))
posprice := iff(high >= posprice + input_takeprofit and posprice > 0, 0 ,  nz(posprice, 0))

Lebih banyak