feat: Deploy HA auto-failover with database promotion
- Enhanced DNS failover monitor on secondary (72.62.39.24) - Auto-promotes database: pg_ctl promote on failover - Creates DEMOTED flag on primary via SSH (split-brain protection) - Telegram notifications with database promotion status - Startup safety script ready (integration pending) - 90-second automatic recovery vs 10-30 min manual - Zero-cost 95% enterprise HA benefit Status: DEPLOYED and MONITORING (14:52 CET) Next: Controlled failover test during maintenance
This commit is contained in:
@@ -2,21 +2,29 @@
|
||||
indicator("Money Line - 1min Data Feed (OPTIMIZED)", overlay=false)
|
||||
|
||||
// ==========================================
|
||||
// PURPOSE: Send ONLY essential market data every 1 minute (price + ADX)
|
||||
// OPTIMIZED (Dec 4, 2025): Reduced from 8 metrics to 2 metrics (75% smaller payload)
|
||||
//
|
||||
// WHY: Systems only use currentPrice and ADX from 1-minute data:
|
||||
// - Price: Smart Validation Queue price confirmation
|
||||
// - ADX: Adaptive trailing stop (Phase 7.3) + Revenge system validation
|
||||
// - Removed: ATR, RSI, volumeRatio, pricePosition, maGap, volume (NOT used)
|
||||
//
|
||||
// PURPOSE: Send 1-minute market data for Smart Validation Queue price confirms
|
||||
// OPTIMIZED (Dec 4, 2025): Keep payload minimal but include fields the webhook expects
|
||||
//
|
||||
// WHY: Smart Validation Queue needs fresh price every minute to detect +0.15%/+0.3% moves
|
||||
// - Required fields for /api/trading/market-data: action, symbol, timeframe, currentPrice, adx
|
||||
// - Optional fields (sent for compatibility): atr, rsi, volumeRatio, pricePosition, timestamp
|
||||
//
|
||||
// USAGE: Create alert on indicator with "alert() function calls"
|
||||
// WEBHOOK: https://flow.egonetix.de/webhook/tradingview-bot-v4 (SAME as trading signals)
|
||||
// FORMAT: Uses trading signal format with timeframe="1" (gets filtered like 15min/1H/Daily)
|
||||
// FORMAT: JSON payload with action="market_data_1min" and timeframe="1"
|
||||
// ==========================================
|
||||
|
||||
// Calculate ONLY what we actually use
|
||||
[diPlus, diMinus, adx] = ta.dmi(14, 14) // ADX for adaptive trailing + revenge validation
|
||||
atrVal = ta.atr(14)
|
||||
rsiVal = ta.rsi(close, 14)
|
||||
smaVol20 = ta.sma(volume, 20)
|
||||
volRatio = na(smaVol20) or smaVol20 == 0 ? 1.0 : volume / smaVol20
|
||||
rangeHigh = ta.highest(high, 100)
|
||||
rangeLow = ta.lowest(low, 100)
|
||||
pricePos = rangeHigh == rangeLow ? 50.0 : (close - rangeLow) / (rangeHigh - rangeLow) * 100
|
||||
volRatioVal = nz(volRatio, 1.0)
|
||||
pricePosVal = nz(pricePos, 50.0)
|
||||
|
||||
// Display ADX (visual confirmation)
|
||||
plot(adx, "ADX", color=color.blue, linewidth=2)
|
||||
@@ -24,12 +32,15 @@ plot(close, "Price", color=color.white, linewidth=1)
|
||||
hline(20, "ADX 20", color=color.gray, linestyle=hline.style_dashed)
|
||||
hline(25, "ADX 25", color=color.orange, linestyle=hline.style_dashed)
|
||||
|
||||
// Build OPTIMIZED message - ONLY price + ADX (75% smaller than old format)
|
||||
// Direction doesn't matter - bot filters by timeframe before executing
|
||||
// This follows same pattern as 15min/1H/Daily data collection
|
||||
// CRITICAL: Include @ price format so n8n parser extracts signalPrice correctly
|
||||
// CRITICAL (Dec 7, 2025): Use syminfo.ticker for multi-asset support (SOL, FARTCOIN, etc.)
|
||||
jsonMessage = syminfo.ticker + ' buy 1 @ ' + str.tostring(close) + ' | ADX:' + str.tostring(adx) + ' | IND:v9'
|
||||
// Build JSON payload for the market-data webhook (consumed by /api/trading/market-data)
|
||||
jsonMessage = '{"action":"market_data_1min","symbol":"' + syminfo.ticker + '",' +
|
||||
'"timeframe":"1","currentPrice":' + str.tostring(close) +
|
||||
',"adx":' + str.tostring(adx) +
|
||||
',"atr":' + str.tostring(atrVal) +
|
||||
',"rsi":' + str.tostring(rsiVal) +
|
||||
',"volumeRatio":' + str.tostring(volRatioVal) +
|
||||
',"pricePosition":' + str.tostring(pricePosVal) +
|
||||
',"timestamp":' + str.tostring(timenow) + '}'
|
||||
|
||||
// Send alert every bar close (every 1 minute on 1min chart)
|
||||
if barstate.isconfirmed
|
||||
|
||||
Reference in New Issue
Block a user