OPEN-SOURCE SCRIPT
AetherEdge - Evolutionary Strategy Genome

🖊️ Overview
A meta-AI that evolves the strategy itself. Where most tools learn weights inside a fixed model, this engine runs a genetic algorithm over a population of genomes — each a vector encoding how strongly, and in which direction, to read several indicator "genes" (trend, momentum, mean-reversion, volatility, volume). Every genome is a candidate trading strategy. Each generation, genomes are scored by fitness (how well their signal predicted recent forward moves), then evolved by selection (tournament), crossover, and mutation. Over generations the population converges toward strategies that fit the live regime, and the engine proposes the current best genome in real time. Visualization: a text label describing the current best genome (which genes it favors) plus a single forecast line from that evolved strategy.
🔶 Key Features
Strategy evolution — evolves the strategy's composition itself via a genetic algorithm, not just weights (meta-AI)
Genome (strategy DNA) — a vector of five indicator-gene weights and directions
Fitness scoring — tracks how accurately each genome's signal predicted forward moves
Evolution operators — tournament selection, crossover, mutation, and elitism
Real-time best proposal — extracts the current best genome and proposes its strategy
Best-genome label — visualizes which genes the strategy favors and in which direction
Forecast line — a single line projecting the best genome's signal forward
Intelligence panel — best signal, best genome ID and fitness, each gene's weight, generation count, and average fitness
🧠 Technical Architecture
The engine builds five indicator genes: trend (deviation from an MA), momentum (normalized), mean-reversion (negative of stretch from the mean, fading extension), volatility (expansion/contraction regime with a directional sign), and volume (volume-weighted direction). Each gene is a [-1,1] directional reading.
The genome population has popSize individuals, each a five-gene weight vector (the strategy DNA). A genome's signal is tanh(Σ weightₘ · geneₘ), a [-1,1] directional conviction.
Evolution cycle: (1) fitness scoring — the signal each genome emitted fitLook bars ago is scored against the realized forward move as signal × outcome, updating a running fitness via EMA; (2) generation turnover (every evolveEvery bars) — elitism carries the top individuals over unchanged, while the rest are bred via tournament selection (the fitter of two random individuals), crossover (each gene inherited from one parent), and mutation (genes mutate with probability mutRate at scale mutScale). After turnover, fitness is softened and the new individuals are re-evaluated.
For the best-genome proposal, every bar the highest-fitness individual is extracted, and its strategy's signal drives the forecast line and label. The population is sized at MAXPOP(24) and run at popSize(4–24).
⚙️ Recommended Settings & Tuning Guide
BTC (1H–4H): Population 12, Evolve Every 5, Mutation Rate 0.15, Elite 2, Fitness Lookahead 5. Standard settings fit well
ETH (1H–4H): As BTC, with Fitness Memory 50–80
SOL (15m–1H): High volatility favors Mutation Rate 0.2 / Evolve Every 3 to evolve fast and track change nimbly
XRP (1H–4H): Spike-prone; Fitness Decay 0.88 to forget old performance quickly and accelerate adaptation
Population Size: more explores more strategies but adds compute; 10–16 is a practical balance
Evolve Every: smaller evolves often (nimble but less stable); larger is steadier but slower to adapt
Mutation Rate/Scale: higher is exploratory (tries new strategies); lower is stable (refines existing) — tune to market change
Elite Survivors: more preserves good strategies but reduces diversity; 2–3 is practical
💡 How to Use in Practice
Reading the best-genome label: it shows the gene composition of the currently best-performing strategy (e.g. a strong TREND +▮▮▮ means trend-following dominates; MEAN-REV +▮▮▮ means reversion works)
Using the forecast line: a signal-based projection from the evolved best strategy; a steeper slope means stronger directional conviction
Watching gene composition shift: changing gene weights over time signal a regime change and the evolution migrating to a new strategy
Checking generation and fitness: a rising generation count (G#) with rising best fitness means evolution is working and refining; a large gap to average fitness means one strategy stands out
Handling EVOLVING states: when the signal doesn't clear the gate, the strategy lacks conviction — stand aside
Multi-timeframe usage: read the dominant strategy type (gene composition) on the higher timeframe (4H), then time on the forecast on the lower one (15m–1H)
⚠️ Important Notes
Initial evolution period: right after launch the population is randomly initialized and strategies are unevolved; treat signals as low-confidence until enough generations pass (tens of generations = hundreds of bars)
Stochastic evolution: a genetic algorithm is a stochastic search; even the same market can converge to different strategies with a different seed (settings)
Overfitting risk: evolution fits recent conditions, with no guarantee they persist (overfitting to the past); too-short Fitness Memory overfits to recent noise
Learning resets: changing parameters, symbol/timeframe, or recompiling reinitializes the population and fitness, restarting evolution from zero
On look-ahead: fitness uses closed-bar realized moves (a standard training construct); as with any adaptive system, historical and live behavior can differ — always forward-test
Constraints: this is a lightweight implementation within Pine's compute budget; more population increases compute proportionally
🚨 Disclaimer
This indicator is an analytical and educational visualization tool. The genetic algorithm, genome evolution, fitness scoring, best-strategy proposal, and forecast line are quantitative heuristics computed on-chart from price data — they are not financial advice, buy/sell signals, or any guarantee of future performance. Even an evolved strategy can be wrong. Always combine any tool with your own analysis and disciplined risk management.
A meta-AI that evolves the strategy itself. Where most tools learn weights inside a fixed model, this engine runs a genetic algorithm over a population of genomes — each a vector encoding how strongly, and in which direction, to read several indicator "genes" (trend, momentum, mean-reversion, volatility, volume). Every genome is a candidate trading strategy. Each generation, genomes are scored by fitness (how well their signal predicted recent forward moves), then evolved by selection (tournament), crossover, and mutation. Over generations the population converges toward strategies that fit the live regime, and the engine proposes the current best genome in real time. Visualization: a text label describing the current best genome (which genes it favors) plus a single forecast line from that evolved strategy.
🔶 Key Features
Strategy evolution — evolves the strategy's composition itself via a genetic algorithm, not just weights (meta-AI)
Genome (strategy DNA) — a vector of five indicator-gene weights and directions
Fitness scoring — tracks how accurately each genome's signal predicted forward moves
Evolution operators — tournament selection, crossover, mutation, and elitism
Real-time best proposal — extracts the current best genome and proposes its strategy
Best-genome label — visualizes which genes the strategy favors and in which direction
Forecast line — a single line projecting the best genome's signal forward
Intelligence panel — best signal, best genome ID and fitness, each gene's weight, generation count, and average fitness
🧠 Technical Architecture
The engine builds five indicator genes: trend (deviation from an MA), momentum (normalized), mean-reversion (negative of stretch from the mean, fading extension), volatility (expansion/contraction regime with a directional sign), and volume (volume-weighted direction). Each gene is a [-1,1] directional reading.
The genome population has popSize individuals, each a five-gene weight vector (the strategy DNA). A genome's signal is tanh(Σ weightₘ · geneₘ), a [-1,1] directional conviction.
Evolution cycle: (1) fitness scoring — the signal each genome emitted fitLook bars ago is scored against the realized forward move as signal × outcome, updating a running fitness via EMA; (2) generation turnover (every evolveEvery bars) — elitism carries the top individuals over unchanged, while the rest are bred via tournament selection (the fitter of two random individuals), crossover (each gene inherited from one parent), and mutation (genes mutate with probability mutRate at scale mutScale). After turnover, fitness is softened and the new individuals are re-evaluated.
For the best-genome proposal, every bar the highest-fitness individual is extracted, and its strategy's signal drives the forecast line and label. The population is sized at MAXPOP(24) and run at popSize(4–24).
⚙️ Recommended Settings & Tuning Guide
BTC (1H–4H): Population 12, Evolve Every 5, Mutation Rate 0.15, Elite 2, Fitness Lookahead 5. Standard settings fit well
ETH (1H–4H): As BTC, with Fitness Memory 50–80
SOL (15m–1H): High volatility favors Mutation Rate 0.2 / Evolve Every 3 to evolve fast and track change nimbly
XRP (1H–4H): Spike-prone; Fitness Decay 0.88 to forget old performance quickly and accelerate adaptation
Population Size: more explores more strategies but adds compute; 10–16 is a practical balance
Evolve Every: smaller evolves often (nimble but less stable); larger is steadier but slower to adapt
Mutation Rate/Scale: higher is exploratory (tries new strategies); lower is stable (refines existing) — tune to market change
Elite Survivors: more preserves good strategies but reduces diversity; 2–3 is practical
💡 How to Use in Practice
Reading the best-genome label: it shows the gene composition of the currently best-performing strategy (e.g. a strong TREND +▮▮▮ means trend-following dominates; MEAN-REV +▮▮▮ means reversion works)
Using the forecast line: a signal-based projection from the evolved best strategy; a steeper slope means stronger directional conviction
Watching gene composition shift: changing gene weights over time signal a regime change and the evolution migrating to a new strategy
Checking generation and fitness: a rising generation count (G#) with rising best fitness means evolution is working and refining; a large gap to average fitness means one strategy stands out
Handling EVOLVING states: when the signal doesn't clear the gate, the strategy lacks conviction — stand aside
Multi-timeframe usage: read the dominant strategy type (gene composition) on the higher timeframe (4H), then time on the forecast on the lower one (15m–1H)
⚠️ Important Notes
Initial evolution period: right after launch the population is randomly initialized and strategies are unevolved; treat signals as low-confidence until enough generations pass (tens of generations = hundreds of bars)
Stochastic evolution: a genetic algorithm is a stochastic search; even the same market can converge to different strategies with a different seed (settings)
Overfitting risk: evolution fits recent conditions, with no guarantee they persist (overfitting to the past); too-short Fitness Memory overfits to recent noise
Learning resets: changing parameters, symbol/timeframe, or recompiling reinitializes the population and fitness, restarting evolution from zero
On look-ahead: fitness uses closed-bar realized moves (a standard training construct); as with any adaptive system, historical and live behavior can differ — always forward-test
Constraints: this is a lightweight implementation within Pine's compute budget; more population increases compute proportionally
🚨 Disclaimer
This indicator is an analytical and educational visualization tool. The genetic algorithm, genome evolution, fitness scoring, best-strategy proposal, and forecast line are quantitative heuristics computed on-chart from price data — they are not financial advice, buy/sell signals, or any guarantee of future performance. Even an evolved strategy can be wrong. Always combine any tool with your own analysis and disciplined risk management.
Script open-source
Dans l'esprit TradingView, le créateur de ce script l'a rendu open source afin que les traders puissent examiner et vérifier ses fonctionnalités. Bravo à l'auteur! Bien que vous puissiez l'utiliser gratuitement, n'oubliez pas que la republication du code est soumise à nos Règles.
Clause de non-responsabilité
Les informations et publications ne sont pas destinées à être, et ne constituent pas, des conseils ou recommandations financiers, d'investissement, de trading ou autres fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.
Script open-source
Dans l'esprit TradingView, le créateur de ce script l'a rendu open source afin que les traders puissent examiner et vérifier ses fonctionnalités. Bravo à l'auteur! Bien que vous puissiez l'utiliser gratuitement, n'oubliez pas que la republication du code est soumise à nos Règles.
Clause de non-responsabilité
Les informations et publications ne sont pas destinées à être, et ne constituent pas, des conseils ou recommandations financiers, d'investissement, de trading ou autres fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.