狭い範囲内での日間の脱出戦略

作者: リン・ハーンチャオチャン, 日付: 2023-09-15 14:34:11
タグ:

戦略の概要

狭い範囲内日間ブレイクストラテジーは,狭い範囲の振動と,長期間のトレンドのみをフォローする日間のブレイクストラテジーを識別する.価格の狭い範囲,インサイドデイ,SMAの傾斜が上昇するときに,ブレイク後のトレンドを捕捉するために長信号を生成する.

戦略の論理

  1. 過去7日間の最も狭い範囲の日を識別するために NR7 を使用します.

  2. 前日の高値が現在の高値よりも低く,前日の低値が現在の低値よりも高くなるかを判断するために,内日を使用します.

  3. NR7とインサイドデイが同時に発生し,閉店価格が開店価格より高くなった場合,ロングします.

  4. 次の日の閉店が開店より高くなると退場します

この戦略は,価格収縮とインサイドデイ信号の両方を活用して蓄積段階を特定する.SMAの傾斜が上昇すると,価格は突破する可能性が高い.このような多条件フィルタリングは精度を向上させる.

また,長期のみのアプローチは,統合の罠や不必要な取引を回避します.

戦略 の 利点

  • 日中の信号と日中の信号の両方を考慮します

  • SMAの方向はトレンドの存在を決定する

  • 多条件フィルタリングにより信号の精度が向上します

  • 統合の罠を避ける

  • バックテストのパラメータを最適化できる,柔軟性

危険 警告

  • 信号を最適化するために必要なSMAチューニング

  • ロングエントリーが遅れるかもしれない 脱出タイミングに集中する

  • ダウントレンドから利益を得られない

  • 範囲の再拡大を防ぐ

結論

狭い範囲内日間のブレイクアウト戦略は,市場構造を徹底的に調査し,高い確率の信号を生成する.パラメータチューニングにより,高度に適応可能である.この戦略はバックテスト,ライブ最適化,全体的な量子システムへの統合に価値がある.


/*backtest
start: 2023-09-11 00:00:00
end: 2023-09-14 00:00:00
period: 10m
basePeriod: 1m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=2
strategy("NR7ID: Narrow Range + Inside Day, Long Only Strategy (by ChartArt)", shorttitle="CA_-_NR7ID_Strat", overlay=true) // max_bars_back=5000

// ChartArt's Narrow Range + Inside Day Strategy (Long Only)
//
// Version 1.0
// Idea by ChartArt on Oktober 16, 2016.
//
// This long only strategy determines when there is both
// a NR7 (narrow range 7, a trading day in which the range
// is narrower than any of the previous six days), plus a
// inside day (high of the current day is lower than the high
// of the previous day and the low of the current day is higher
// than the low of the previous day) both on the same trading day
// and enters a long trade when the close is larger than the
// open and the slope of the simple moving average is upwards, too.
//
// The strategy exits the long trade next time the close is
// larger than the open in any of the next trading days.
//
// In addition the NR7ID can be colored (if close large open
// colored in green, else in red) and the SMA can be drawn
// with a color based on the direction of the SMA slope.
//
// List of my work: 
// https://www.tradingview.com/u/ChartArt/
// 
//  __             __  ___       __  ___ 
// /  ` |__|  /\  |__)  |   /\  |__)  |  
// \__, |  | /~~\ |  \  |  /~~\ |  \  |  
// 
// 


// NR7 Identifier
show_NR7=input(true, type=bool,title="Show Narrow Range 7 (NR7) ?")
range=(high-low)
nr7=(range < range[1]) and (range < range[2]) and (range < range[3]) and (range < range[4]) and (range < range[5]) and (range < range[6])
plotchar(show_NR7?nr7:na, char="7", location=location.abovebar, color=blue)

// Inside Day Identifier
show_insidebar = input(true, type=bool,title="Show Inside Day (I) ?")
insidebar =  (high < high[1] and low > low[1])
plotchar(show_insidebar?insidebar:na, char="i", location=location.abovebar, color=blue)

// NR7 + Inside Day Identifier
show_NR7ID = input(true, type=bool,title="Show NR7ID (NR7 + Inside Day) colors ?")
NR7ID = nr7 and insidebar
NR7ID_color = NR7ID and open < close ? green : NR7ID and open > close ? red : gray
barcolor(show_NR7ID?NR7ID_color:na)

// Simple Moving Average
show_ma = input(true, type=bool,title="Show SMA ?")
ma_length = input(14,title="SMA Length")
ma = sma(close,ma_length)
ma_change = change(ma) > 0
ma_change_color = change(ma) > 0 ? green : change(ma) < 0 ? red : blue
plot(show_ma?ma:na,color=ma_change_color,linewidth=3)

// (not enabled) Short Strategy: NR7 + Inside Day + close is smaller than open + change of SMA is downwards
//strategy.entry("sell", strategy.short, when = NR7ID and open > close and ma_change == false, comment="Short")
//strategy.close("sell", when = open > close )

// Long Strategy: NR7 + Inside Day + close is larger than open + change of SMA is upwards
strategy.entry("long", strategy.long, when = NR7ID and open < close and ma_change == true, comment="Long")
strategy.close("long", when = open < close )

もっと