Order Block Strategy by vinay_poojary

By vinay_poojary

Performance Metrics

Description

Order Block Strategy🎯 OverviewThis strategy automates the detection of Order Blocks (Institutional Supply & Demand Zones) using swing pivot highs and lows. It provides clear visual zone plotting and executes trades when price mitigates these zones, protecting your capital via adaptive risk management tools.Unlike static strategies, this system includes dual risk management logic (ATR-based and Percentage-based), allowing you to trade safely across highly volatile crypto assets, forex pairs, or traditional equities.🛠️ Key FeaturesAutomated Order Block Detection: Uses lookback swing pivots to isolate institutional footprint zones.Real-time On-Chart Boxes: Dynamically draws and fills bullish (green) and bearish (red) order blocks.Dual-Mode Stop Loss Engine: Toggle instantly between structural volatility tracking (ATR) or portfolio-based tracking (Percentage).Automated Trade Execution: Auto-calculates mathematically precise entries, stop losses, and take profit targets with fixed Risk-to-Reward (R:R) ratios.HUD Performance Dashboard: An integrated on-screen data table displaying your current active configuration for effortless tracking.🚦 How the Logic Works1. Zone Identification (Order Blocks)The script constantly monitors swing high and low points over a customizable lookback period.Bullish OB: Plotted when a key swing low forms, identifying the last down-close candle high/low range before an upward impulse.Bearish OB: Plotted when a key swing high forms, identifying the last up-close candle high/low range before a downward impulse.2. Trade Entry ConditionsLong Entry: Triggered when the current price drops into a valid Bullish Order Block zone, closes above its floor, and confirms momentum with a bullish close (close > open).Short Entry: Triggered when the current price rallies into a valid Bearish Order Block zone, closes below its ceiling, and confirms momentum with a bearish close (close < open).3. Execution & Risk EngineUpon entry validation, the strategy maps out an exact risk envelope:ATR Mode: Multiplies the Average True Range (ta.atr) by your multiplier to clear market noise.Percentage Mode: Sets a strict fixed-percentage risk buffer below or above your execution price.Take Profit: Automatically set using your custom Risk-to-Reward (R:R) ratio multiplier.⚙️ Configuration & Inputs ExplainedLookback Period: Change this to adjust pivot detection sensitivity. Higher values locate macro structural blocks; lower values locate micro intra-day blocks.ATR Length / Multiplier: Controls volatility filtering. The default 7.5x multiplier acts as a swing-trading buffer to prevent false-breakout stops.Risk:Reward Ratio: Dictates target sizing. A value of 1.5 means your profit target is exactly 1.5x larger than your capital risk.Stop Loss Mode: Dropdown to select your preferred risk methodology (ATR vs Percentage).⚠️ DisclaimerPast performance does not guarantee future results. This script is designed as an automated trading framework and should be thoroughly backtested on your preferred assets and timeframes before deployment with live capital.

Browse all 5,900+ TradingView Pine Script strategies

View on TradingView