この戦略は,開盤前期に焦点を当て,平均線と動態指標を組み合わせて短期的な傾向を判断し,高動態期に突破取引を行う.これは典型的なショートラインの利回り戦略である.
戦略の原則:
取引開始前1時間以内に設定します.
50サイクルEMAを計算して,大盤合理価格区間を判断する.
SMI指標は,区域的な低点に上昇交差が表示され,購入の信号とみなされます.
EMA平均線を突破した閉盘はストップ・シグナルと見なされる.
固定ストップポイントを設定し,ターゲットショートラインを調整する.
この戦略の利点は
短期EMAを突破すると,その日のトレンドの方向を判断できます.
SMI指標は,超売り地域での反転の機会を確認する.
検知パラメータは有限で,実盤操作は簡単である.
この戦略のリスクは
突破は,円盤前の牢獄を形成しやすいので,注意して反転してください.
飛行機の操縦は1日間のもので,空飛ぶのは難しい.
停損幅は小さく,調整が不適切で損耗が容易である.
要するに,この戦略は,典型的な前盤のショートライン戦略であり,EMAとSMI指標を通して高動力のブレークを狙っている.しかし,前盤のセーフ・キャプチャはリスクが高いので,ポジションをコントロールし,負債を十分に抑える必要がある.
/*backtest
start: 2022-09-12 00:00:00
end: 2023-09-12 00:00:00
period: 4d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
args: [["v_input_7",65]]
*/
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Trading_Bites
//@version=5
// strategy('Morning Scalp', overlay=false, pyramiding=2, initial_capital=3000, default_qty_value=0, commission_value=0.02, max_labels_count=500)
// Initial Inputs
StartDate = timestamp('15Aug 2022 14:00 +0000')
EndDate = timestamp('15Aug 2022 20:00 +0000')
testPeriodStart = input(StartDate, 'Start of trading')
testPeriodEnd = input(EndDate, 'End of trading')
QuantityOnLong = input(title="Quantity", defval=100, minval=1)
QuantityOnClose = QuantityOnLong
//////////////////////////////////////////////////////////////////////
//-- Time In Range
timeinrange(res, sess) =>
not na(time(res, sess))
//Market Open//
marketopen = '0930-1600'
MarketOpen = timeinrange(timeframe.period, marketopen)
//////////////////////////////////////////////////////////////////////
//Market Hour//
morning = '1000-1210'
Morning = timeinrange(timeframe.period, morning)
//////////////////////////////////////////////////////////////////////////
//STOCK MOMENTUM INDEX//
a = input(5, 'Percent K Length')
b = input(3, 'Percent D Length')
ovrsld = input.float(40, 'Over Bought')
ovrbgt = input(-40, 'Over Sold')
//lateleave = input(14, "Number of candles", type=input.integer)
// Range Calculation
ll = ta.lowest(low, a)
hh = ta.highest(high, a)
diff = hh - ll
rdiff = close - (hh + ll) / 2
// Nested Moving Average for smoother curves
avgrel = ta.ema(ta.ema(rdiff, b), b)
avgdiff = ta.ema(ta.ema(diff, b), b)
// SMI calculations
SMI = avgdiff != 0 ? avgrel / (avgdiff / 2) * 100 : 0
SMIsignal = ta.ema(SMI, b)
CrossoverIndex = ta.crossover(SMI, SMIsignal)
CrossunderIndex = ta.crossunder(SMI, SMIsignal)
plot1 = plot(SMI, color=color.new(color.aqua, 0), title='Stochastic Momentum Index', linewidth=1, style=plot.style_line)
plot2 = plot(SMIsignal, color=color.new(color.red, 0), title='SMI Signal Line', linewidth=1, style=plot.style_line)
hline = plot(ovrsld, color=color.new(color.red, 0), title='Over Bought')
lline = plot(ovrbgt, color=color.new(color.green, 0), title='Over Sold')
plot(CrossoverIndex ? close : na, color=color.new(color.aqua, 0), style=plot.style_cross, linewidth=2, title='RSICrossover')
mycol1 = SMIsignal > -ovrbgt ? color.red : na
mycol2 = SMIsignal < -ovrsld ? color.green : na
fill(plot1, hline, color=color.new(mycol1, 80))
fill(plot2, lline, color=color.new(mycol2, 80))
//////////////////////////////////////////////////////////////////////
// Input EMA9 and EMA21
EMA50Len = input( 50 )
EMA50 = ta.ema(close, EMA50Len)
//////////////////////////////////////////////////////////////////////////
// -------- VWAP ----------//
vwapLine = ta.vwap(close)
////////////////////////////////////////////////////////////////////////
//PROFIT TARGET//
longProfitPer = input(10.0, title='Take Profit %') / 100
TargetPrice = strategy.position_avg_price * (1 + longProfitPer)
//plot (strategy.position_size > 0 ? TargetPrice : na, style=plot.style_linebr, color=color.green, linewidth=1, title="Price Target")
//BUY STRATEGY CONDITION//
condentry = ta.crossover(SMI, SMIsignal) and SMI < 0
profittarget = TargetPrice
stoploss = close < EMA50
///////////////////////////STRATEGY BUILD//////////////////////////////////////
if MarketOpen
if close > EMA50
if (condentry) and Morning
strategy.entry('Long', strategy.long)
if profittarget and strategy.position_size > 0
strategy.exit(id="Long", limit=TargetPrice)
if stoploss
strategy.close('Long' )