ブレイクアウトデイトレード戦略の終了


作成日: 2023-10-09 16:56:21 最終変更日: 2023-10-09 16:56:21
コピー: 0 クリック数: 641
1
フォロー
1617
フォロワー

概要

この戦略は,移動平均線に基づく簡単な日内取引戦略で,GBPUSD 1時間周期チャートに適用されます. ロンドン開場時にのみ入場し,ロンドン閉場時に出場し,ロンドン時間帯のトレンドブレイク取引に適しています.

戦略原則

この戦略は,非常に速い平均線と非常に遅い平均線である2つの移動平均線を使用します.具体的ロジックは次のとおりです.

  1. ロンドン開盤時にのみ (08時) 突破入りする. 判断方法は,閉盤価格または最高価格が急速平均線を突破すれば多め,閉盤価格または最低価格が急速平均線を突破すれば空きである.

  2. また,前K線の閉盘価格がスロー・エヴァンより高くなり,スロー・エヴァンより低く空きをするように要求し,非トレンド状況をフィルターする.

  3. ストップダストは最小値で50〜100点です.

  4. ストップが設定されず,ロンドンが閉幕した時に (午後15時) 無条件で出場する.

優位分析

これは非常に単純な突破策ですが,ロンドン時間のトレンド特性を合理的に利用しているため,以下の利点があります.

  1. 市場を揺るがすリスクを避けるため,トレンドがはっきりしたときにのみ入場してください.

  2. 取引はロンドン時間帯のみで,この時間帯の波動性の高い特性を充分に活用しました.

  3. ローストップは,反発を一定程度に耐えられる.

  4. 条件を問わず退場し,夜を過ごす危険を回避する.

リスク分析

この戦略にはいくつかのリスクがあります.

  1. ロンドン時間帯では,明確なトレンドがない場合,長期間の取引なしになる可能性があります.

  2. 小規模な止損によって引き起こされる止損のリスク.突破後に一定の反発が止損を引き起こす可能性がある.

  3. 固定出場時間による早期出場リスク. 強いトレンドの時には,持仓時間を延長する必要が考えられます.

対策として,適切な入場規則の緩和,移動のストップを活用して利益をロックし,市場状況に応じて適切な出場時間を調整することが可能である.

最適化の方向

この戦略は以下の点で最適化できます.

  1. RSI,ブリン帯などの他の指標のフィルタリングを追加し,さらに揺れ市場を避ける.

  2. 移動均線組合せを最適化し,異なるパラメータの均線効果をテストする.

  3. 異なるストップポイントのサイズをテストし,最適なストップ範囲を見つけます.

  4. 試合終了時を固定する代わりに,状況に応じてリアルタイムで出発時間を調整する.

  5. 他の通貨ペアや他の時間周期の効果をテストする.

  6. 資金管理,取引サイズ計算などのリスク管理モジュールへの追加

要約する

この戦略は全体的に非常にシンプルで実用的なロンドン区間突破戦略である.利点は,ルールがシンプルで明確であり,区間特性を合理的に使用することでいくつかの取引リスクを回避できるということです.また,テストを最適化し続けると,戦略の安定性と収益性をさらに向上させることができるいくつかの最適化可能なスペースもあります.全体的に,この戦略は,ロンドン区間突破取引のアイデアを効率的に利用するための参考フレームワークとモデルを提供します.

ストラテジーソースコード
/*backtest
start: 2023-09-08 00:00:00
end: 2023-10-08 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=4

// strategy(title="2 ma breakout",shorttitle="2 ma breakout", initial_capital=10000,overlay=true, commission_type = strategy.commission.cash_per_contract, commission_value = 0.00008 )
timeinrange(res, sess) => time(res, sess) != 0

//Change false to false = You have to turn on, won't show up by default
//****Always use lowercase letters

doNYOpen = input(defval=false, type = input.bool, title="NY Open On")
doNYSession = input(defval=false, type = input.bool, title="NY Session On")
doNYClose = input(defval=false, type = input.bool, title="NY Close On")

doAussieOpen = input(defval=false, type = input.bool, title="Aussie Open On")
doAussieSession = input(defval=false, type = input.bool, title="Aussie Session On")
doAussieClose = input(defval=false, type = input.bool, title="Aussie Close On")

doAsiaOpen = input(defval=false, type = input.bool, title="Asia Open On")
doAsiaSession = input(defval=false, type = input.bool, title="Asia Session On")
doAsiaClose = input(defval=false, type = input.bool, title="Asia Close On")

doEurOpen = input(defval=true, type = input.bool, title="Euro Open On")
doEurSession = input(defval=true, type = input.bool, title="Euro Session On")
doEurClose = input(defval=true, type = input.bool, title="Euro Close On")

//You can copy and paste these colors. white - silver - gray - maroon - red - purple - fuchsia - green - lime
//   olive - yellow - navy - blue - teal - aqua - orange 

nySessionStart = color.olive
nySession = color.olive
nySessionEnd = color.olive
asiaSessionStart = color.blue
asiaSession = color.blue
asiaSessionEnd = color.blue
europeSessionStart = color.red
europeSession = color.red
europeSessionEnd = color.red
colorwhite = color.white

//****Note ---- Use Military Times --- So 3:00PM = 1500


bgcolor(doAsiaSession and timeinrange(timeframe.period, "1800-0400") ? asiaSession : na, transp=75)
//bgcolor(timeinrange(timeframe.period, "0000-0300") ? color.white  : na, transp=75)
bgcolor(doEurSession and timeinrange(timeframe.period, "0300-1100") ? europeSession : na, transp=75)
bgcolor(doNYSession and timeinrange(timeframe.period, "0800-1600") ? nySession : na, transp=75)

active = input(true, title="Show On Chart")
pricehigh = security(syminfo.tickerid, '60', high[0])
pricelow = security(syminfo.tickerid, '60', low[0])
//Daily Plots
offs_daily = 0 
hiHighs = 0
loLows = 0
//plot(timeinrange(timeframe.period, "0000-0300") and pricehigh ? pricehigh  : na, title="Previous Daily High", style=plot.style_line, linewidth=2, color=color.gray)
//plot(timeinrange(timeframe.period, "0000-0300") and pricelow ? pricelow : na, title="Previous Daily Low", style=plot.style_linebr, linewidth=2, color=color.gray)

if(timeinrange(timeframe.period, "0000-0300"))
    hiHighs = highest(high, 3)
    loLows = lowest(low, 3)
    

// From Date Inputs
fromDay = input(defval = 1, title = "From Day", minval = 1, maxval = 31)
fromMonth = input(defval = 1, title = "From Month", minval = 1, maxval = 12)
fromYear = input(defval = 2020, title = "From Year", minval = 1970)
 
// To Date Inputs
toDay = input(defval = 31, title = "To Day", minval = 1, maxval = 31)
toMonth = input(defval = 12, title = "To Month", minval = 1, maxval = 12)
toYear = input(defval = 2020, title = "To Year", minval = 1970)
 
// Calculate start/end date and time condition
startDate = timestamp(fromYear, fromMonth, fromDay, 00, 00)
finishDate = timestamp(toYear, toMonth, toDay, 00, 00)
time_cond = true


len = input(2)
src = input(close, title="Source")
out = sma(src, len)

lena = input(200, minval=1, title="Length slow")
srca = input(close, title="Source")
outa = ema(srca, lena)

//tp = input(100, title="tp")
sl = input(66, title="sl")
// if(smabool)
//     out := sma(src, len)
// else if(emabool)
//     out := ema(src, len)
// else if(hmabool)
//     out := hma(src, len)
// else if(vmabool)
//     out := wma(src, len)  
// else if(vwmabool)
//     out := vwma(src, len)   
// else if(smmabool)
//     out := sma(src, len)  
 
plot(out, color=color.white, title="MA")
plot(outa, color=color.white, title="MA")

longC = timeinrange(timeframe.period, "0300-0400") and (crossover(close,out) or crossover(high,out)) and close[1] > outa and time_cond
shortC = timeinrange(timeframe.period, "0300-0400") and (crossunder(close,out) or crossunder(low,out)) and close[1] < outa and time_cond



//inputlondon = input(false, title="london session")
//inputny = input(false, title="new york session")

//if(inputlondon==true)

strategy.initial_capital = 50000

//MONEY MANAGEMENT--------------------------------------------------------------
balance = strategy.netprofit + strategy.initial_capital //current balance
floating = strategy.openprofit          //floating profit/loss
risk = input(1,type=input.float,title="Risk % of equity ")/100           //risk % per trade

temp01 = balance * risk     //Risk in USD
temp02 = temp01/sl        //Risk in lots
temp03 = temp02*100      //Convert to contracts
size = temp03 - temp03%1 //Normalize to 1000s (Trade size)
if(size < 1)
    size := 1         //Set min. lot size


strategy.entry("long",1,when=longC)
//strategy.close("long", when = crossunder(close,out) or not (timeinrange(timeframe.period, "0300-1000")))
strategy.close("long", when =  not (timeinrange(timeframe.period, "0300-0945")))
strategy.exit("x_long","long", loss = sl)
     
    
strategy.entry("short",0,when=shortC)
//strategy.close("short",when = crossover(close,out) or not (timeinrange(timeframe.period, "0300-1000")))
strategy.close("short",when = not (timeinrange(timeframe.period, "0300-0945")))

strategy.exit("x_short","short", loss = sl)

//strategy.exit("closelong", "RSI_BB_LONG" , profit = close * 0.01 / syminfo.mintick, loss = close * 0.01 / syminfo.mintick, alert_message = "closelong")
//strategy.exit("closeshort", "RSI_BB_SHORT" , profit = close * 0.01 / syminfo.mintick, loss = close * 0.01 / syminfo.mintick, alert_message = "closeshort")