OPEN-SOURCE SCRIPT
Aggiornato SQV Indicator Bridge

# SQV Indicator Bridge - Quick Guide
## What is SQV Indicator Bridge?
A simple connector that validates your indicator's signals using SQV Lite before displaying them on the chart. Only high-quality signals pass through.
## How It Works
```
Your Indicator → Generates Signals → SQV Lite → Validates Quality → Bridge → Shows Only Valid Signals
```
## Quick Setup (3 Steps)
### Step 1: Prepare Your Indicator
Add these lines to export your signals:
```pinescript
// At the end of your indicator code
plot(longCondition ? 1 : 0, "Long Signal", display=display.none)
plot(shortCondition ? 1 : 0, "Short Signal", display=display.none)
```
### Step 2: Add to Chart (in order)
1. Your indicator
2. SQV Lite
3. SQV Indicator Bridge
### Step 3: Connect Sources
In Bridge settings:
- **Long Signal Source** → Select: YourIndicator: Long Signal
- **Short Signal Source** → Select: YourIndicator: Short Signal
- **SQV Long Valid** → Select: SQV Lite: SQV Long Valid
- **SQV Short Valid** → Select: SQV Lite: SQV Short Valid
- **SQV Score** → Select: SQV Lite: SQV Score
## Visual Settings
| Setting | Description | Default |
|---------|-------------|---------|
| Show Labels | Display BUY/SELL labels | On |
| Label Offset | Distance from candles (0-5 ATR) | 0 |
| Label Size | Tiny, Small, or Normal | Small |
| Long Color | Color for buy signals | Green |
| Short Color | Color for sell signals | Red |
## What You'll See
- **Green "LONG" labels** - When your buy signal passes SQV validation
- **Red "SHORT" labels** - When your sell signal passes SQV validation
- **No label** - When signal quality is too low
## Common Issues & Solutions
### No labels appearing?
1. Check "Use External Signals" is ON in SQV Lite
2. Verify source connections are correct
3. Lower minimum score in SQV Lite (try 60)
4. Test your indicator separately to ensure it generates signals
### Too many/few signals?
- Adjust "Minimum Quality Score" in SQV Lite
- Default is 65, lower for more signals, higher for fewer
### Wrong signals showing?
- Check Trading Mode in SQV Lite matches your strategy (Long Only/Short Only/Both)
## Example Integration
### Simple MA Cross Indicator
```pinescript
//version=6
indicator("MA Cross with SQV", overlay=true)
// Your logic
fast = ta.sma(close, 20)
slow = ta.sma(close, 50)
longSignal = ta.crossover(fast, slow)
shortSignal = ta.crossunder(fast, slow)
// Plot MAs
plot(fast, color=color.blue)
plot(slow, color=color.red)
// Export for SQV Bridge (REQUIRED!)
plot(longSignal ? 1 : 0, "Long Signal", display=display.none)
plot(shortSignal ? 1 : 0, "Short Signal", display=display.none)
```
## Tips
✅ **DO**:
- Test in "Autonomous Mode" first (SQV Lite setting)
- Use clear signal names in your plots
- Keep signals binary (1 or 0)
❌ **DON'T**:
- Forget to add `display=display.none` to signal plots
- Use values other than 0 and 1 for signals
- Leave "Use External Signals" OFF in SQV Lite
## Alert Setup
1. Enable "Enable Alerts" in Bridge settings
2. Create alert on Bridge (not your indicator)
3. Alert message includes SQV score
Example alert: `"Long Signal Validated | Score: 85"`
## Complete Bridge Code
```pinescript
//version=6
indicator("SQV Indicator Bridge", overlay=true)
// From your indicator
longSignal = input.source(close, "Long Signal Source", group="Signal Sources")
shortSignal = input.source(close, "Short Signal Source", group="Signal Sources")
// From SQV Lite
sqvLongValid = input.source(close, "SQV Long Valid", group="SQV Sources")
sqvShortValid = input.source(close, "SQV Short Valid", group="SQV Sources")
sqvScore = input.source(close, "SQV Score", group="SQV Sources")
// Settings
showLabels = input.bool(true, "Show Labels", group="Visual")
labelOffset = input.float(0.0, "Label Offset (ATR)", minval=0.0, maxval=5.0, step=0.5, group="Visual")
labelSize = input.string("small", "Label Size", options=["tiny", "small", "normal"], group="Visual")
longColor = input.color(color.green, "Long Color", group="Visual")
shortColor = input.color(color.red, "Short Color", group="Visual")
enableAlerts = input.bool(false, "Enable Alerts", group="Alerts")
// Logic
atr = ta.atr(14)
offset = labelOffset > 0 ? atr * labelOffset : 0
hasValidLong = longSignal > 0 and sqvLongValid > 0 and barstate.isconfirmed
hasValidShort = shortSignal > 0 and sqvShortValid > 0 and barstate.isconfirmed
// Show labels
if showLabels
if hasValidLong
label.new(bar_index, low - offset, "LONG",
style=label.style_label_up,
color=longColor,
textcolor=color.white,
size=labelSize == "tiny" ? size.tiny :
labelSize == "small" ? size.small : size.normal)
if hasValidShort
label.new(bar_index, high + offset, "SHORT",
style=label.style_label_down,
color=shortColor,
textcolor=color.white,
size=labelSize == "tiny" ? size.tiny :
labelSize == "small" ? size.small : size.normal)
// Alerts
if enableAlerts
if hasValidLong
alert("Long Signal Validated | Score: " + str.tostring(sqvScore, "#"), alert.freq_once_per_bar_close)
if hasValidShort
alert("Short Signal Validated | Score: " + str.tostring(sqvScore, "#"), alert.freq_once_per_bar_close)
```
---
**Need help?** Check the full SQV documentation or contact through TradingView messages.
## What is SQV Indicator Bridge?
A simple connector that validates your indicator's signals using SQV Lite before displaying them on the chart. Only high-quality signals pass through.
## How It Works
```
Your Indicator → Generates Signals → SQV Lite → Validates Quality → Bridge → Shows Only Valid Signals
```
## Quick Setup (3 Steps)
### Step 1: Prepare Your Indicator
Add these lines to export your signals:
```pinescript
// At the end of your indicator code
plot(longCondition ? 1 : 0, "Long Signal", display=display.none)
plot(shortCondition ? 1 : 0, "Short Signal", display=display.none)
```
### Step 2: Add to Chart (in order)
1. Your indicator
2. SQV Lite
3. SQV Indicator Bridge
### Step 3: Connect Sources
In Bridge settings:
- **Long Signal Source** → Select: YourIndicator: Long Signal
- **Short Signal Source** → Select: YourIndicator: Short Signal
- **SQV Long Valid** → Select: SQV Lite: SQV Long Valid
- **SQV Short Valid** → Select: SQV Lite: SQV Short Valid
- **SQV Score** → Select: SQV Lite: SQV Score
## Visual Settings
| Setting | Description | Default |
|---------|-------------|---------|
| Show Labels | Display BUY/SELL labels | On |
| Label Offset | Distance from candles (0-5 ATR) | 0 |
| Label Size | Tiny, Small, or Normal | Small |
| Long Color | Color for buy signals | Green |
| Short Color | Color for sell signals | Red |
## What You'll See
- **Green "LONG" labels** - When your buy signal passes SQV validation
- **Red "SHORT" labels** - When your sell signal passes SQV validation
- **No label** - When signal quality is too low
## Common Issues & Solutions
### No labels appearing?
1. Check "Use External Signals" is ON in SQV Lite
2. Verify source connections are correct
3. Lower minimum score in SQV Lite (try 60)
4. Test your indicator separately to ensure it generates signals
### Too many/few signals?
- Adjust "Minimum Quality Score" in SQV Lite
- Default is 65, lower for more signals, higher for fewer
### Wrong signals showing?
- Check Trading Mode in SQV Lite matches your strategy (Long Only/Short Only/Both)
## Example Integration
### Simple MA Cross Indicator
```pinescript
//version=6
indicator("MA Cross with SQV", overlay=true)
// Your logic
fast = ta.sma(close, 20)
slow = ta.sma(close, 50)
longSignal = ta.crossover(fast, slow)
shortSignal = ta.crossunder(fast, slow)
// Plot MAs
plot(fast, color=color.blue)
plot(slow, color=color.red)
// Export for SQV Bridge (REQUIRED!)
plot(longSignal ? 1 : 0, "Long Signal", display=display.none)
plot(shortSignal ? 1 : 0, "Short Signal", display=display.none)
```
## Tips
✅ **DO**:
- Test in "Autonomous Mode" first (SQV Lite setting)
- Use clear signal names in your plots
- Keep signals binary (1 or 0)
❌ **DON'T**:
- Forget to add `display=display.none` to signal plots
- Use values other than 0 and 1 for signals
- Leave "Use External Signals" OFF in SQV Lite
## Alert Setup
1. Enable "Enable Alerts" in Bridge settings
2. Create alert on Bridge (not your indicator)
3. Alert message includes SQV score
Example alert: `"Long Signal Validated | Score: 85"`
## Complete Bridge Code
```pinescript
//version=6
indicator("SQV Indicator Bridge", overlay=true)
// From your indicator
longSignal = input.source(close, "Long Signal Source", group="Signal Sources")
shortSignal = input.source(close, "Short Signal Source", group="Signal Sources")
// From SQV Lite
sqvLongValid = input.source(close, "SQV Long Valid", group="SQV Sources")
sqvShortValid = input.source(close, "SQV Short Valid", group="SQV Sources")
sqvScore = input.source(close, "SQV Score", group="SQV Sources")
// Settings
showLabels = input.bool(true, "Show Labels", group="Visual")
labelOffset = input.float(0.0, "Label Offset (ATR)", minval=0.0, maxval=5.0, step=0.5, group="Visual")
labelSize = input.string("small", "Label Size", options=["tiny", "small", "normal"], group="Visual")
longColor = input.color(color.green, "Long Color", group="Visual")
shortColor = input.color(color.red, "Short Color", group="Visual")
enableAlerts = input.bool(false, "Enable Alerts", group="Alerts")
// Logic
atr = ta.atr(14)
offset = labelOffset > 0 ? atr * labelOffset : 0
hasValidLong = longSignal > 0 and sqvLongValid > 0 and barstate.isconfirmed
hasValidShort = shortSignal > 0 and sqvShortValid > 0 and barstate.isconfirmed
// Show labels
if showLabels
if hasValidLong
label.new(bar_index, low - offset, "LONG",
style=label.style_label_up,
color=longColor,
textcolor=color.white,
size=labelSize == "tiny" ? size.tiny :
labelSize == "small" ? size.small : size.normal)
if hasValidShort
label.new(bar_index, high + offset, "SHORT",
style=label.style_label_down,
color=shortColor,
textcolor=color.white,
size=labelSize == "tiny" ? size.tiny :
labelSize == "small" ? size.small : size.normal)
// Alerts
if enableAlerts
if hasValidLong
alert("Long Signal Validated | Score: " + str.tostring(sqvScore, "#"), alert.freq_once_per_bar_close)
if hasValidShort
alert("Short Signal Validated | Score: " + str.tostring(sqvScore, "#"), alert.freq_once_per_bar_close)
```
---
**Need help?** Check the full SQV documentation or contact through TradingView messages.
Note di rilascio
# SQV Bridge Scripts - Quick Start Guide### Connect Any Strategy to SQV in 2 Minutes (No Coding Required!)
---
## What are Bridge Scripts?
Bridge scripts are **ready-to-use connectors** that link your trading signals with SQV Lite validation. No need to modify any code - just connect via dropdown menus!
**Two Types Available:**
- **Strategy Bridge** - For automated trading with position management
- **Indicator Bridge** - For visual signals and alerts only
---
## Strategy Bridge - Full Trading Automation
### What It Does:
✅ Receives signals from ANY indicator/strategy
✅ Gets validation from SQV Lite
✅ Executes trades automatically
✅ Manages position sizes
✅ Sets stop losses and take profits
✅ Shows current position status
### 5-Minute Setup:
**Step 1: Add Scripts to Chart**
1. Add your indicator/strategy
2. Add SQV Lite
3. Add Strategy Bridge
**Step 2: Connect Your Indicator → Bridge**
In Strategy Bridge settings:
- Signal Sources → Long Signal Source → Select your indicator's long signal
- Signal Sources → Short Signal Source → Select your indicator's short signal
**Step 3: Connect SQV → Bridge**
Still in Strategy Bridge settings:
- SQV Sources → SQV Long Valid → "SQV Lite: SQV Long Valid"
- SQV Sources → SQV Short Valid → "SQV Lite: SQV Short Valid"
- SQV Sources → SQV Score → "SQV Lite: SQV Score"
**Step 4: Connect Your Indicator → SQV**
In SQV Lite settings:
- Signal Import → Enable "Use External Signals"
- External Long Signal Source → Your indicator's long signal
- External Short Signal Source → Your indicator's short signal
**Done!** The bridge now trades only validated signals.
### Advanced Options:
**Use Position Sizing from Your Strategy:**
- Your strategy exports: `plot(0.15, "Position Size Output", display=display.none)`
- Bridge setting: Enable "Use Position Size from Strategy"
- Connect the source
**Use Stop Loss/Take Profit from Your Strategy:**
- Your strategy exports stop/TP prices
- Bridge settings: Enable respective options
- Connect the sources
---
## Indicator Bridge - Visual Signals Only
### What It Does:
✅ Shows labels only for validated signals
✅ Customizable label appearance
✅ Alert functionality
✅ No automated trading
✅ Perfect for manual traders
### Setup (Same as Strategy Bridge):
1. Add all three scripts
2. Connect indicator → Bridge
3. Connect SQV → Bridge
4. Connect indicator → SQV
### Customization Options:
- Label size (tiny/small/normal)
- Label colors
- Label offset from candles
- Alert messages
---
## Your Indicator Requirements
Your indicator/strategy only needs to export signals as plots:
```pinescript
// Minimum requirement - just two lines:
plot(longSignal ? 1 : 0, "Long Signal", display=display.none)
plot(shortSignal ? 1 : 0, "Short Signal", display=display.none)
```
**Signal Format:**
- Must be binary: 1 (true) or 0 (false)
- Use `display=display.none` to hide plots
- Clear plot titles for easy identification
---
## Complete Working Example
### 1. Simple RSI Indicator:
```pinescript
//version=6
indicator("RSI Signals", overlay=true)
rsi = ta.rsi(close, 14)
longSignal = ta.crossover(rsi, 30)
shortSignal = ta.crossunder(rsi, 70)
// This is all you need for bridge compatibility:
plot(longSignal ? 1 : 0, "RSI Long", display=display.none)
plot(shortSignal ? 1 : 0, "RSI Short", display=display.none)
```
### 2. Add SQV Lite + Strategy Bridge
### 3. Connect in Settings:
- RSI Signals → Strategy Bridge → SQV Lite (full circle)
### 4. Start Trading!
---
## Bridge vs Direct Integration
### Use Bridges When:
✅ You want the easiest setup
✅ You don't want to modify code
✅ You're testing multiple strategies
✅ You prefer visual configuration
### Use Direct Integration When:
- You need custom logic between signal and entry
- You want everything in one script
- You're an experienced Pine coder
- You need maximum performance
---
## FAQ
**Q: Can I use Bridge with any indicator?**
A: Yes! As long as it exports signals as plots (0 or 1).
**Q: Do I need to modify my existing strategy?**
A: No! Just ensure it has the plot() exports.
**Q: Can I use multiple indicators?**
A: Yes, but you'll need to combine signals in a separate indicator first.
**Q: Is there any performance impact?**
A: Minimal. Bridges are optimized for efficiency.
**Q: Can I backtest with bridges?**
A: Yes! Strategy Bridge provides full backtesting capabilities.
---
## Troubleshooting
**Signals not working:**
- Check all 4 connections are made correctly
- Ensure your indicator outputs 0 or 1 (not true/false)
- Verify SQV "Use External Signals" is enabled
**No trades executing:**
- Check SQV validation settings (maybe too strict)
- Verify Strategy Bridge sees the signals (check info label)
- Ensure market is open if using market orders
**Wrong source in dropdown:**
- Plot titles must be unique
- Restart indicator if you changed plot names
- Remove and re-add the indicator
---
## Get Started Now!
1. **Download the Bridge Scripts** (provided separately)
2. **Add to your chart** with any indicator
3. **Connect via dropdowns** (no coding!)
4. **Start trading** with SQV validation
The entire setup takes less than 5 minutes. No programming knowledge required!
For custom integration or advanced features, see the full SQV Integration Manual.
Script open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.
Script open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.