Connecting...
Current State Updated: 2026-05-29 21:45 UTC
System
Online
ONLINE
Status
Uptime
Candles
Bridge
Market
BTCUSDT
$—
Last Price
24h Change
24h High
24h Low
Risk
Allow
Heat
Action
Drawdown
Volatility
Consensus
Pipeline
Signal
Confidence
Agreement
Engines
Strategy Factory
Running
Best Strategy
Fitness
Population
Generation
Engine Signals — Real-time
Live
Engine Signal Confidence Candles Risk Action Multiplier Status
Loading...
Project History
2026-05-13 — Phase 1 Complete
MCP Foundation Deployed
Initial deployment of Neural Trader MCP on maxcod.ru. Bybit WebSocket integration, Rust gRPC bridge, Node.js Express server with basic health API. Ring buffer DataStore with O(1) access.
Bybit WSRust BridgegRPCExpress
2026-05-20 — Phase 2 Complete
Analytical Engines Online
Four core prediction engines deployed: Kelly Criterion (fractional 1/5), LSTM with peephole connections, DRL Portfolio Manager (PPO/SAC/A2C ensemble), Sentiment Alpha Pipeline (lexicon + embedding).
KellyLSTMDRLSentiment
2026-05-26 — Phase 3 Complete
Pipeline + Risk + Backtest + Evolution
Signal aggregation pipeline with weighted consensus. Risk Manager with heat-based throttling (drawdown/volatility/correlation/concentration). Walk-forward backtest engine with MA crossover strategy. Evolution engine with genetic algorithm for strategy optimization.

Show technical details
Pipeline: Weighted consensus of all engine signals. Kelly=0.3, LSTM=0.25, DRL=0.2, Sentiment=0.1, MultiTF=0.15

Risk Manager: Heat = drawdown×0.3 + volatility×0.25 + correlation×0.2 + concentration×0.25
Throttle = 1 - heat/20. Max single position: 10%. Circuit breaker at heat=20.

Backtest: Walk-forward validation with 5 windows. Train/val split 70/30.
Metrics: Sharpe, Sortino, maxDrawdown, winRate, profitFactor, Calmar, VaR95

Evolution: Genetic algorithm with 50 strategies, 5 generations, 20% mutation rate.
Selection: tournament (size 3). Crossover: single-point. Fitness: Sharpe ratio.
PipelineRiskBacktestEvolution
2026-05-29 — Critical Fixes
DRL + Risk + Backtest Fixed
DRL: Removed dangerous Sharpe annualization (×√6048 → raw Sharpe). minCandles 15→20, lookback 60→20. Risk: Fixed position sizing (allocation×multiplier vs confidence). maxSinglePosition 5%→10%. Backtest: Simplified strategy, removed annualization. Data: Added seedCandles() for historical preload. 200 Bybit candles loaded.

Show technical details
DRL Fixes:
• Removed annualization multiplier ×√6048 (was producing Sharpe >1000)
• Now returns raw Sharpe: mean(returns)/std(returns)
• minCandles: 15 → 20 (ensures statistical significance)
• lookback: 60 → 20 (faster adaptation)
• sharpeThreshold: 30 → 15 (more realistic)
• Added graceful degradation when insufficient candles

Risk Fixes:
• Fixed position sizing: allocation × multiplier (was ignoring multiplier)
• maxSinglePosition: 5% → 10% (more realistic for BTC)
• Heat calculation: drawdown×0.3 + volatility×0.25 + correlation×0.2 + concentration×0.25
• Throttle now correctly scales position sizes

Backtest Fixes:
• Removed annualization from Sharpe calculation
• Simplified MA crossover strategy (fast=5, slow=20)
• Added walk-forward validation with 5 windows
• Metrics: Sharpe, Sortino, maxDrawdown, winRate, profitFactor, Calmar, VaR95

DataStore Enhancement:
• Added seedCandles(seedPath) method for historical preload
• Loads from /tmp/nt-candles-seed.json (200 candles from Bybit API)
• Called on startup in index.js after DataStore initialization
• Enables immediate engine operation without waiting for real-time accumulation
DRL FixRisk FixBacktest Fix200 Candles
2026-05-29 — Research Dashboard
Project Documentation Hub Deployed
Comprehensive research dashboard with live API integration, project history, architecture diagrams, roadmap, and documentation. Auto-updates every 30 seconds. NVIDIA provider configured for agent delegation.

Show technical details
Dashboard features:
• 6 sections: Current State, History, Engines, Architecture, Research, Docs
• Live API data: health, market, risk, consensus (auto-refresh 30s)
• Full project timeline with collapsible technical details
• File structure with click-to-view source code
• Dark theme, responsive, mobile-optimized

NVIDIA Provider:
• Model: meta/llama-3.3-70b-instruct
• Base URL: https://integrate.api.nvidia.com/v1
• Delegation: custom:nvidia
• Tested: responds correctly to API calls

Artifacts created:
• /var/www/maxref/frontend/research/index.html (main dashboard)
• /var/www/maxref/frontend/research/architecture.html (SVG diagram)
• /var/www/maxref/frontend/research/report.md (research report)
DashboardDocumentationNVIDIAArchitecture
2026-05-29 — Phase 4A Complete
✅ Regime Detection Implemented
Completed: RegimeDetector engine deployed with Hurst exponent + ADX + volatility analysis.

Results: Current regime: RANGING (confidence: 64%)
- Hurst: 0.54 (mean-reverting tendency)
- ADX: 20.6 (weak trend)
- Volatility: 0.45 (moderate)
- Signal: BUY (mean reversion strategy)

Show technical details
Files created:
regime-detector.js — RegimeDetector class (Hurst + ADX + volatility + trend)
engine-manager.js — Updated: regime status tracking, special candle-passing for regime
engines/index.js — Updated: exports RegimeDetector

Integration:
• Runs every 60 seconds via setInterval
• Receives candles directly (not dataStore) for array access
• Output stored in status.regime with lastRun timestamp
• Available via /api/engines/status endpoint

Algorithm details:
• Hurst Exponent: R/S analysis with lags [2,4,8,16,32]
• ADX: DM+ / DM- / DX / ADX(14) with smoothed moving average
• Volatility: std(close) × √525600 (annualized)
• Trend: linear regression slope on log(close)
• Classification: hurst>0.6 + adx>25 = trending; volatility>0.7 = volatile; else ranging

Signal logic:
• trending_up → BUY (momentum)
• trending_down → SELL (momentum)
• ranging → BUY (mean reversion)
• volatile → HOLD (no trade)
✅ COMPLETEHurstADXVolatilityRegimeBUY Signal
2026-05-30 — Phase 4B Complete
Strategy Factory Deployed
Completed: Strategy Factory with 50 base templates, batch backtesting (200 strategies/cycle), genetic evolution (crossover + mutation). Immediate run on startup, 30-min interval. API endpoint /api/strategies.

Results: Population: 200, Generation: 0, Top Fitness: 0.404, Throughput: ~200K strategies/min
- Best: Volatility Expansion (volatility category)
- Templates: 48 active (Trend:15, MeanRev:15, Momentum:10, Volatility:5, Pattern:3)
- Port: 3002 (separate Express server)

Show technical details
Files created:
strategy-factory.js — StrategyFactory class (50 templates, batch backtest, evolution)
engine-manager.js — Updated: _runStrategyFactory(), interval 30min, immediate run
index.js — Updated: Strategy Factory Express server on port 3002
routes/market.js — Updated: /api/strategies endpoint

Architecture:
• nt-mcp main API: port 3003
• Strategy Factory API: port 3002
• nginx: /api/* → 3003, /api/strategies → 3002

Templates:
• Trend Following (15): MA Cross, EMA, ADX, MACD, Parabolic SAR, Ichimoku, SuperTrend, Donchian, Keltner, Volume-Trend, Hull MA, Triple MA, Price Channel, Aroon, Vortex
• Mean Reversion (15): RSI, Bollinger, Stochastic, CCI, Williams %R, MFI, ROC, Deviation, Fibonacci, CMO, Ultimate Oscillator, TRIX, APO, KST
• Momentum (10): RSI-Momentum, MACD-Momentum, Awesome Oscillator, Coppock, Klinger, RVI, TSI, Force Index, EOM
• Volatility Breakout (5): BB Squeeze, Keltner Squeeze, ATR Break, Vol Expansion, Chandelier
• Pattern/Composite (5): Engulfing, Doji Reversal, Three Soldiers, RSI+BB Composite, MACD+RSI Composite

Fitness Function:
• Fitness = Sharpe × WinRate × (1 - MaxDD) × Consistency
• Elite selection: top 20% strategies preserved
• Tournament selection: size 3
• Crossover: single-point with 70% probability
• Mutation: per-parameter with 15% rate
✅ COMPLETE50 TemplatesBatch BacktestEvolutionPort 3002
2026-06-12 — Phase 4C
Agent Swarm
10-agent swarm with pheromone-based consensus. Self-learning through genetic crossover + mutation. Fitness = Sharpe × WinRate × (1 - MaxDD) × Consistency.
Agent SwarmPheromonesEvolutionConsensus
2026-06-19 — Phase 4D
Coherence Gating
Mincut-based market coherence validation. Block trades when market fragmentation detected. Graph-based agreement scoring across all engines.
MincutCoherenceGraphBlocking
2026-07-01 — Phase 5
Live Trading Execution
Bybit order API integration. Position tracking, P&L monitoring. Paper trading → live promotion pipeline. Telegram alerts, daily audit reports. Target: 80%+ winrate live.
Bybit APILive TradingTelegram80% WinRate
Engine Specifications
Kelly Criterion
Position Sizing

Optimal position sizing using fractional Kelly Criterion. Balances geometric growth vs risk of ruin.

// Kelly fraction = (winRate × avgWin - lossRate × avgLoss) / avgWin
const kellyFraction = edge / odds;
const positionSize = Math.min(
portfolioValue * kellyFraction * 0.2, // 1/5 fractional
portfolioValue * 0.10 // 10% max single position
);
ParameterValueDescription
fraction0.20 (1/5)Kelly fraction multiplier
maxPosition0.10 (10%)Maximum single position
minEdge0.02Minimum edge threshold
LSTM Predictor
Temporal

Multi-layer LSTM with peephole connections for temporal price prediction. Rolling window training.

// LSTM Architecture
layers: [
{ type: 'LSTM', units: 128, peephole: true },
{ type: 'Dropout', rate: 0.2 },
{ type: 'LSTM', units: 64, peephole: true },
{ type: 'Dense', units: 1, activation: 'sigmoid' }
]
ParameterValueDescription
windowSize60Lookback window (candles)
features10Technical indicators
threshold0.55Signal threshold
DRL Portfolio Manager
RL Ensemble

Deep Reinforcement Learning ensemble combining PPO, SAC, and A2C algorithms. Sharpe-ratio based reward function with capped per-candle calculation.

// DRL Configuration (fixed 2026-05-29)
{
minCandles: 20, // Was 120, then 15, now 20
lookback: 20, // Was 60, reduced for stability
sharpeThreshold: 15, // Capped per-candle Sharpe
annualization: null // REMOVED: was ×√6048
}
ParameterValueDescription
algorithmsPPO, SAC, A2CEnsemble methods
rewardSharpe ratioRisk-adjusted returns
allocationDynamicAsset weight optimization
Sentiment Alpha
NLP

Real-time sentiment analysis from news and social media sources. Two-tier approach: lexicon-based scoring + embedding-based deep analysis.

ParameterValueDescription
sourcesNews, Twitter, RedditData sources
methodLexicon + EmbeddingTwo-tier analysis
window1hSentiment aggregation
threshold0.6Signal threshold
Multi-Timeframe
Fusion

Fuses signals across multiple timeframes with adaptive confidence weighting.

TimeframeWeightDescription
1m0.3Short-term momentum
5m0.4Medium-term trend
15m0.3Long-term structure
Risk Manager
Safety

Heat-based throttling system. Monitors drawdown, volatility, correlation, and concentration. Auto-blocks during market fragility.

// Heat calculation (fixed 2026-05-29)
heat = (
drawdownWeight * drawdown +
volatilityWeight * volatility +
correlationWeight * correlation +
concentrationWeight * concentration
) * 100;

// Position sizing fix
positionSize = (allocation || 0) * multiplier;
maxSinglePosition = 0.10; // Was 0.05, now 10%
ThresholdActionDescription
0-40ALLOWNormal trading
40-60THROTTLEReduce position sizes
60-80BLOCKNo new positions
80+PANICClose all positions
Strategy Factory
Genetic Programming Engine
Phase 4B
Best Strategy
Category
Fitness
Sharpe
Return
Win Rate
Max DD
Trades

Strategy Factory — Genetic programming engine with 50 base templates. Batch backtesting 200 strategies per cycle. Evolution via crossover + mutation. Target: 10,000 strategies/day.

System Architecture
Data Flow
Bybit WebSocket API
↓ (raw trades + orderbook)
Rust gRPC Bridge
↓ (protocol translation)
Node.js MCP Server
↓ (data normalization)
DataStore (Ring Buffer)
↓ (O(1) access)
7 Analytical Engines
↓ (signals)
Pipeline (consensus)
↓ (weighted fusion)
Risk Manager
↓ (throttle/block)
Output: REST + WS + MCP
File Structure
/opt/nt-mcp/
├── src/
│ ├── index.js # Entry point
│ ├── data-store.js # Ring buffers + seedCandles()
│ ├── bridge-client.js # gRPC client
│ └── engines/
│ ├── engine-manager.js # Orchestrator
│ ├── kelly-criterion.js
│ ├── lstm-predictor.js
│ ├── drl-portfolio-manager.js # FIXED 2026-05-29
│ ├── sentiment-alpha.js
│ ├── multi-timeframe.js
│ ├── signal-pipeline.js
│ ├── risk-manager.js # FIXED 2026-05-29
│ ├── backtest-engine.js # FIXED 2026-05-29
│ ├── regime-detector.js # NEW 2026-05-29 — Phase 4A
│ ├── evolution-engine.js
│ └── genomic-signature.js
├── config/
└── package.json
💡 Tip: Click any file to view its source code
Research & Analysis
80% WinRate Strategy
Research

Key Insight: No single strategy achieves 80% across all market conditions. The solution is regime-specific strategy portfolios with automatic regime detection.

Regime-Specific Performance

RegimeBest StrategyWinRateSharpe
Trending UpMomentum/Breakout65-75%1.2-1.8
RangingMean Reversion70-85%1.5-2.2
Trending DownShort Momentum60-70%1.0-1.5
Volatile45-55%0.3-0.8

Strategy DNA Encoding

{
entryGenes: {
indicator1: { type: 'RSI', period: 14, threshold: 30 },
indicator2: { type: 'MACD', fast: 12, slow: 26 },
logic: 'AND',
confirmation: { type: 'volume', multiplier: 1.5 }
},
exitGenes: {
takeProfit: { type: 'fixed', value: 0.02 },
stopLoss: { type: 'ATR', multiplier: 2.0 }
},
regimeGenes: {
allowedRegimes: ['trending_up', 'ranging'],
minVolatility: 0.15,
maxVolatility: 0.45
}
}
Agent Swarm Design
Architecture

10-agent swarm with pheromone-based consensus. Each agent runs a different strategy DNA. Fitness evolves over generations.

Fitness Function

fitness = sharpe × winRate × (1 - maxDD) × consistency

// Where:
// sharpe = mean(returns) / std(returns)
// winRate = winning_trades / total_trades
// maxDD = max peak-to-trough drawdown
// consistency = 1 - std(sharpe_window) / mean(sharpe_window)

Consensus Algorithm

function consensus(agents) {
const totalPheromone = sum(agents.map(a => a.pheromone));
const buyWeight = agents
.filter(a => a.signal === 'BUY')
.reduce((s, a) => s + a.pheromone/totalPheromone, 0);

if (buyWeight > 0.6)
return { signal: 'BUY', confidence: buyWeight };
if (sellWeight > 0.6)
return { signal: 'SELL', confidence: sellWeight };
return { signal: 'HOLD', confidence: Math.max(buyWeight, sellWeight) };
}

Evolution Cycle

  1. Run all agents for 24h on paper trading
  2. Calculate fitness for each agent
  3. Select top 30% as elite
  4. Crossover: combine 2 parent DNAs
  5. Mutation: random gene changes (10% rate)
  6. Replace bottom 70% with offspring
  7. Repeat every generation (daily)
Batch Testing Infrastructure
GPU

Parallel Backtest Runner

class BatchBacktestRunner {
constructor() {
this.workers = new WorkerPool(os.cpus().length);
}

async runBatch(strategies, candles) {
const results = [];
for (let i = windowSize; i < candles.length; i += stepSize) {
const trainWindow = candles.slice(i-windowSize, i);
const testWindow = candles.slice(i, i+stepSize);
const batchResults = await this.workers.map(
strategies, s => this.backtest(s, trainWindow, testWindow)
);
results.push(...batchResults);
}
return this.aggregateResults(results);
}
}

GPU Acceleration (NVIDIA)

import torch

class GPUBacktester:
def __init__(self):
self.device = torch.device(
'cuda' if torch.cuda.is_available() else 'cpu'
)

def batch_backtest(self, strategies, candles):
prices = torch.tensor([c.close for c in candles],
device=self.device)
returns = torch.diff(prices) / prices[:-1]

results = torch.zeros(len(strategies), 4,
device=self.device)
for i, strategy in enumerate(strategies):
signals = strategy.generate_signals(prices)
pnl = self.calculate_pnl(signals, returns)
results[i] = torch.tensor([
self.sharpe(pnl),
self.winrate(pnl),
self.max_drawdown(pnl),
pnl.sum()
])

return results.cpu().numpy()

Target: 10,000 strategies tested per day using GPU batch processing.

API Documentation
REST API Endpoints
JSON
MethodEndpointDescription
GET/healthSystem health, uptime, candles, lastPrice
GET/api/engines/statusAll engine signals and details
GET/api/engines/:nameSpecific engine (kelly, lstm, drl, etc.)
GET/api/signalsFull aggregation + risk + backtest + evolution
GET/api/backtestBacktest results and metrics
WS/wsWebSocket real-time price + signals
MCP Tools
87+
ToolDescriptionStatus
analyze_price_actionTechnical analysis of price data
calculate_kelly_fractionOptimal position sizing
run_backtestStrategy validation
get_market_regimeRegime detection (planned)
evolve_strategyGenetic programming (planned)
calculate_coherenceMincut validation (planned)
Environment & Configuration
Server

Production Server

Domainnt.maxcod.ru
IP80.66.89.118:3099
SSLLet's Encrypt (Certbot)
OSDebian 12 (bookworm)
Node.jsv20 LTS
Processsystemd (nt-mcp.service)

Key Files

App/opt/nt-mcp/src/
Config/opt/nt-mcp/config/
Logsjournalctl -u nt-mcp
Data/tmp/nt-candles-seed.json
Dashboard/var/www/maxref/frontend/research/
Servicesystemctl restart nt-mcp
Neural Trader MCP · Phase 3 Active · nt.maxcod.ru · Last updated: 2026-05-29 16:45 UTC
Architecture · Research Report · API Health
const signals = await signalsRes.json(); const risk = signals.risk || {}; document.getElementById('risk-heat').textContent = risk.heat || '—'; document.getElementById('risk-heat').className = 'metric-value ' + (risk.heat > 60 ? 'bad' : risk.heat > 40 ? 'warn' : 'good'); document.getElementById('risk-action').textContent = typeof risk.action === 'string' ? risk.action.toUpperCase() : '—'; document.getElementById('risk-action').className = 'metric-value ' + (risk.action === 'allow' ? 'good' : risk.action === 'throttle' ? 'warn' : 'bad'); document.getElementById('risk-drawdown').textContent = (risk.drawdown || 0).toFixed(2) + '%'; document.getElementById('risk-volatility').textContent = (risk.volatility || 0).toFixed(2); const consensus = signals.consensus || {}; document.getElementById('consensus-signal').textContent = typeof consensus.signal === 'string' ? consensus.signal : '—'; document.getElementById('consensus-signal').className = 'metric-value ' + (consensus.signal === 'BUY' ? 'good' : consensus.signal === 'SELL' ? 'bad' : 'warn'); document.getElementById('consensus-conf').textContent = (consensus.confidence || 0).toFixed(3); document.getElementById('consensus-agreement').textContent = (consensus.agreement || 0).toFixed(2); document.getElementById('consensus-engines').textContent = (consensus.engines || 0) + '/8'; const tbody = document.querySelector('#engine-table tbody'); tbody.innerHTML = ''; const engines = ['kelly', 'lstm', 'drl', 'sentiment', 'multitf', 'pipeline']; engines.forEach(name => { const eng = signals[name]; if (!eng) return; const sig = eng.signal || {}; const signalClass = sig.signal === 'BUY' ? 'good' : sig.signal === 'SELL' ? 'bad' : 'warn'; const risk = (signals.risk && signals.risk.filteredSignals || []).find(s => s.engine === name) || {}; tbody.innerHTML += '' + name.toUpperCase() + '' + (sig.signal || '—') + '' + (sig.confidence || 0).toFixed(3) + '' + (sig.details && sig.details.candlesUsed || '—') + '' + (risk.riskAction || '—') + '' + (risk.riskMultiplier || 0).toFixed(2) + '' + (sig.signal === 'BUY' || sig.signal === 'SELL' ? 'Active' : 'Idle') + ''; }); // Strategy Factory data try { const sfRes = await fetch('https://nt.maxcod.ru/api/strategies'); const sf = await sfRes.json(); if (!sf.error) { const best = sf.bestStrategy || {}; const strat = best.strategy || {}; document.getElementById('sf-best').textContent = strat.name || '—'; document.getElementById('sf-fitness').textContent = (best.fitness || 0).toFixed(3); document.getElementById('sf-pop').textContent = sf.populationSize || '—'; document.getElementById('sf-gen').textContent = sf.generation || '—'; document.getElementById('sf-status').textContent = 'Running'; document.getElementById('sf-status').style.background = 'var(--emerald)'; document.getElementById('sf-status').style.color = 'var(--bg)'; document.getElementById('sf-detail-best').textContent = strat.name || '—'; document.getElementById('sf-detail-category').textContent = strat.category || '—'; document.getElementById('sf-detail-fitness').textContent = (best.fitness || 0).toFixed(3); document.getElementById('sf-detail-sharpe').textContent = (best.sharpe || 0).toFixed(2); document.getElementById('sf-detail-return').textContent = ((best.totalReturn || 0) * 100).toFixed(2) + '%'; document.getElementById('sf-detail-winrate').textContent = ((best.winRate || 0) * 100).toFixed(1) + '%'; document.getElementById('sf-detail-maxdd').textContent = ((best.maxDrawdown || 0) * 100).toFixed(2) + '%'; document.getElementById('sf-detail-trades').textContent = best.trades || '—'; } } catch(sfErr) { console.error('Strategy Factory API error:', sfErr); document.getElementById('sf-status').textContent = 'Error'; document.getElementById('sf-status').style.background = 'var(--rose)'; } document.getElementById('api-status').textContent = 'Connected'; document.getElementById('api-status').style.color = 'var(--emerald)'; } catch(e) { document.getElementById('api-status').textContent = 'Error: ' + (e.message || 'Unknown'); document.getElementById('api-status').style.color = 'var(--rose)'; console.error('API error:', e); } } function formatUptime(seconds) { if (!seconds) return '—'; const d = Math.floor(seconds / 86400); const h = Math.floor((seconds % 86400) / 3600); const m = Math.floor((seconds % 3600) / 60); return d > 0 ? d + 'd ' + h + 'h' : h + 'h ' + m + 'm'; } // File viewer modal const fileContents = { 'index.js': '// Entry point — Neural Trader MCP Server\nimport express from \'express\';\nimport { createServer } from \'http\';\nimport { WebSocketServer } from \'ws\';\nimport { DataStore } from \'./data-store.js\';\nimport { createEngines } from \'./engines/index.js\';\nimport { BridgeClient } from \'./bridge-client.js\';\n\nconst app = express();\nconst dataStore = new DataStore();\nconst engines = createEngines();\n\n// Seed historical candles on startup\ndataStore.seedCandles(\'/tmp/nt-candles-seed.json\');\n\n// ... server setup', 'data-store.js': '// Ring Buffer DataStore\nclass RingBuffer {\n constructor(size) { this.size = size; this.buffer = []; }\n push(item) {\n this.buffer.push(item);\n if (this.buffer.length > this.size) this.buffer.shift();\n }\n get(n) { return this.buffer.slice(-n); }\n}\n\nexport class DataStore {\n constructor() {\n this.candles = new RingBuffer(240);\n this.trades = new RingBuffer(1000);\n this.ticker = {};\n }\n seedCandles(path) { /* loads historical data */ }\n getCandles(limit) { return this.candles.get(limit); }\n}', 'regime-detector.js': '// Regime Detector — Phase 4A\nexport class RegimeDetector {\n constructor() {\n this.minCandles = 50;\n this.adxPeriod = 14;\n }\n \n detect(candles) {\n if (candles.length < this.minCandles) return { regime: \'unknown\', confidence: 0 };\n \n const hurst = this._calculateHurst(candles);\n const adx = this._calculateADX(candles);\n const vol = this._calculateVolatility(candles);\n const trend = this._calculateTrend(candles);\n \n // Classification logic\n let regime = \'ranging\';\n if (hurst > 0.6 && adx.adx > 25) regime = trend > 0 ? \'trending_up\' : \'trending_down\';\n else if (vol > 0.7) regime = \'volatile\';\n \n return {\n regime,\n confidence: this._calculateConfidence(hurst, adx, vol),\n metrics: { hurst, adx: adx.adx, volatility: vol, trend },\n signal: this._generateSignal(regime, trend)\n };\n }\n \n _calculateHurst(candles) { /* R/S analysis */ }\n _calculateADX(candles) { /* DM+ / DM- / DX / ADX */ }\n _calculateVolatility(candles) { /* std × sqrt(525600) */ }\n _calculateTrend(candles) { /* linear regression slope */ }\n _calculateConfidence(h, a, v) { return Math.min(1, (h + a/50 + v)/3); }\n _generateSignal(regime, trend) {\n const signals = {\n trending_up: \'BUY\',\n trending_down: \'SELL\',\n ranging: \'BUY\',\n volatile: \'HOLD\'\n };\n return { signal: signals[regime] || \'HOLD\', confidence: 0.5, details: { reason: \'regime_based\', regime } };\n }\n}' }; function openFileModal(filename) { const modal = document.getElementById('file-modal'); const title = document.getElementById('file-modal-title'); const body = document.getElementById('file-modal-body'); title.textContent = filename; body.textContent = fileContents[filename] || '// Source code not available in static view\\n// File: ' + filename + '\\n// Location: /opt/nt-mcp/src/engines/' + filename; modal.classList.add('open'); } function closeFileModal() { document.getElementById('file-modal').classList.remove('open'); } // Attach click handlers to file tree document.addEventListener('DOMContentLoaded', () => { document.querySelectorAll('.file-tree .file').forEach(el => { el.addEventListener('click', () => openFileModal(el.dataset.file)); }); }); fetchData(); setInterval(fetchData, 30000);
📄 file.js
// Loading...