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.
Script open-source
Nello spirito di TradingView, l'autore di questo script lo ha reso open source, in modo che i trader possano esaminarne e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricordiamo che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni e le pubblicazioni non sono intese come, e non costituiscono, consulenza o raccomandazioni finanziarie, di investimento, di trading o di altro tipo fornite o approvate da TradingView. Per ulteriori informazioni, consultare i Termini di utilizzo.
Script open-source
Nello spirito di TradingView, l'autore di questo script lo ha reso open source, in modo che i trader possano esaminarne e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricordiamo che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni e le pubblicazioni non sono intese come, e non costituiscono, consulenza o raccomandazioni finanziarie, di investimento, di trading o di altro tipo fornite o approvate da TradingView. Per ulteriori informazioni, consultare i Termini di utilizzo.