Smart Structure by Javad (Smart-STRAT)

Automatically Classify and Color STRAT 1/2/3 Candles in Real Time

Description:
Smart-STRAT is a precision candle-classifier and colorizer that applies The STRAT’s 1/2/3 logic as price unfolds. It evaluates each bar against the prior bar using strict breaks (equal highs/lows never count) to determine inside bars (1), directional bars (2up / 2down), and true outside bars (3). The indicator also tracks intra-bar order of events so it can correctly label failed 2s: if price breaks one side first and then reverses back inside the prior bar’s range without tagging the opposite side, the candle is colored as a failed 2. If it later tags both sides, it upgrades to a 3, which always takes precedence. Additionally, after a completed outside bar, the very next candle is flagged if it immediately fails that outside bar in the opposite direction. Smart-STRAT repaints the body, wick, and border for clear visibility on any chart theme, giving an at-a-glance read of structure both historically and in live markets.

Features:

  • :magnifying_glass_tilted_left: Automatic STRAT Classification: Detects 1 (inside), 2u/2d (directional), and 3 (outside) using strict > / < comparisons; equality never counts as a break.

  • :compass: Order-Aware Failed 2 Logic: Tracks which side broke first during the forming candle to mark failed 2 up or failed 2 down accurately when price returns inside without taking the other side.

  • :1st_place_medal: 3 Takes Precedence: If a candle eventually breaks both sides, it is a 3 and remains a 3; failed-2 colors never override a true outside bar.

  • :next_track_button: Next-Bar Failure Highlight: After a completed outside bar, the following candle is colored if it immediately invalidates that outside bar’s direction.

  • :artist_palette: Full Recoloring: Body, wick, and border are colored together for clean, unambiguous visuals (no thin overlays).

  • :high_voltage: Real-Time & Historical: Works tick-by-tick as bars form and remains consistent when you scroll back.

  • :puzzle_piece: Minimal, Fast, Compatible: Lightweight logic designed to run smoothly across symbols and timeframes.

Parameters:

  • insideColor — Color for 1 (inside) bars. (Default: #F8E71C*)*

  • outsideColor — Color for 3 (outside) bars. (Default: #8B572A*)*

  • failedBearOutsideBarColor — Color for failed 2 down and next-bar fail after bearish 3. (Default: #BD10E0*)*

  • failedBullOutsideBarColor — Color for failed 2 up and next-bar fail after bullish 3. (Default: #50E3C2*)*

  • bullColor — Color for 2u (directional up) when no failure state applies. (Default: #00C853*)*

  • bearColor — Color for 2d (directional down) when no failure state applies. (Default: #D50000*)*

Visual Output:

  • :yellow_square: Inside (1): Candle remains within prior bar’s high/low → painted insideColor.

  • :green_circle:/:red_circle: Directional (2u/2d): Breaks exactly one side → painted bullColor or bearColor by direction.

  • :brown_square: Outside (3): Breaks both sides → painted outsideColor; overrides any failed-2 state.

  • :purple_circle: Failed 2 Down: Broke the low first, then returned inside without breaking the prior high → painted failedBearOutsideBarColor.

  • :blue_square:/:green_square:-tone Failed 2 Up: Broke the high first, then returned inside without breaking the prior low → painted failedBullOutsideBarColor.

  • :next_track_button: Next-Bar Fail After a 3: The bar immediately after an outside bar that invalidates its direction is colored with the corresponding failed-outside color.

Ideal Use Case:
For traders applying The STRAT, Smart-STRAT delivers a faithful, live view of structural states and failure conditions without manual marking. It’s built for intraday and higher-timeframe analysis alike, clarifying context quickly so you can focus on execution rather than maintenance.

Contact me in discussions or at info@javadali.com for more info on this indicator.