短期取引戦略

作者: リン・ハーンチャオチャン開催日:2023年10月25日 14:40:21
タグ:

img

概要

これは,チャネルブレイクに基づいた短期的取引戦略である.チャネルの上下レールのブレイクを使用して,トレンドの始まりと終わりを決定し,それに応じて取引決定を行う. 強いトレンド市場では,このブレイクアウト戦略は立派な利益を生むことができます.

戦略の論理

  1. この戦略では,まず,運河の上下線を建設するために,一定の期間における最高高位と最低低位を計算する.

  2. 価格が上方レールの上を突破したら,ロング,下方レールの下を突破したらショート.

  3. リスクを制御するために移動ストップ損失を使用します.ストップ損失はチャネルの中央線に設定されています.

  4. 選択可能な出口ルールは2つあります. 中央線に戻り,または移動ストップ損失に従う.前者は利益を迅速に実現し,後者はリスクを制御します.

  5. チャンネル期間や他のパラメータを調整して,異なる市場条件に最適化することができます.

利点分析

  1. 価格・チャネル関係を監視し 取引のルールを遵守するだけです

  2. トレンドに沿って取引する 逆トレンドリスクはない

  3. 透明で直感的なチャネルは 明確な入口信号を与えます

  4. 良い利益率は,ほとんどの場合満足のいく利益を得ることができます.

  5. 様々な市場での最適化のために多くの調整可能なパラメータがあります

リスク分析

  1. 脱出は失敗するかもしれない 閉じ込められる危険性がある 時間内にストップ損失が必要

  2. チャンネルは形成に時間がかかるので 範囲限定市場には適していません

  3. 中途半端のストップ損失に戻ることは,傾向を維持できないので,あまりにも保守的かもしれません.

  4. パラメータ最適化には 履歴データが必要で リアルタイムの取引では オーバーフィットが可能です

  5. ブレイクポイントの機械的取引は,取引頻度とスライプコストを増加させる可能性があります.

オプティマイゼーションの方向性

  1. 異なる時期のチャンネルを評価し,最適なチャンネルを選択します.

  2. 中央に戻り,ストップ損失を移動して,より良い出口メカニズムを見つける.

  3. ストップ・ロスの割合を最適化して ストップ・アウトの可能性を減らす

  4. トレンドフィルターを追加して不適切なブレイクトレードを避ける.

  5. ポジションの大きさを増やしてリスクをコントロールする

概要

一般的に,これは成熟した短期的なブレイクアウト戦略である. 明確なエントリールール,適切なリスク制御,そして一般的に良好な機能がある. パラメータ調整によってさらなる改善を達成することができる. しかし,固有の制限,異なる市場のために必要な調整を注意すべきである. 体系的に使用した場合,一貫した全体的な利益をもたらすべきである.


/*backtest
start: 2022-10-18 00:00:00
end: 2023-10-24 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// Strategy testing and optimisation for free Bitmex trading bot 
// © algotradingcc 

//@version=4
strategy("Channel Break [for free bot]", overlay=true, default_qty_type= strategy.percent_of_equity, initial_capital = 1000, default_qty_value = 20, commission_type=strategy.commission.percent, commission_value=0.075)

//Options
buyPeriod = input(13, "Channel Period for Long position")
sellPeriod = input(18, "Channel Period for Short position")
isMiddleExit = input(true, "Is exit on Base Line?")
takeProfit = input(46, "Take Profit (%) for position")
stopLoss = input(9, "Stop Loss (%) for position")

// Test Start
startYear = input(2005, "Test Start Year")
startMonth = input(1, "Test Start Month")
startDay = input(1, "Test Start Day")
startTest = timestamp(startYear,startMonth,startDay,0,0)

//Test End
endYear = input(2050, "Test End Year")
endMonth = input(12, "Test End Month")
endDay = input(30, "Test End Day")
endTest = timestamp(endYear,endMonth,endDay,23,59)

timeRange = time > startTest and time < endTest ? true : false

// Long&Short Levels
BuyEnter = highest(buyPeriod)
BuyExit = isMiddleExit ? (highest(buyPeriod) + lowest(buyPeriod)) / 2: lowest(buyPeriod)

SellEnter = lowest(sellPeriod)
SellExit = isMiddleExit ? (highest(sellPeriod) + lowest(sellPeriod)) / 2: highest(sellPeriod)

// Plot Data
plot(BuyEnter, style=plot.style_line, linewidth=2, color=color.blue, title="Buy Enter")
plot(BuyExit, style=plot.style_line, linewidth=1, color=color.blue, title="Buy Exit", transp=50)
plot(SellEnter, style=plot.style_line, linewidth=2, color=color.red, title="Sell Enter")
plot(SellExit, style=plot.style_line, linewidth=1, color=color.red, title="Sell Exit", transp=50)

// Calc Take Profits & Stop Loss
TP = 0.0
SL = 0.0
if strategy.position_size > 0
    TP := strategy.position_avg_price*(1 + takeProfit/100)
    SL := strategy.position_avg_price*(1 - stopLoss/100)

if strategy.position_size > 0 and SL > BuyExit
    BuyExit := SL
    
if strategy.position_size < 0
    TP := strategy.position_avg_price*(1 - takeProfit/100)
    SL := strategy.position_avg_price*(1 + stopLoss/100)

if strategy.position_size < 0 and SL < SellExit
    SellExit := SL
    
    
// Long Position    
if timeRange and strategy.position_size <= 0
    strategy.entry("Long", strategy.long, stop = BuyEnter)
strategy.exit("Long Exit", "Long", stop=BuyExit, limit = TP, when = strategy.position_size > 0)


// Short Position
if timeRange and strategy.position_size >= 0
    strategy.entry("Short", strategy.short, stop = SellEnter)
    
strategy.exit("Short Exit", "Short", stop=SellExit, limit = TP, when = strategy.position_size < 0)

// Close & Cancel when over End of the Test
if time > endTest
    strategy.close_all()
    strategy.cancel_all()


もっと