OPEN-SOURCE SCRIPT
Actualizado AI Trading Alerts v6 — SL/TP + Confidence + Panel (Fixed)

Overview
This Pine Script is designed to identify high-probability trading opportunities in Forex, commodities, and crypto markets. It combines EMA trend filters, RSI, and Stochastic RSI, with automatic stop-loss (SL) & take-profit (TP) suggestions, and provides a confidence panel to quickly assess the trade setup strength.
It also includes TradingView alert conditions so you can set up notifications for Long/Short setups and EMA crosses.
⚙️ Features
EMA Trend Filter
RSI Filter
Stochastic RSI Filter
EMA Proximity Check
Signals
Continuation Signals:
Cross Events:
Automatic SL/TP Suggestions
SL size adjusts depending on asset:
TP = SL × Risk:Reward ratio (default 1:2).
Confidence Score (0–4)
Based on conditions met (trend, RSI, Stoch, EMA proximity).
Labels:
Visual Panel on Chart
Alerts
🖥️ How to Use
1. Add the Script
2. Configure Inputs
3. Read the Panel
Top-right of chart, you’ll see ✅ or ❌ for:
Confidence row:
4. Alerts Setup
Go to TradingView Alerts (⏰ icon).
Choose the script under “Condition”.
Select alert type:
Set notification method (popup, sound, email, mobile).
Click Create.
Now TradingView will notify you automatically when signals appear.
5. Example Workflow
Wait for Confidence = Strong/Strongest.
Check if market session supports volatility (e.g., XAU in London/NY).
Review SL/TP suggestions:
Adjust based on your own price action analysis.
📊 Best Practices
This Pine Script is designed to identify high-probability trading opportunities in Forex, commodities, and crypto markets. It combines EMA trend filters, RSI, and Stochastic RSI, with automatic stop-loss (SL) & take-profit (TP) suggestions, and provides a confidence panel to quickly assess the trade setup strength.
It also includes TradingView alert conditions so you can set up notifications for Long/Short setups and EMA crosses.
⚙️ Features
EMA Trend Filter
- Uses EMA 50, 100, 200 for trend confirmation.
- Bull trend = EMA50 > EMA100 > EMA200
- Bear trend = EMA50 < EMA100 < EMA200
RSI Filter
- Bullish trades require RSI > 50
- Bearish trades require RSI < 50
Stochastic RSI Filter
- Prevents entries during overbought/oversold extremes.
- Bullish entry only if %K and %D < 80
- Bearish entry only if %K and %D > 20
EMA Proximity Check
- Price must be near EMA50 (within ATR × adjustable multiplier).
Signals
Continuation Signals:
- Long if all bullish conditions align.
- Short if all bearish conditions align.
Cross Events:
- Long Cross when price crosses above EMA50 in bull trend.
- Short Cross when price crosses below EMA50 in bear trend.
Automatic SL/TP Suggestions
SL size adjusts depending on asset:
- Gold/Silver (XAU/XAG): 5 pts
- Bitcoin/Ethereum: 100 pts
- FX pairs (default): 20 pts
TP = SL × Risk:Reward ratio (default 1:2).
Confidence Score (0–4)
Based on conditions met (trend, RSI, Stoch, EMA proximity).
Labels:
- Strongest (4/4)
- Strong (3/4)
- Medium (2/4)
- Low (1/4)
Visual Panel on Chart
- Shows ✅/❌ for each condition (trend, RSI, Stoch, EMA proximity, signal now).
- Confidence row with color-coded strength.
Alerts
- Long Setup
- Short Setup
- Long Cross
- Short Cross
🖥️ How to Use
1. Add the Script
- Open TradingView → Pine Editor.
- Paste the full script.
- Click Add to chart.
- Save as "AI Trading Alerts v6 — SL/TP + Confidence + Panel".
2. Configure Inputs
- EMA Lengths: Default 50/100/200 (works well for swing trading).
- RSI Length: 14 (standard).
- Stochastic Length/K/D: Default 14/3/3.
- Risk:Reward Ratio: Default 2.0 (can change to 1.5, 3.0, etc.).
- EMA Proximity Threshold: Default 0.20 × ATR (adjust to be stricter/looser).
3. Read the Panel
Top-right of chart, you’ll see ✅ or ❌ for:
- Trend → Are EMAs aligned?
- RSI → Above 50 (bull) or below 50 (bear)?
- Stoch OK → Not extreme?
- Near EMA50 → Close enough to EMA50?
- Above/Below OK → Price position vs. EMA50 matches trend?
- Signal Now → Entry triggered?
Confidence row:
- 🟢 Green = Strongest
- 🟩 Light green = Strong
- 🟧 Orange = Medium
- 🟨 Yellow = Low
- ⬜ Gray = None
4. Alerts Setup
Go to TradingView Alerts (⏰ icon).
Choose the script under “Condition”.
Select alert type:
- Long Setup
- Short Setup
- Long Cross
- Short Cross
Set notification method (popup, sound, email, mobile).
Click Create.
Now TradingView will notify you automatically when signals appear.
5. Example Workflow
Wait for Confidence = Strong/Strongest.
Check if market session supports volatility (e.g., XAU in London/NY).
Review SL/TP suggestions:
- Long → Entry: current price, SL: close - risk_pts, TP: close + risk_pts × RR.
- Short → Entry: current price, SL: close + risk_pts, TP: close - risk_pts × RR.
Adjust based on your own price action analysis.
📊 Best Practices
- Use on H1 + D1 combo → align higher timeframe bias with intraday entries.
- Risk only 1–2% of account per trade (position sizing required).
- Filter with market sessions (Asia, Europe, US).
- Strongest signals work best with trending pairs (e.g., XAUUSD, USDJPY, BTCUSD).
Notas de prensa
OverviewThis Pine Script is designed to identify high-probability trading opportunities in Forex, commodities, and crypto markets. It combines EMA trend filters, RSI, and Stochastic RSI, with automatic stop-loss (SL) & take-profit (TP) suggestions, and provides a confidence panel to quickly assess the trade setup strength.
It also includes TradingView alert conditions so you can set up notifications for Long/Short setups and EMA crosses.
Script de código abierto
Siguiendo fielmente el espíritu de TradingView, el creador de este script lo ha publicado en código abierto, permitiendo que otros traders puedan revisar y verificar su funcionalidad. ¡Enhorabuena al autor! Puede utilizarlo de forma gratuita, pero tenga en cuenta que la publicación de este código está sujeta a nuestras Normas internas.
Exención de responsabilidad
La información y las publicaciones que ofrecemos, no implican ni constituyen un asesoramiento financiero, ni de inversión, trading o cualquier otro tipo de consejo o recomendación emitida o respaldada por TradingView. Puede obtener información adicional en las Condiciones de uso.
Script de código abierto
Siguiendo fielmente el espíritu de TradingView, el creador de este script lo ha publicado en código abierto, permitiendo que otros traders puedan revisar y verificar su funcionalidad. ¡Enhorabuena al autor! Puede utilizarlo de forma gratuita, pero tenga en cuenta que la publicación de este código está sujeta a nuestras Normas internas.
Exención de responsabilidad
La información y las publicaciones que ofrecemos, no implican ni constituyen un asesoramiento financiero, ni de inversión, trading o cualquier otro tipo de consejo o recomendación emitida o respaldada por TradingView. Puede obtener información adicional en las Condiciones de uso.