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.
開源腳本
本著TradingView的真正精神,此腳本的創建者將其開源,以便交易者可以查看和驗證其功能。向作者致敬!雖然您可以免費使用它,但請記住,重新發佈程式碼必須遵守我們的網站規則。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。
開源腳本
本著TradingView的真正精神,此腳本的創建者將其開源,以便交易者可以查看和驗證其功能。向作者致敬!雖然您可以免費使用它,但請記住,重新發佈程式碼必須遵守我們的網站規則。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。