OPEN-SOURCE SCRIPT
Zaktualizowano

Discipline Box Trader — by chaitu50c

1 180
Discipline Box Trader — by chaitu50c is a rule-based price action tool built around alternating candle structures.
For each session, the indicator detects FIRST key alternating zone, marks it as a gray “Discipline Box”, and then tracks how price breaks and rotates through that zone with clear green/red segments.

The idea is simple:
The script continuously looks for alternating candle sequences:
Red → Green → Red → Green …
or
Green → Red → Green → Red …
When the sequence reaches your minimum required length (Min candles in alternate combo), it:
Finds the highest high and lowest low of that entire alternation combo.
Draws a gray rectangular box from the start of the combo to its end.
This gray region is named the “Discipline Box”.
After this Discipline Box is created:
Upside breakout → close > box high
Downside breakout → close < box low

For example if, Upside Breakout → Green Regime Segment
The gray box is visually closed at the previous bar.
A new green box segment starts from the breakout bar.
Box fill, border, and center line all turn green.
This green segment extends to the right until another breakout flips the regime.
There is a small visible gap between the gray box and the new coloured segment, clearly showing where the breakout actually occurred.
Within the same session, price may:
Break up → green segment.
Later break down through the same band → red segment.
Possibly flip again.

All of this happens inside the one original Discipline Box, giving a clean visual map of who is in control now without creating new zones.

Reset Mode
None
No automatic reset; box can persist across all data.

New Day

At each new trading day:
Current box and center line are closed.
All internal counters reset.
A completely fresh Discipline Box can form for the new day.

Gap Minutes

If time between candles exceeds Gap Threshold (minutes):
Treat this as a session break.
Close the current box and restart detection after the gap.

This ensures clarity and separation between sessions and prevents overlapping “old” structure from dominating new market conditions.

Trading Framework: 2 Trades per Discipline Box

⚠️ This is not financial advice. This is a structured usage idea to support discipline.
A suggested trading framework to pair with this indicator:
Trade 1 — First Breakout Trade
Wait for the first body-based breakout from the Discipline Box:
Upside breakout → consider a single long trade.
Downside breakout → consider a single short trade.
Use the box high, low, and midline as reference points for:
Stop placement, partial exits, or risk-reward zones.

Trade 2 — Opposite Regime Flip
If price later breaks the opposite side of the same box:
Consider exactly one more trade in the new direction (a failed breakout / reversal play).
Example: green regime first, later broken down into red → potential short trade.
After these maximum 2 trades per Discipline Box, you can:
Skip additional trades inside that session’s structure.
Wait patiently for the next session and next Discipline Box to form.

This hard rule helps avoid over-trading, revenge trades, and emotional interference — staying faithful to the “Discipline” theme.

The indicator has a built-in alert condition: Discipline Box Detected
Triggers Whenever a new gray Discipline Box is created (i.e., the first valid alternation zone for that session).

Practical Notes & Disclaimer

The indicator does not tell you when to buy or sell; it simply:
Marks a disciplined structure zone.
Shows live regime shifts (green/red).
Supports a clear “max 2 trades per box” framework.
Use on a demo first, adapt to your style, and always remember:
Your discipline matters more than the indicator.
Informacje o Wersji
Today’s update introduces a new “Strong Box” layer on top of the existing Initial Discipline Box logic, focused on capturing higher-quality alternating structures without losing the core discipline idea. The original box is now explicitly treated as the Initial Discipline Box, formed from the first valid alternating combo of the session, and its strength (number of alternates) is stored internally. On top of that, an optional Strong Box can now be enabled, with its own fill and border colours, which tracks only the strongest alternating combo of the session: it will form and update dynamically only when a newly detected combo has more alternates than both the minimum Strong Box threshold and the Initial Discipline Box strength, and also only when it is strictly stronger than any previously selected Strong Box. This means the Strong Box always represents the best, most “disciplined” alternating structure of the session, while the Initial Discipline Box continues to mark the first clean opportunity, and you can switch the Strong Box feature off entirely if you prefer to trade only from the original Discipline Box.
Informacje o Wersji
In this update the focus is on filtering out fake breakouts and making the visual signals clearer. The Discipline Box now treats a breakout as valid only when the candle’s close penetrates the box by a configurable percentage of its height (10% by default), so tiny spikes or marginal closes just outside the zone no longer trigger a signal. On top of that, the actual breakout candle can now be painted in custom colors based on direction (separate colors for upside and downside breaks), giving you an immediate visual cue for the bar that truly broke the box with sufficient strength. To keep the settings clean, all visuals are organised into three clear groups: Initial Discipline Box colors, Strong Box colors, and Breakout & Candle colors—so you can tune each layer of the tool independently while the breakout-strength filter helps you avoid weak, noisy moves.

Wyłączenie odpowiedzialności

Informacje i publikacje nie stanowią i nie powinny być traktowane jako porady finansowe, inwestycyjne, tradingowe ani jakiekolwiek inne rekomendacje dostarczane lub zatwierdzone przez TradingView. Więcej informacji znajduje się w Warunkach użytkowania.