OPEN-SOURCE SCRIPT
Body Close Outside Prior Body - BOS Filtered (MTF) by JK

Strategy: MTF Market Structure & Body Breakout (BOS Filtered)
Overview
This Pine Script strategy identifies high-probability trade entries by combining Price Action Engulfing/Breakout patterns with Multi-Timeframe Market Structure (BOS). It is designed for traders who want to follow the "Path of Least Resistance" by ensuring entries on a lower timeframe align with the trend of a higher timeframe.
Key Features
Multi-Timeframe (MTF) Filter: Automatically detects Break of Structure (BOS) on a higher timeframe (e.g., 15m) using Pivot Highs/Lows to determine the overall market bias.
Body-Close Logic: Unlike standard engulfing patterns, this entry triggers specifically when a candle body closes entirely outside the price action of the prior candle's body, signaling strong momentum.
Dynamic Risk Management: * Calculates position size automatically based on a fixed dollar amount ($200 by default) per trade.
Adjustable Stop Loss source (Wick-based for safety or Body-based for tighter entries).
Institutional Safeguards: * Daily Loss/Profit Limits: Stops trading once a specific dollar target or loss threshold is hit for the day.
Loss Streak Protection: Automatically halts trading after a user-defined number of consecutive losses to prevent revenge trading.
Post-Trade Cooldown: Forces a "wait period" (candle count) after an exit before a new entry can be taken.
Session Filtering: Restricts trading to specific hours (e.g., NYSE Open) to avoid low-liquidity chop.
Technical Logic
Market Bias: The script tracks PivotHigh and PivotLow on the BOS Timeframe. A close above the last Pivot High sets a Bullish bias; a close below the last Pivot Low sets a Bearish bias.
The Entry:
Long: Market Bias is Bullish + Prior candle was Bearish + Current candle is Bullish + Current Close is higher than the prior candle's Body High.
Short: Market Bias is Bearish + Prior candle was Bullish + Current candle is Bearish + Current Close is lower than the prior candle's Body Low.
Exit Strategy: Uses a fixed Risk:Reward ratio (Default 1:2). The Stop Loss is dynamically placed at the recent swing (wick) or the candle open.
Visual Dashboard
The strategy includes a real-time HUD (Heads-Up Display) in the top-right corner of the chart, tracking:
Current Trend Direction (MTF)
Current Daily P&L (USD)
Current Loss Streak vs. Maximum allowed.
Overview
This Pine Script strategy identifies high-probability trade entries by combining Price Action Engulfing/Breakout patterns with Multi-Timeframe Market Structure (BOS). It is designed for traders who want to follow the "Path of Least Resistance" by ensuring entries on a lower timeframe align with the trend of a higher timeframe.
Key Features
Multi-Timeframe (MTF) Filter: Automatically detects Break of Structure (BOS) on a higher timeframe (e.g., 15m) using Pivot Highs/Lows to determine the overall market bias.
Body-Close Logic: Unlike standard engulfing patterns, this entry triggers specifically when a candle body closes entirely outside the price action of the prior candle's body, signaling strong momentum.
Dynamic Risk Management: * Calculates position size automatically based on a fixed dollar amount ($200 by default) per trade.
Adjustable Stop Loss source (Wick-based for safety or Body-based for tighter entries).
Institutional Safeguards: * Daily Loss/Profit Limits: Stops trading once a specific dollar target or loss threshold is hit for the day.
Loss Streak Protection: Automatically halts trading after a user-defined number of consecutive losses to prevent revenge trading.
Post-Trade Cooldown: Forces a "wait period" (candle count) after an exit before a new entry can be taken.
Session Filtering: Restricts trading to specific hours (e.g., NYSE Open) to avoid low-liquidity chop.
Technical Logic
Market Bias: The script tracks PivotHigh and PivotLow on the BOS Timeframe. A close above the last Pivot High sets a Bullish bias; a close below the last Pivot Low sets a Bearish bias.
The Entry:
Long: Market Bias is Bullish + Prior candle was Bearish + Current candle is Bullish + Current Close is higher than the prior candle's Body High.
Short: Market Bias is Bearish + Prior candle was Bullish + Current candle is Bearish + Current Close is lower than the prior candle's Body Low.
Exit Strategy: Uses a fixed Risk:Reward ratio (Default 1:2). The Stop Loss is dynamically placed at the recent swing (wick) or the candle open.
Visual Dashboard
The strategy includes a real-time HUD (Heads-Up Display) in the top-right corner of the chart, tracking:
Current Trend Direction (MTF)
Current Daily P&L (USD)
Current Loss Streak vs. Maximum allowed.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.