OPEN-SOURCE SCRIPT

bollinger bands

97
What the indicator is (Generated by trade-pilot.app Builder)

This is a hybrid trend/continuation + EMA crossover signal indicator that generates LONG/SHORT entries only when multiple filters agree. It’s built to avoid “random” signals by forcing confirmation from trend direction, volatility, and risk/reward conditions, and it can also restrict signals to a specific trading session + timezone.

Main modules inside the code
1) Session filter (time-based)

The script checks if the current bar is inside the chosen session (default 09:30–16:00 New York time).

✅ Signals only trigger inSession
❌ No signals outside session

This helps you avoid entries during dead/low-quality hours.

2) Bollinger “Continuation Setup”

It calculates Bollinger Bands (default Length 20, Mult 2) and looks for a continuation pattern:

Trend detection (slope-based):

It measures the slope of the Bollinger middle band (basis).

If slope is up and price is above the basis → uptrend

If slope is down and price is below the basis → downtrend

Pullback + confirmation:

Long setup: price makes a pullback toward the middle band area (without breaking too deep) and then prints a bullish confirmation candle closing above the basis.

Short setup: same idea but reversed (pullback up + bearish confirmation candle closing below the basis).

✅ Result: signals that aim to catch trend continuation after a pullback, not random touches.

3) Stop & Target visualization (Bollinger-based)

When a continuation setup happens, the script calculates:

Stop (long): near the middle band / recent lowest lows

Stop (short): near the middle band / recent highest highs

Target (long): upper Bollinger band

Target (short): lower Bollinger band

On the chart (like in your screenshot), you see:

Bollinger Bands

Stop/target points shown as colored circles when a setup triggers

This makes it easier to visually understand the trade structure.

4) Bandwidth filter (volatility filter)

It calculates Bollinger Bandwidth (percentage width of the bands).

Signal only passes if:

Bandwidth ≥ minimum threshold (default 0.8%)

✅ Helps avoid trading when volatility is too low (chop / squeeze conditions).

5) Risk:Reward filter (quality filter)

This part estimates whether the trade has enough “room” to make sense:

Stop distance is ATR-based: ATR × multiplier

Target distance is approximated using recent swing potential:

Long: distance to recent highest high (last 10 bars)

Short: distance to recent lowest low (last 10 bars)

Then it calculates:

RR = targetDistance / stopDistance
and requires:

RR ≥ minimum RR (default 1.0)

✅ Helps filter out trades where the potential reward is too small compared to risk.

6) EMA crossover signals (secondary signal engine)

It also plots:

Fast EMA (default 20)

Slow EMA (default 50)

It generates extra signals on:

Bullish crossover (fast crosses above slow)

Bearish crossunder

So final signals can come from:

Bollinger continuation OR

EMA crossover
…but still must pass bandwidth + RR + session filters.

Final signal rule (important)

A LONG is printed only when:

(Bollinger continuation long OR EMA bullish crossover)

AND bandwidth filter passes

AND RR filter passes

AND inside session

Same logic for SHORT.

That’s why the signals are more selective.

What you see on the chart (like your screenshot)

Bollinger Bands (upper/middle/lower)

EMA fast + EMA slow

Red/green arrows for entries

“LONG/SHORT” labels on signal candles

Optional alert triggers for automation

How it helps traders

✅ Cleaner entries (trend + pullback continuation + confirmation)
✅ Less chop (volatility bandwidth filter)
✅ Better trade quality (risk/reward filter)
✅ Session control (only trade when market conditions are best)
✅ Easy visual decision making (bands, EMAs, and stop/target markers on the chart)
✅ Alerts-ready for live notifications

Small note (so you don’t get surprised)

You have an input called “Show Dashboard”, but the current code does not actually create a dashboard table (no table.new section exists). Everything else works as shown.

https://prnt.sc/IkSHNM0Cud42

면책사항

해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.