- Fix external closure P&L using tp1Hit flag instead of currentSize - Add direction change detection to prevent false TP1 on signal flips - Signal flips now recorded with accurate P&L as 'manual' exits - Add retry logic with exponential backoff for Solana RPC rate limits - Create /api/trading/cancel-orders endpoint for manual cleanup - Improves data integrity for win/loss statistics
3.6 KiB
TradingView Alert - EASIEST METHOD
Since you don't have "time()" in the condition dropdown, we'll use a Pine Script indicator instead. This is actually easier!
STEP 1: Add the Pine Script Indicator
-
On your SOLUSDT 5-minute chart, click the Pine Editor button at bottom
- Or go to: Pine Editor tab at the bottom of the screen
-
Delete everything in the editor
-
Copy and paste this entire script:
//@version=5
indicator("Market Data Alert", overlay=false)
// Calculate metrics
atr_value = ta.atr(14)
adx_value = ta.dmi(14, 14)
rsi_value = ta.rsi(close, 14)
volume_ratio = volume / ta.sma(volume, 20)
price_position = (close - ta.lowest(low, 100)) / (ta.highest(high, 100) - ta.lowest(low, 100)) * 100
// Plot something so indicator appears
plot(1, "Signal", color=color.green)
// Alert condition
alertcondition(true, title="Market Data", message='{"action":"market_data","symbol":"{{ticker}}","timeframe":"{{interval}}","atr":' + str.tostring(atr_value) + ',"adx":' + str.tostring(adx_value) + ',"rsi":' + str.tostring(rsi_value) + ',"volumeRatio":' + str.tostring(volume_ratio) + ',"pricePosition":' + str.tostring(price_position) + ',"currentPrice":' + str.tostring(close) + '}')
-
Click "Save" button
- Name it:
Market Data Alert
- Name it:
-
Click "Add to Chart" button
You should now see a new indicator panel at the bottom of your chart.
STEP 2: Create the Alert (NOW IT'S EASY!)
-
Right-click on the indicator name in the legend (where it says "Market Data Alert")
-
Select "Add Alert on Market Data Alert"
OR
-
Click the Alert icon 🔔 (or press ALT + A)
-
In the Condition dropdown, you should now see:
- "Market Data Alert" → Select this
- Then select: "Market Data" (the alert condition name)
-
Settings section:
| Setting | Value |
|---|---|
| Webhook URL | http://10.0.0.48:3001/api/trading/market-data |
| Alert name | Market Data - SOL 5min |
| Frequency | Once Per Bar Close |
| Expiration | Never |
-
Notifications:
- ✅ Webhook URL (ONLY this one checked)
- ❌ Uncheck everything else
-
Alert message:
- Leave it as default (the script handles the message)
- OR if there's a message field, it should already have the JSON
-
Click "Create"
STEP 3: Repeat for ETH and BTC
- Open ETHUSDT 5-minute chart
- Add the same indicator (Pine Editor → paste script → Save → Add to Chart)
- Create alert on the indicator
- Webhook URL:
http://10.0.0.48:3001/api/trading/market-data - Name:
Market Data - ETH 5min
Repeat for BTCUSDT.
✅ VERIFY (Wait 5 Minutes)
curl http://localhost:3001/api/trading/market-data
Should show all 3 symbols with fresh data.
🎯 Why This Method is Better
- ✅ Works on all TradingView plans (that support indicators)
- ✅ Easier to set up (no complex condition configuration)
- ✅ Message is built-in (less copy-paste errors)
- ✅ Visual feedback (shows metrics on chart)
- ✅ Reusable (same indicator for all symbols)
🐛 Troubleshooting
"Pine Editor not available"
- You need TradingView Pro/Premium for custom scripts
- Alternative: Use the "Crossing" method below
Alternative without Pine Script:
- Condition: Price
- Trigger: Crossing up
- Value: Any value
- Check: "Only once per bar close"
- Message: Use the JSON from
QUICK_SETUP_CARD.md
This will fire less frequently but still works.
Try the Pine Script method first - it's the cleanest solution! 🚀