
これは日線高低点突破と多周期EMAトレンドを組み合わせた量的な取引戦略である.戦略は,主に,前日の高低点に対する価格の突破を監視し,EMA平均線と資金流向指標 ((CMF)) と組み合わせて取引タイミングを判断する.戦略は,時線と日線の両時間の周期200周期EMA平均線を同時に使用し,複数の技術指標の検証によって取引の正確性を向上させる.
戦略の中核となるロジックには、次の重要な要素が含まれます。
取引の具体的ルールは以下の通りです. 複数の条件: 価格が1日前の高値を破り + 閉店価格がEMAの上 + CMFが正値 空白条件: 価格が1日前の低点を下回る + 閉店価格がEMA以下 + CMFがマイナスになる 平仓条件:多時価格がEMAを下回り,空時価格がEMAを破る
リスク管理の提案:
これは,複数の技術指標と複数の時間周期分析を組み合わせた完全な取引システムである.戦略は,日中の高低突破,平均線トレンドと資金の流れの総合的な分析によって取引機会を探している.一定のリスクがあるものの,合理的なリスク管理と継続的な最適化改善により,この戦略は良い応用価値を持っています.
/*backtest
start: 2024-10-28 00:00:00
end: 2024-11-27 00:00:00
period: 1h
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy(title='The security Daily HIGH/LOW strategy', overlay=true, initial_capital=10000, calc_on_every_tick=true,
default_qty_type=strategy.percent_of_equity, default_qty_value=100,
commission_type=strategy.commission.percent, commission_value=0.1)
// General Inputs
len = input.int(24, minval=1, title='Length MA', group='Optimization parameters')
src = input.source(close, title='Source MA', group='Optimization parameters')
out = ta.ema(src, len)
length = input.int(20, minval=1, title='CMF Length', group='Optimization parameters')
ad = close == high and close == low or high == low ? 0 : (2 * close - low - high) / (high - low) * volume
mf = math.sum(ad, length) / math.sum(volume, length)
// Function to get daily high and low
f_secureSecurity(_symbol, _res, _src) =>
request.security(_symbol, _res, _src[1], lookahead=barmerge.lookahead_on)
pricehigh = f_secureSecurity(syminfo.tickerid, 'D', high)
pricelow = f_secureSecurity(syminfo.tickerid, 'D', low)
// Plotting previous daily high and low
plot(pricehigh, title='Previous Daily High', style=plot.style_linebr, linewidth=2, color=color.new(color.white, 0))
plot(pricelow, title='Previous Daily Low', style=plot.style_linebr, linewidth=2, color=color.new(color.white, 0))
// Entry Conditions
short = ta.crossunder(low, pricelow) and close < out and mf < 0
long = ta.crossover(high, pricehigh) and close > out and mf > 0
if short and barstate.isconfirmed
strategy.entry('short', strategy.short, stop=pricelow[1])
strategy.close('short', when=close > out)
if long and barstate.isconfirmed
strategy.entry('long', strategy.long, stop=pricehigh[1])
strategy.close('long', when=close < out)
// 200 EMA on 1-hour timeframe
ema_200 = ta.ema(close, 200)
ema_200_1h = request.security(syminfo.tickerid, "60", ta.ema(close, 200))
plot(ema_200_1h, color=color.purple, title="200 EMA (1H)")
plot(ema_200, color=color.white, title="200 EMA")