INVITE-ONLY SCRIPT

bolinger band breakout + atr trailing stop strategy [running]

106
1. Overview
This is a trend-following system that combines volatility breakouts with a long-term trend filter. It identifies momentum using Bollinger Bands and ensures trades are aligned with the major trend via a 200-period Simple Moving Average (SMA). The strategy features a dynamic Trailing Stop based on the median price and ATR, along with an automated position sizing engine that limits risk to a fixed percentage (default 2%) of equity.

2. Trading Logic
Long Entry:

Price crosses above the Upper Bollinger Band.

Price is currently trading above the 200-period SMA.

Executes only if there is no open position.

Short Entry:

Price crosses below the Lower Bollinger Band.

Price is currently trading below the 200-period SMA.

Executes only if there is no open position.

Exit (Trailing Stop):

The stop level is calculated as (High + Low) / 2 ± (ATR * 3).

The stop level updates dynamically to lock in profits and never moves backwards.

Real-time execution: The position is closed immediately when the price touches the stop level (intra-bar).

3. Key Features
Automated Risk Management: Automatically calculates the quantity based on the distance between the entry price and the initial stop loss to ensure you only risk 2% of your equity per trade.

Intra-bar Exits: Uses the strategy.exit stop parameter for real-time protection, reacting to price movements instantly rather than waiting for the candle to close.

Pine Script v6: Built with the latest TradingView engine for optimized performance and accuracy.

4. Trading Tips
Recommended Timeframes: Best suited for 1H, 4H, and Daily charts where trends are more established.

Market Conditions: This strategy excels in volatile trending markets. Be cautious during low-volatility consolidation phases to avoid "whipsaws."

Customization: Adjust the ATR Multiplier (default 3.0) and BB Multiplier according to the specific asset class (Crypto, Stocks, or Forex) to fine-tune performance.

1. 개요 (Overview)
본 전략은 변동성 돌파와 장기 추세 필터를 결합한 추세 추종 시스템입니다. 볼린저 밴드를 통해 가격의 과열 및 돌파를 감지하고, 200일 단순이동평균선(SMA)을 사용하여 시장의 큰 흐름에 순응하는 방향으로만 진입합니다. 특히, 고가와 저가의 중간값을 활용한 ATR 트레일링 스탑을 통해 수익을 보존하고 손실을 제한하며, 자산 대비 고정 리스크(2%)를 적용하는 자동 수량 계산 로직이 포함되어 있습니다.

2. 매매 로직 (Trading Logic)
롱 진입 (Long Entry):

종가가 볼린저 밴드 상단선을 돌파할 때.

동시에 종가가 200일 SMA 필터 위에 위치할 때.

현재 보유 중인 포지션이 없을 때만 진입.

숏 진입 (Short Entry):

종가가 볼린저 밴드 하단선을 하향 돌파할 때.

동시에 종가가 200일 SMA 필터 아래에 위치할 때.

현재 보유 중인 포지션이 없을 때만 진입.

청산 (Exit - Trailing Stop):

고가와 저가의 중간값((High + Low) / 2)을 기준으로 ATR의 3배수만큼 떨어진 지점에 스탑 라인을 설정합니다.

가격이 유리하게 움직일 때만 스탑 라인이 좁혀지며, **종가가 아닌 실시간 가격(Intra-bar)**이 이 라인에 닿는 순간 즉시 청산됩니다.

3. 핵심 기능 (Key Features)
자동 자금 관리 (Position Sizing): 사용자가 설정한 '회당 리스크 비율(기본 2%)'에 따라 진입 시점의 스탑 거리를 계산하여 수량을 자동으로 조절합니다.

실시간 청산: strategy.exit의 stop 기능을 사용하여 슬리피지를 최소화하고 변동성에 즉각 대응합니다.

Pine Script v6: 최신 버전 엔진을 사용하여 높은 정확도와 성능을 보장합니다.

4. 사용 팁 (Trading Tips)
추천 타임프레임: 추세가 명확히 발생하는 1시간봉, 4시간봉, 혹은 일봉 차트에서 가장 효과적입니다.

시장 상황: 횡보장(Sideways)에서는 잦은 손절이 발생할 수 있으므로, 변동성이 동반된 추세장에서 사용을 권장합니다.

최적화: 자산군(주식, 코인, 외환)에 따라 ATR 승수(기본 3.0)와 볼린저 밴드 승수를 조정하여 최적의 값을 찾으시기 바랍니다.

إخلاء المسؤولية

لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.