좁은 범위 내 하루 탈출 전략

저자:차오장, 날짜: 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 )

더 많은