OPEN-SOURCE SCRIPT
Vital Wave 20-50

Simplicity is almost always the most effective approach, and here I’m giving you a trend-following system that exploits the bullish bias of traditional markets and their trending nature, with very basic rules.
Rules (long entries only)
• Market entry: When the EMA 20 crosses above the EMA 50 (from below)
• Main market exit: When the EMA 20 crosses below the EMA 50 (from above)
• Fixed Stop Loss: Placed at the price level of the Lower Bollinger Band at the moment the trade is entered.
In my strategy, the primary exit is when the EMA 20 crosses below the EMA 50. However, this crossover can sometimes take a while to occur, and in the meantime the price may have already dropped significantly. The Stop Loss based on the Lower Bollinger Band is designed to limit losses in case the market moves sharply against the position without giving the bearish crossover signal in time. Having two exit conditions makes the strategy much more robust in terms of risk management.
Risk Management:
• Initial capital: $10,000
• Position size: 10% of available capital per trade
• Commissions: 0.1% on traded volume
• Stop Loss: Based on the Lower Bollinger Band
• Take Profit / Exit: When EMA 20 crosses below EMA 50
Recommended Markets:
XAUUSD (OANDA) (Daily)
Period: January 3, 1833 – November 23, 2025
Total Profit & Loss: +$6,030.62 USD (+57.57%)
Maximum Drawdown: $541.53 USD (3.83%)
Total Trades: 136
Winning Trades (Win Rate): 36.03% (49/136)
Profit Factor: 2.483
XAUUSD (OANDA) (12-hour)
Period: March 19, 2006 – November 23, 2025
Total Profit & Loss: +$1,209.56 USD (+11.89%)
Maximum Drawdown: $384.58 USD (3.61%)
Total Trades: 97
Winning Trades (Win Rate): 35.05% (34/97)
Profit Factor: 1.676
XAUUSD (OANDA) (8-hour)
Period: March 19, 2006 – November 23, 2025
Total Profit & Loss: +$1,179.36 USD (+11.81%)
Maximum Drawdown: $246.88 USD (2.32%)
Total Trades: 147
Winning Trades (Win Rate): 31.97% (47/147)
Profit Factor: 1.626
Tesla (NASDAQ) (4-hour)
Period: June 29, 2010 – November 23, 2025
Total Profit & Loss (Absolute): +$11,687.90 USD (+116.88%)
Maximum Drawdown: $922.05 USD (6.50%)
Total Trades: 68
Winning Trades (Win Rate): 39.71% (27/68)
Profit Factor: 4.156
Tesla (NASDAQ) (3-hour)
Total Profit & Loss: +$11,522.33 USD (+115.22%)
Maximum Drawdown: $1,247.60 USD (8.80%)
Total Trades: 114
Winning Trades: 33.33% (38/114)
Profit Factor: 2.811
Additional Recommendations
(These assets have shown good trending behavior with the same strategy across multiple timeframes):
•NVDA (15 min, 30 min, 1h, 2h, 3h, 4h, 6h, 8h, 12h, Daily)
•NFLX (1h, 2h, 3h, 4h, 6h, 8h, 12h, Daily)
•MA (1h, 2h, 3h, 4h, 6h, 8h, 12h, Daily)
•META (1h, 2h, 3h, 4h, 6h, 8h, 12h, Daily)
•AAPL (1h, 2h, 3h, 4h, 6h, 8h, 12h, Daily)
•SPY (12h, Daily)
About the Code
The user can modify:
• EMA periods (20 and 50 by default)
• Bollinger Bands length (20 periods)
• Standard deviation (2.0)
Visualization
• EMA 20: Blue line
• EMA 50: Red line
• Green background when EMA20 > EMA50 (bullish trend)
• Red background when EMA20 < EMA50 (bearish trend)
Important Note:
We can significantly increase the profit factor and overall profitability by risking a fixed percentage per trade instead of a fixed amount. This would prevent losses from fluctuating with changes in volatility.
This could be implemented by reducing position size or adjusting leverage based on the volatility percentage required for each trade, but I’m not sure if this is fully possible in Pine Script. In my other script, “Golden Cross 50/200 EMA,” I go deeper into this topic and provide examples.
I hope you enjoy this contribution. Best regards!
Rules (long entries only)
• Market entry: When the EMA 20 crosses above the EMA 50 (from below)
• Main market exit: When the EMA 20 crosses below the EMA 50 (from above)
• Fixed Stop Loss: Placed at the price level of the Lower Bollinger Band at the moment the trade is entered.
In my strategy, the primary exit is when the EMA 20 crosses below the EMA 50. However, this crossover can sometimes take a while to occur, and in the meantime the price may have already dropped significantly. The Stop Loss based on the Lower Bollinger Band is designed to limit losses in case the market moves sharply against the position without giving the bearish crossover signal in time. Having two exit conditions makes the strategy much more robust in terms of risk management.
Risk Management:
• Initial capital: $10,000
• Position size: 10% of available capital per trade
• Commissions: 0.1% on traded volume
• Stop Loss: Based on the Lower Bollinger Band
• Take Profit / Exit: When EMA 20 crosses below EMA 50
Recommended Markets:
XAUUSD (OANDA) (Daily)
Period: January 3, 1833 – November 23, 2025
Total Profit & Loss: +$6,030.62 USD (+57.57%)
Maximum Drawdown: $541.53 USD (3.83%)
Total Trades: 136
Winning Trades (Win Rate): 36.03% (49/136)
Profit Factor: 2.483
XAUUSD (OANDA) (12-hour)
Period: March 19, 2006 – November 23, 2025
Total Profit & Loss: +$1,209.56 USD (+11.89%)
Maximum Drawdown: $384.58 USD (3.61%)
Total Trades: 97
Winning Trades (Win Rate): 35.05% (34/97)
Profit Factor: 1.676
XAUUSD (OANDA) (8-hour)
Period: March 19, 2006 – November 23, 2025
Total Profit & Loss: +$1,179.36 USD (+11.81%)
Maximum Drawdown: $246.88 USD (2.32%)
Total Trades: 147
Winning Trades (Win Rate): 31.97% (47/147)
Profit Factor: 1.626
Tesla (NASDAQ) (4-hour)
Period: June 29, 2010 – November 23, 2025
Total Profit & Loss (Absolute): +$11,687.90 USD (+116.88%)
Maximum Drawdown: $922.05 USD (6.50%)
Total Trades: 68
Winning Trades (Win Rate): 39.71% (27/68)
Profit Factor: 4.156
Tesla (NASDAQ) (3-hour)
Total Profit & Loss: +$11,522.33 USD (+115.22%)
Maximum Drawdown: $1,247.60 USD (8.80%)
Total Trades: 114
Winning Trades: 33.33% (38/114)
Profit Factor: 2.811
Additional Recommendations
(These assets have shown good trending behavior with the same strategy across multiple timeframes):
•NVDA (15 min, 30 min, 1h, 2h, 3h, 4h, 6h, 8h, 12h, Daily)
•NFLX (1h, 2h, 3h, 4h, 6h, 8h, 12h, Daily)
•MA (1h, 2h, 3h, 4h, 6h, 8h, 12h, Daily)
•META (1h, 2h, 3h, 4h, 6h, 8h, 12h, Daily)
•AAPL (1h, 2h, 3h, 4h, 6h, 8h, 12h, Daily)
•SPY (12h, Daily)
About the Code
The user can modify:
• EMA periods (20 and 50 by default)
• Bollinger Bands length (20 periods)
• Standard deviation (2.0)
Visualization
• EMA 20: Blue line
• EMA 50: Red line
• Green background when EMA20 > EMA50 (bullish trend)
• Red background when EMA20 < EMA50 (bearish trend)
Important Note:
We can significantly increase the profit factor and overall profitability by risking a fixed percentage per trade instead of a fixed amount. This would prevent losses from fluctuating with changes in volatility.
This could be implemented by reducing position size or adjusting leverage based on the volatility percentage required for each trade, but I’m not sure if this is fully possible in Pine Script. In my other script, “Golden Cross 50/200 EMA,” I go deeper into this topic and provide examples.
I hope you enjoy this contribution. Best regards!
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội Quy.
📖Revista El Especulador:
drive.google.com/file/d/1Fs8l9xSpZIy5haCb5l0HWzgeAanOifs_/view?usp=drivesdk
👉t.me/ElEspeculador96 (Telegram)
drive.google.com/file/d/1Fs8l9xSpZIy5haCb5l0HWzgeAanOifs_/view?usp=drivesdk
👉t.me/ElEspeculador96 (Telegram)
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội Quy.
📖Revista El Especulador:
drive.google.com/file/d/1Fs8l9xSpZIy5haCb5l0HWzgeAanOifs_/view?usp=drivesdk
👉t.me/ElEspeculador96 (Telegram)
drive.google.com/file/d/1Fs8l9xSpZIy5haCb5l0HWzgeAanOifs_/view?usp=drivesdk
👉t.me/ElEspeculador96 (Telegram)
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.