OPEN-SOURCE SCRIPT
JWs Algo

📈 JWs Algo — 8/21 EMA Crossover Strategy with Take Profit and Stop Loss
JWs Algo is a momentum-based trading strategy that uses a classic 8/21 Exponential Moving Average (EMA) crossover to identify trend reversals and generate long and short trade signals. It includes built-in take profit and stop loss parameters to manage risk and lock in profits automatically.
🔍 Core Logic
Long Entry: When the 8 EMA crosses above the 21 EMA (bullish signal)
Short Entry: When the 8 EMA crosses below the 21 EMA (bearish signal)
Exit: Each position is exited automatically upon hitting either:
A take profit, defined as a percentage gain from entry
A stop loss, defined as a percentage loss from entry
✅ Key Features
Supports both long and short trades
Configurable take profit (%) and stop loss (%)
Prevents overlapping trades — the strategy waits for one trade to fully close before opening another
Clean visualization with:
Buy and sell signal markers
Plotted 8 EMA and 21 EMA for trend context
Compatible with any symbol and timeframe
⚙️ Recommended Use
This strategy works best on trending markets and can be adapted for:
Crypto
Forex
Stocks
Indices
Tune the TP/SL values and timeframe based on asset volatility for best results. Backtest thoroughly.
JWs Algo is a momentum-based trading strategy that uses a classic 8/21 Exponential Moving Average (EMA) crossover to identify trend reversals and generate long and short trade signals. It includes built-in take profit and stop loss parameters to manage risk and lock in profits automatically.
🔍 Core Logic
Long Entry: When the 8 EMA crosses above the 21 EMA (bullish signal)
Short Entry: When the 8 EMA crosses below the 21 EMA (bearish signal)
Exit: Each position is exited automatically upon hitting either:
A take profit, defined as a percentage gain from entry
A stop loss, defined as a percentage loss from entry
✅ Key Features
Supports both long and short trades
Configurable take profit (%) and stop loss (%)
Prevents overlapping trades — the strategy waits for one trade to fully close before opening another
Clean visualization with:
Buy and sell signal markers
Plotted 8 EMA and 21 EMA for trend context
Compatible with any symbol and timeframe
⚙️ Recommended Use
This strategy works best on trending markets and can be adapted for:
Crypto
Forex
Stocks
Indices
Tune the TP/SL values and timeframe based on asset volatility for best results. Backtest thoroughly.
Script open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
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.
Script open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
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.