OPEN-SOURCE SCRIPT

1-3-1 Strat Combo with 50% Level (12h)

Logic Explanation

1-3-1 Combo Detection:
The script detects the 1-3-1 pattern using the previous 3 candles:
Candle 4: Inside Bar (Type 1).
Candle 3: Outside Bar (Type 3).
Candle 2: Inside Bar (Type 1).

4th Candle Behavior:
If the 4th candle (current bar):
Stays an inside bar (Type 1) → isFourthInsideBar is true.
Becomes a directional bar (Type 2) → isFourthDirectional is true.
If either of these conditions is true, the script stops calculating and waits for the next valid 1-3-1 setup.

50% Level Calculation:
If the conditions are not met (e.g., the 4th candle doesn’t stop the pattern), the script:
Plots a dotted line at the 50% level of the 3rd candle.

Adds a label showing the 50% level.
Stop Calculations:
No line, box, or label is drawn if the 4th candle is a Type 1 (inside bar) or Type 2 (directional bar).

Visual Outputs:
Dotted Box: Marks the 1-3-1 combo setup.
50% Line: Drawn only if the 4th candle does not invalidate the pattern.
Label: Displays the 50% level of the 3rd candle.

How to Use:
Apply this script on the 12-hour chart.

The script will:
Detect valid 1-3-1 patterns.
Stop drawing any calculations if the 4th candle is an inside bar (1) or a directional bar (2).
Wait for the next valid 1-3-1 combo.
Candlestick analysisChart patterns

Skrip sumber terbuka

Dalam semangat sebenar TradingView, penulis telah menerbitkan kod Pine ini sebagai sumber terbuka supaya pedagang dapat memahami dan mengesahkannya. Sorakan kepada penulis! Anda boleh menggunakan perpustakaan ini secara percuma, tetapi penggunaan semula kod dalam penerbitan ini adalah dikawal oleh Peraturan dalaman. Anda boleh menyukainya untuk menggunakannya pada carta.

Ingin menggunakan skrip ini pada carta?

Penafian