월간 트렌드 브레이크 전략

저자:차오장, 날짜: 2023-10-24 16:08:33
태그:

img

전반적인 설명

월간 트렌드 브레이크아웃 전략 (Monthly Trend Breakout Strategy) 은 파인 스크립트를 기반으로 한 트레이딩뷰 지표이다. 적응 이동 평균, 트렌드 라인 브레이크아웃 및 RSI 지표를 결합하여 한 달에 한 번 긴 엔트리 신호를 결정한다. RSI가 과잉 구매 조건을 표시 할 때 출입이 발생합니다.

전략 논리

  1. 마지막 입력 달을 추적 하려면 변수 lastEntryMonth를 정의 합니다. currentMonth는 현재 달을 얻습니다.

  2. TRAMA 적응형 MA 매개 변수를 설정합니다. 길이=99로 평탄한 가격을 설정하고 추세를 결정합니다.

  3. 주축 최고치를 기반으로 트렌드 라인 상부를 그리기 위해 길이_트렌드=14를 설정합니다. 가격이 트렌드 라인 위에 깨지면 길습니다.

  4. rsiLength=14와 함께 RSI 지표를 계산하여 과잉 구매/ 과잉 판매를 결정합니다.

  5. 엔트리 로직: 엔트리가 종료되면 장거리 > TRAMA로 이동하고, 지난 달엔 엔트리가 종료되지 않은 경우, 상위 트렌드 라인 이상의 브레이크를 닫습니다.

  6. 출구 논리: RSI > 70 (가장 구매) 이면 긴 문을 닫습니다.

  7. 트라마 라인과 RSI가 70 수준을 초과했습니다.

이 전략은 3개의 주요 기술 지표를 결합하여 한 달에 한 번 저위험의 긴 엔트리를 찾습니다. 엔트리는 트렌드 브레이크에만 제한되며 범위의 윙사 (whipsaws) 를 피합니다.

장점

  1. 강력한 시장 분석과 더 높은 정확성을 위해 여러 지표를 결합합니다.

  2. 매월 적립을 한정하여 과잉 거래를 피합니다.

  3. 적응성 있는 MA는 트렌드 변화에 빠르게 적응합니다.

  4. 과잉 판매 RSI는 시장 최고 가격에 구매를 피하고 위험을 통제합니다.

  5. 간단한 입국/출국 규칙은 쉽게 적용됩니다.

  6. 커스터마이징 가능한 매개 변수는 전략 최적화를 허용합니다.

위험성

  1. 파업이 실패할 경우 리스크를 절감하고, 트렌드 라인 아래로 떨어지면 손실을 멈추게 합니다.

  2. 잘못된 타이밍이 꼭대기 근처에 진입하게 합니다.

  3. 잘못된 지표 매개 변수는 잘못된 신호를 유발합니다.

  4. 브레이크업은 최근 시장 변동성을 반영할 수 있습니다. 적응적 정지 / 포지션 사이징을 고려하십시오.

  5. 위험/이익을 모니터링합니다. 단지 트레이딩 풀백이나 다른 확인 필터를 추가하는 것을 고려하십시오.

  6. 여러 시간 프레임에서 지표를 검증합니다. 트렌드를 식별하기 위해 더 높은 시간 프레임을 사용 하 여 입문 하 고.

  7. 다른 시장 조건에 대한 백테스트. 시장 유형에 전략을 맞추기 위해 매개 변수를 최적화합니다.

최적화

  1. 부피 표시기를 추가하면 부피가 낮으면 잘못된 파열을 피합니다.

  2. 부분 수익을 고려해 보죠. 부분 지위를 유지하면서 RSI가 과잉 매입된 출입을 취합니다.

  3. 트렌드 변화에 더 잘 적응하기 위해 MA 매개 변수를 최적화합니다.

  4. 반전 시 바로 구매를 피하기 위해 브레이크 포인트 전/후 영역을 추가합니다.

  5. 더 많은 필터를 추가해 더 높은 정확성을 위해 채널, 변동성을 추가합니다.

  6. 새로운 저항 수준에서 추가적인 파업으로 확장하십시오.

결론

월간 트렌드 브레이크아웃 전략은 트렌드, 모멘텀 및 극단적 상황을 분석합니다. 월간 시간 프레임에서 트렌드를 결정하지만 더 짧은 시간 프레임 브레이크아웃에 진입합니다. RSI는 리스크 관리를 감독합니다. 간단한 논리는 최적화된 월간 긴 항목을 식별합니다. 트렌드 다음과 리스크 통제를 균형있게합니다. 매개 변수 최적화는 다른 시장 조건에 적응합니다. 전반적으로 이것은 사용성과 효과적인 리스크 관리를 결합하는 간단하지만 견고한 전략입니다.


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

//@version=5
strategy('Bannos Strategy', shorttitle='Bannos', overlay=true)

//The provided script is an indicator for TradingView written in Pine Script version 5. The indicator is used to determine entry and exit points for a trading strategy. Here's a detailed breakdown of what the script does:

// Strategy Definition:

// Bannos Strategy is the full name, with a short title Bannos.
// The overlay=true option indicates that the strategy will be overlayed on the price chart.
// Tracking Entry Month:

// A variable lastEntryMonth is set up to track the month of the last entry.
// currentMonth identifies the current month.
// Trend Regularity Adaptive Moving Average (TRAMA):

// It takes an input of length 99 as default.
// It uses adaptive calculations to track trend changes.
// Trendlines with Breaks:

// Identifies local peaks over a given period (in this case, 14) and calculates a slope based on these peaks.
// Relative Strength Index (RSI):

// Uses a length of 14 (default) to calculate the RSI.
// RSI is an oscillation indicator that indicates overbought or oversold conditions.
// Strategy Logic for Long Entry:

// A long position is opened if:
// The close price is above the TRAMA.
// There's a crossover of the close price and the upper trendline.
// The position is taken only once per month.
// Strategy Logic for Long Exit:

// The long position is closed if the RSI exceeds 70, indicating an overbought condition.
// Plotting:

// The TRAMA is plotted in red on the chart.
// A horizontal line is also drawn at 70 to indicate the RSI's overbought zone.
// In summary, this strategy aims to enter a long position when certain trend and crossover conditions are met, and close the position when the market is considered overbought as per the RSI. Additionally, it ensures entries only occur once a month.
//



// Variable pour suivre le mois de la dernière entrée
var float lastEntryMonth = na
currentMonth = month(time)

// Parameters for Trend Regularity Adaptive Moving Average (TRAMA)
length_trama = input(99)
src_trama = close
ama = 0.
hh = math.max(math.sign(ta.change(ta.highest(length_trama))), 0)
ll = math.max(math.sign(ta.change(ta.lowest(length_trama)) * -1), 0)
tc = math.pow(ta.sma(hh or ll ? 1 : 0, length_trama), 2)
ama := nz(ama[1] + tc * (src_trama - ama[1]), src_trama)

// Parameters for Trendlines with Breaks
length_trend = 14
mult = 1.0
ph = ta.pivothigh(length_trend, length_trend)
upper = 0.
slope_ph = 0.
slope_ph := ph ? mult : slope_ph
upper := ph ? ph : upper - slope_ph

// Parameters for RSI
rsiLength = 14
up = ta.rma(math.max(ta.change(close), 0), rsiLength)
down = ta.rma(-math.min(ta.change(close), 0), rsiLength)
rsi = down == 0 ? 100 : up == 0 ? 0 : 100 - (100 / (1 + up / down))

// Strategy Logic for Long Entry
longCondition = close > ama and ta.crossover(close, upper) and (na(lastEntryMonth) or lastEntryMonth != currentMonth)
if (longCondition)
    lastEntryMonth := currentMonth
    strategy.entry('Long', strategy.long)

// Strategy Logic for Long Exit
exitCondition = rsi > 70
if (exitCondition)
    strategy.close('Long')

// Plotting
plot(ama, 'TRAMA', color=color.red)
hline(70, 'Overbought', color=color.red)


더 많은