OPEN-SOURCE SCRIPT

Sigma Bands with Prime Bands TP

360
Sigma Bands with Prime Bands TP
📊 Indicator Description
This is a comprehensive trading indicator that combines Sigma Bands (Bollinger Bands style) with Prime Bands (ChartPrime methodology) to provide both entry signals and take profit signals.

🎯 Core Logic
📈 Entry Signals (Sigma Bands)
BUY Signal: When EMA crosses ABOVE the Mean Band (SMA)

SELL Signal: When EMA crosses BELOW the Mean Band (SMA)

🎯 Take Profit Signals (Prime Bands)
BUY TP: When EMA crosses BELOW the Prime Upper Band (from above to below)

SELL TP: When EMA crosses ABOVE the Prime Lower Band (from below to above)

⚙️ Input Parameters
Sigma Settings
Parameter Description Default
SMA Length Length for the Mean Band calculation 50
EMA Length Length for EMA calculation (entry signals) 20
EMA Source Price source for EMA (Close, HL2, OHLC4, HLC3) Close
Price Source Price source for bands (Close, HL2, OHLC4, etc.) Close
Prime Bands Settings
Parameter Description Default
Prime Length Look-back length for Prime Bands 50
Standard Deviation Band width multiplier (1-3) 3
Upper Band Color Color for the upper band #48d81c
Lower Band Color Color for the lower band #d8611c
Display Options
Parameter Description
Show +1σ / -1σ Toggle visibility of 1st standard deviation bands
Show +2σ / -2σ Toggle visibility of 2nd standard deviation bands
Show +3σ / -3σ Toggle visibility of 3rd standard deviation bands
Show Mean Band Toggle Mean Band visibility
Show EMA Line Toggle EMA line visibility
Show Prime Bands Toggle Prime Bands visibility
Show Prime Signals Toggle Prime crossover signals
Show Buy/Sell Signals Toggle entry signals
Show Take Profit Signals Toggle TP signals
Show Info Table Toggle information table
Table Position Table location (Top Right, Top Left, Bottom Right, Bottom Left)
📊 Visual Elements
Sigma Bands
Mean Band: Gray line (SMA)

±1σ: Semi-transparent green/red lines

±2σ: Less transparent green/red lines

±3σ: Solid green/pink lines

Prime Bands
Upper Band: Green line (user-selectable color)

Middle Band: Semi-transparent gray line

Lower Band: Red line (user-selectable color)

Signals
Signal Label Color Location
BUY BUY Green Below bar
SELL SELL Red Above bar
BUY TP TP▲ Lime Above bar
SELL TP TP▼ Pink Below bar
EMA ↑ Lower ↑L Red Below bar
EMA ↓ Upper ↓U Green Above bar
🔔 Alerts
Entry Alerts
🔵 BUY: EMA crosses ABOVE Mean Band

🔴 SELL: EMA crosses BELOW Mean Band

Prime Bands Alerts
🟢 EMA Crosses Above Lower Band

🔴 EMA Crosses Below Upper Band

Take Profit Alerts
✅ BUY TP: EMA crosses BELOW Upper Prime Band

✅ SELL TP: EMA crosses ABOVE Lower Prime Band

📋 Information Table
The indicator displays a comprehensive table showing:

All band values (Prime Upper/Lower, Sigma 1-3σ, Mean)

EMA value

Current price

Position status (BUY/SELL/NONE)

TP Status (WAITING/TP ✓)

🎯 Trading Strategy Logic
Bullish Scenario
text
1. EMA crosses ABOVE Mean Band

2. BUY Signal generated

3. Position opened

4. EMA rises to Upper Prime Band

5. EMA crosses BELOW Upper Prime Band

6. BUY TP triggered (Take Profit)
Bearish Scenario
text
1. EMA crosses BELOW Mean Band

2. SELL Signal generated

3. Position opened

4. EMA falls to Lower Prime Band

5. EMA crosses ABOVE Lower Prime Band

6. SELL TP triggered (Take Profit)
🛠️ How to Use
Add the indicator to your chart in TradingView

Adjust parameters based on your trading style:

For shorter timeframes: Reduce SMA/EMA length

For longer timeframes: Increase SMA/EMA length

Adjust Prime Band deviation for sensitivity

Monitor signals on the chart

Set alerts for automatic notifications

Use the info table to track current values

⚠️ Important Notes
The indicator does not repaint - signals are reliable

Works on all timeframes - optimize parameters for each

Best used with trend confirmation - combine with other indicators

Always use proper risk management - set stop losses accordingly

📈 Recommended Settings by Timeframe
Timeframe SMA Length EMA Length Prime Length
1m-5m 20 10 20
15m-1h 50 20 50
4h-Daily 100 50 100
Weekly+ 200 100 200
🎨 Color Legend
Color Meaning
🟢 Green Bullish / Upper bands
🔴 Red Bearish / Lower bands
🟠 Orange EMA line
⚪ Gray Mean band / Middle bands
🟡 Yellow Highlighted values
🟣 Pink 3σ lower band
🟢 Lime Take Profit signals
Developed by: AlgoAlpha & ChartPrime Integration
Version: 1.0
Platform: TradingView Pine Script v6

This indicator is for educational and informational purposes only. Always conduct your own research before making trading decisions.

Aviso legal

As informações e publicações não se destinam a ser, e não constituem, conselhos ou recomendações financeiras, de investimento, comerciais ou de outro tipo fornecidos ou endossados pela TradingView. Leia mais nos Termos de Uso.