PROTECTED SOURCE SCRIPT

Adaptive EMA Optimizer

29
🔍 Adaptive EMA Optimizer
Tired of guessing which EMA works best?
This tool does the testing for you — automatically.

Instead of plotting multiple EMAs and trying to eyeball which one works, Adaptive EMA Optimizer simulates trades for each EMA in a range (e.g. 50–200), and highlights the one that performed best based on return, win rate, and trade count.

It's a clean way to keep just one optimized EMA on your chart — and let the data speak.

⚙️ What it does
Simulates trades for each EMA (buy above, sell below)

Calculates PnL, trade count, and return

Picks the best EMA based on performance

Filters EMAs that don’t meet stability thresholds

Plots only the best EMA — with optional trade signals (for calibration)

🧾 Display Options
Use the Label Display Mode setting to control how much information is shown:

Simple → Just the EMA and its slope (e.g. EMA50 (+31°))

Performance → Adds return %, number of trades, etc.

Full → Includes performance + filter status (RS/RSI pass/fail)

This lets you decide: just keep it clean and minimalist — or dig into detailed stats.

⚠️ Important
Buy/Sell signals are only for backtest visualization. This is not a live strategy.

Filters (RS, RSI) affect trade evaluation — not whether the EMA is plotted.

🛠️ How to Use It
Here’s what you can customize:

📊 EMA Testing Range

Set the start and end EMA period (e.g. 50–200)

Choose step size (e.g. test every 2nd EMA)

⏳ Test Date Filter (optional)

Limit performance calculations to a specific date range
(e.g. “only show EMAs that performed best since Jan 2022”)

📈 Risk Management

Define account size, % risk per trade, and stop loss level
(used for backtest stats — not for live orders)

🔐 Stability Controls

Prevent EMA from switching too often by requiring:

Min # of trades

Min performance improvement (%)

Confirmed outperformance over X bars

Min hold time before exit

📉 Entry Filters

Require RS (relative strength) above a certain value

Require RSI above a threshold
These ensure trades are only counted if trend strength exists

🧪 Trade Signals (Optional)

Turn on simulated buy/sell signals

For testing only — not meant for real-time execution

Declinazione di responsabilità

Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.