OPEN-SOURCE SCRIPT
Hash Momentum Strategy

# Hash Momentum Strategy
## 📊 Overview
The **Hash Momentum Strategy** is a professional-grade momentum trading system designed to capture strong directional price movements with precision timing and intelligent risk management. Unlike traditional EMA crossover strategies, this system uses momentum acceleration as its primary signal, resulting in earlier entries and better risk-to-reward ratios.
---
## ⚡ What Makes This Strategy Unique
### 1. Momentum-Based Entry System
Most strategies rely on lagging indicators like moving average crossovers. This strategy captures momentum *acceleration* - entering when price movement is gaining strength, not after the move has already happened.
### 2. Programmable Risk-to-Reward
Set your exact R:R ratio (1:2, 1:2.5, 1:3, etc.) and the strategy automatically calculates stop loss and take profit levels. No more guessing or manual calculations.
### 3. Smart Partial Profit Taking
Lock in profits at multiple stages:
- **First TP**: Take 50% off at 2R
- **Second TP**: Take 40% off at 2.5R
- **Final TP**: Let 10% ride to maximum target
This approach locks in gains while letting winners run.
### 4. Dynamic Momentum Threshold
Uses ATR (Average True Range) multiplied by your threshold setting to adapt to market volatility. Volatile markets = higher threshold. Quiet markets = lower threshold.
### 5. Trade Cooldown System
Prevents overtrading and revenge trading by enforcing a cooldown period between trades. Configurable from 1-24 bars.
### 6. Optional Session & Weekend Filters
Filter trades by Tokyo, London, and New York sessions. Optional weekend-off toggle to avoid low-liquidity periods.
---
## 🎯 How It Works
### Signal Generation
**STEP 1: Calculate Momentum**
- Momentum = Current Price - Price [N bars ago]
- Check if Momentum > ATR × Threshold Multiplier
- Momentum must be accelerating (positive change in momentum)
**STEP 2: Confirm with EMA Trend Filter**
- Long: Price must be above EMA
- Short: Price must be below EMA
**STEP 3: Check Filters**
- Not in cooldown period
- Valid session (if enabled)
- Not weekend (if enabled)
**STEP 4: ENTRY SIGNAL TRIGGERED**
### Risk Management Example
**Example Long Trade:**
- Entry: $100
- Stop Loss: $97.80 (2.2% risk)
- Risk Amount: $2.20
**Take Profit Levels:**
- TP1: $104.40 (2R = $4.40) → Close 50%
- TP2: $105.50 (2.5R = $5.50) → Close 40%
- Final: $105.50 (2.5R) → Close remaining 10%
---
## ⚙️ Settings Guide
### Core Strategy
**Momentum Length** (Default: 13)
Number of bars for momentum calculation. Higher = stronger but fewer signals.
**Momentum Threshold** (Default: 2.25)
ATR multiplier. Higher = only trade biggest moves.
**Use EMA Trend Filter** (Default: ON)
Only long above EMA, short below EMA.
**EMA Length** (Default: 28)
Period for trend-confirming EMA.
### Filters
**Use Trading Session Filter** (Default: OFF)
Restrict trading to specific sessions.
**Tokyo Session** (Default: OFF)
Trade during Asian hours (00:00-09:00 JST).
**London Session** (Default: OFF)
Trade during European hours (08:00-17:00 GMT).
**New York Session** (Default: OFF)
Trade during US hours (08:00-17:00 EST).
**Weekend Off** (Default: OFF)
Disable trading on Saturdays and Sundays.
### Risk Management
**Stop Loss %** (Default: 2.2)
Fixed percentage stop loss from entry.
**Risk:Reward Ratio** (Default: 2.5)
Your target reward as multiple of risk.
**Use Partial Profit Taking** (Default: ON)
Take profits in stages.
**First TP R:R** (Default: 2.0)
First target as multiple of risk.
**First TP Size %** (Default: 50)
Percentage of position to close at TP1.
**Second TP R:R** (Default: 2.5)
Second target as multiple of risk.
**Second TP Size %** (Default: 40)
Percentage of position to close at TP2.
### Trade Management
**Use Trade Cooldown** (Default: ON)
Prevent overtrading.
**Cooldown Bars** (Default: 6)
Bars to wait after closing a trade.
---
## 🎨 Visual Elements
### Chart Indicators
🟢 **Green Dot** (below bar) = Long entry signal
🔴 **Red Dot** (above bar) = Short entry signal
🔵 **Blue X** (above bar) = Long position closed
🟠 **Orange X** (below bar) = Short position closed
**EMA Line** = Trend direction (green when bullish, red when bearish)
**White Line** = Entry price
**Red Line** = Stop loss level
**Green Lines** = Take profit levels (TP1, TP2, Final)
### Dashboard
When not in real-time mode, a dashboard displays:
- Current position (LONG/SHORT/FLAT)
- Entry price
- Stop loss price
- Take profit price
- R:R ratio
- Current momentum strength
- Total trades
- Win rate
- Net profit %
---
## 📈 Recommended Settings by Timeframe
### 1-Hour Timeframe (Default)
- Momentum Length: 13
- Momentum Threshold: 2.25
- EMA Length: 28
- Stop Loss: 2.2%
- R:R Ratio: 2.5
- Cooldown: 6 bars
### 4-Hour Timeframe
- Momentum Length: 24-36
- Momentum Threshold: 2.5
- EMA Length: 50
- Stop Loss: 3-4%
- R:R Ratio: 2.0-2.5
- Cooldown: 6-8 bars
### 15-Minute Timeframe
- Momentum Length: 8-10
- Momentum Threshold: 2.0
- EMA Length: 20
- Stop Loss: 1.5-2%
- R:R Ratio: 2.0
- Cooldown: 4-6 bars
---
## 🔧 Optimization Tips
### Want More Trades?
- Decrease Momentum Threshold (2.0 instead of 2.25)
- Decrease Momentum Length (10 instead of 13)
- Decrease Cooldown Bars (4 instead of 6)
### Want Higher Quality Trades?
- Increase Momentum Threshold (2.5-3.0)
- Increase Momentum Length (18-24)
- Increase Cooldown Bars (8-10)
### Want Lower Drawdown?
- Increase Cooldown Bars
- Use tighter stop loss
- Enable session filters (trade only high-liquidity sessions)
- Enable Weekend Off
### Want Higher Win Rate?
- Increase R:R Ratio (may reduce total profit)
- Increase Momentum Threshold (fewer but stronger signals)
- Use longer EMA for trend confirmation
---
## 📊 Performance Expectations
Based on typical backtesting results:
- **Win Rate**: 35-45%
- **Profit Factor**: 1.5-2.0
- **Risk:Reward**: 1:2.5 (configurable)
- **Max Drawdown**: 10-20%
- **Trades/Month**: 8-15 (1H timeframe)
**Note:** Win rate may appear low, but with 2.5:1 R:R, you only need ~29% win rate to break even. The strategy aims for quality over quantity.
---
## 🎓 Strategy Logic Explained
### Why Momentum > EMA Crossover?
**EMA Crossover Problems:**
- Signals lag behind price
- Late entries = poor R:R
- Many false signals in ranging markets
**Momentum Advantages:**
- Catches moves as they start accelerating
- Earlier entries = better R:R
- Adapts to volatility via ATR
### Why Partial Profit Taking?
**Without Partial TPs:**
- All-or-nothing approach
- Winners often turn to losers
- High stress watching open positions
**With Partial TPs:**
- Lock in 50% at first target
- Reduce risk to breakeven
- Let remainder ride for bigger gains
- Lower psychological pressure
### Why Trade Cooldown?
**Without Cooldown:**
- Revenge trading after losses
- Overtrading in choppy markets
- Emotional decision-making
**With Cooldown:**
- Forces discipline
- Waits for new setup to develop
- Reduces transaction costs
- Better signal quality
---
## ⚠️ Important Notes
1. **This is a momentum strategy, not an EMA strategy**
The EMA only confirms trend direction. Momentum generates the actual signals.
2. **Backtest thoroughly before live trading**
Past performance ≠ future results. Test on your specific asset and timeframe.
3. **Use proper position sizing**
Risk 1-2% of account per trade maximum. The strategy uses 100% equity by default (adjust in Properties).
4. **Dashboard auto-hides in real-time**
Clean chart for live trading. Visible during backtesting.
5. **Customize for your trading style**
All settings are fully adjustable. No single "best" configuration.
---
## 🚀 Quick Start Guide
1. **Add to Chart**: Apply to your preferred asset and timeframe
2. **Keep Defaults**: Start with default settings
3. **Backtest**: Review historical performance
4. **Paper Trade**: Test with simulated money first
5. **Go Live**: Start small and scale up
---
## 💡 Pro Tips
**Tip 1: Combine Timeframes**
Use higher timeframe (4H) for trend direction, lower timeframe (1H) for entries.
**Tip 2: Avoid News Events**
Major news can cause whipsaws. Consider manual intervention during high-impact events.
**Tip 3: Monitor Momentum Strength**
Dashboard shows momentum in sigma (σ). Values >1.0σ indicate very strong momentum.
**Tip 4: Adjust for Volatility**
In high-volatility markets, increase threshold and stop loss. In quiet markets, decrease them.
**Tip 5: Review Losing Trades**
Check if losses are hitting stop loss or reversing. Adjust stop accordingly.
---
## 📝 Changelog
**v1.0** - Initial Release
- Momentum-based signal generation
- EMA trend filter
- Programmable R:R ratio
- Partial profit taking (3 stages)
- Trade cooldown system
- Session filters (Tokyo/London/New York)
- Weekend off toggle
- Smart dashboard (auto-hides in real-time)
- Clean visual design
---
## 🙏 Credits
Developed by **Hash Capital Research**
If you find this strategy useful, please give it a like and share with others!
---
## ⚖️ Disclaimer
This strategy is for educational purposes only. Trading involves substantial risk of loss and is not suitable for all investors. Past performance is not indicative of future results. Always do your own research and consult with a qualified financial advisor before trading.
---
## 📬 Feedback
Have suggestions or found a bug? Leave a comment below! I'm continuously improving this strategy based on community feedback.
---
**Happy Trading! 🚀📈**
## 📊 Overview
The **Hash Momentum Strategy** is a professional-grade momentum trading system designed to capture strong directional price movements with precision timing and intelligent risk management. Unlike traditional EMA crossover strategies, this system uses momentum acceleration as its primary signal, resulting in earlier entries and better risk-to-reward ratios.
---
## ⚡ What Makes This Strategy Unique
### 1. Momentum-Based Entry System
Most strategies rely on lagging indicators like moving average crossovers. This strategy captures momentum *acceleration* - entering when price movement is gaining strength, not after the move has already happened.
### 2. Programmable Risk-to-Reward
Set your exact R:R ratio (1:2, 1:2.5, 1:3, etc.) and the strategy automatically calculates stop loss and take profit levels. No more guessing or manual calculations.
### 3. Smart Partial Profit Taking
Lock in profits at multiple stages:
- **First TP**: Take 50% off at 2R
- **Second TP**: Take 40% off at 2.5R
- **Final TP**: Let 10% ride to maximum target
This approach locks in gains while letting winners run.
### 4. Dynamic Momentum Threshold
Uses ATR (Average True Range) multiplied by your threshold setting to adapt to market volatility. Volatile markets = higher threshold. Quiet markets = lower threshold.
### 5. Trade Cooldown System
Prevents overtrading and revenge trading by enforcing a cooldown period between trades. Configurable from 1-24 bars.
### 6. Optional Session & Weekend Filters
Filter trades by Tokyo, London, and New York sessions. Optional weekend-off toggle to avoid low-liquidity periods.
---
## 🎯 How It Works
### Signal Generation
**STEP 1: Calculate Momentum**
- Momentum = Current Price - Price [N bars ago]
- Check if Momentum > ATR × Threshold Multiplier
- Momentum must be accelerating (positive change in momentum)
**STEP 2: Confirm with EMA Trend Filter**
- Long: Price must be above EMA
- Short: Price must be below EMA
**STEP 3: Check Filters**
- Not in cooldown period
- Valid session (if enabled)
- Not weekend (if enabled)
**STEP 4: ENTRY SIGNAL TRIGGERED**
### Risk Management Example
**Example Long Trade:**
- Entry: $100
- Stop Loss: $97.80 (2.2% risk)
- Risk Amount: $2.20
**Take Profit Levels:**
- TP1: $104.40 (2R = $4.40) → Close 50%
- TP2: $105.50 (2.5R = $5.50) → Close 40%
- Final: $105.50 (2.5R) → Close remaining 10%
---
## ⚙️ Settings Guide
### Core Strategy
**Momentum Length** (Default: 13)
Number of bars for momentum calculation. Higher = stronger but fewer signals.
**Momentum Threshold** (Default: 2.25)
ATR multiplier. Higher = only trade biggest moves.
**Use EMA Trend Filter** (Default: ON)
Only long above EMA, short below EMA.
**EMA Length** (Default: 28)
Period for trend-confirming EMA.
### Filters
**Use Trading Session Filter** (Default: OFF)
Restrict trading to specific sessions.
**Tokyo Session** (Default: OFF)
Trade during Asian hours (00:00-09:00 JST).
**London Session** (Default: OFF)
Trade during European hours (08:00-17:00 GMT).
**New York Session** (Default: OFF)
Trade during US hours (08:00-17:00 EST).
**Weekend Off** (Default: OFF)
Disable trading on Saturdays and Sundays.
### Risk Management
**Stop Loss %** (Default: 2.2)
Fixed percentage stop loss from entry.
**Risk:Reward Ratio** (Default: 2.5)
Your target reward as multiple of risk.
**Use Partial Profit Taking** (Default: ON)
Take profits in stages.
**First TP R:R** (Default: 2.0)
First target as multiple of risk.
**First TP Size %** (Default: 50)
Percentage of position to close at TP1.
**Second TP R:R** (Default: 2.5)
Second target as multiple of risk.
**Second TP Size %** (Default: 40)
Percentage of position to close at TP2.
### Trade Management
**Use Trade Cooldown** (Default: ON)
Prevent overtrading.
**Cooldown Bars** (Default: 6)
Bars to wait after closing a trade.
---
## 🎨 Visual Elements
### Chart Indicators
🟢 **Green Dot** (below bar) = Long entry signal
🔴 **Red Dot** (above bar) = Short entry signal
🔵 **Blue X** (above bar) = Long position closed
🟠 **Orange X** (below bar) = Short position closed
**EMA Line** = Trend direction (green when bullish, red when bearish)
**White Line** = Entry price
**Red Line** = Stop loss level
**Green Lines** = Take profit levels (TP1, TP2, Final)
### Dashboard
When not in real-time mode, a dashboard displays:
- Current position (LONG/SHORT/FLAT)
- Entry price
- Stop loss price
- Take profit price
- R:R ratio
- Current momentum strength
- Total trades
- Win rate
- Net profit %
---
## 📈 Recommended Settings by Timeframe
### 1-Hour Timeframe (Default)
- Momentum Length: 13
- Momentum Threshold: 2.25
- EMA Length: 28
- Stop Loss: 2.2%
- R:R Ratio: 2.5
- Cooldown: 6 bars
### 4-Hour Timeframe
- Momentum Length: 24-36
- Momentum Threshold: 2.5
- EMA Length: 50
- Stop Loss: 3-4%
- R:R Ratio: 2.0-2.5
- Cooldown: 6-8 bars
### 15-Minute Timeframe
- Momentum Length: 8-10
- Momentum Threshold: 2.0
- EMA Length: 20
- Stop Loss: 1.5-2%
- R:R Ratio: 2.0
- Cooldown: 4-6 bars
---
## 🔧 Optimization Tips
### Want More Trades?
- Decrease Momentum Threshold (2.0 instead of 2.25)
- Decrease Momentum Length (10 instead of 13)
- Decrease Cooldown Bars (4 instead of 6)
### Want Higher Quality Trades?
- Increase Momentum Threshold (2.5-3.0)
- Increase Momentum Length (18-24)
- Increase Cooldown Bars (8-10)
### Want Lower Drawdown?
- Increase Cooldown Bars
- Use tighter stop loss
- Enable session filters (trade only high-liquidity sessions)
- Enable Weekend Off
### Want Higher Win Rate?
- Increase R:R Ratio (may reduce total profit)
- Increase Momentum Threshold (fewer but stronger signals)
- Use longer EMA for trend confirmation
---
## 📊 Performance Expectations
Based on typical backtesting results:
- **Win Rate**: 35-45%
- **Profit Factor**: 1.5-2.0
- **Risk:Reward**: 1:2.5 (configurable)
- **Max Drawdown**: 10-20%
- **Trades/Month**: 8-15 (1H timeframe)
**Note:** Win rate may appear low, but with 2.5:1 R:R, you only need ~29% win rate to break even. The strategy aims for quality over quantity.
---
## 🎓 Strategy Logic Explained
### Why Momentum > EMA Crossover?
**EMA Crossover Problems:**
- Signals lag behind price
- Late entries = poor R:R
- Many false signals in ranging markets
**Momentum Advantages:**
- Catches moves as they start accelerating
- Earlier entries = better R:R
- Adapts to volatility via ATR
### Why Partial Profit Taking?
**Without Partial TPs:**
- All-or-nothing approach
- Winners often turn to losers
- High stress watching open positions
**With Partial TPs:**
- Lock in 50% at first target
- Reduce risk to breakeven
- Let remainder ride for bigger gains
- Lower psychological pressure
### Why Trade Cooldown?
**Without Cooldown:**
- Revenge trading after losses
- Overtrading in choppy markets
- Emotional decision-making
**With Cooldown:**
- Forces discipline
- Waits for new setup to develop
- Reduces transaction costs
- Better signal quality
---
## ⚠️ Important Notes
1. **This is a momentum strategy, not an EMA strategy**
The EMA only confirms trend direction. Momentum generates the actual signals.
2. **Backtest thoroughly before live trading**
Past performance ≠ future results. Test on your specific asset and timeframe.
3. **Use proper position sizing**
Risk 1-2% of account per trade maximum. The strategy uses 100% equity by default (adjust in Properties).
4. **Dashboard auto-hides in real-time**
Clean chart for live trading. Visible during backtesting.
5. **Customize for your trading style**
All settings are fully adjustable. No single "best" configuration.
---
## 🚀 Quick Start Guide
1. **Add to Chart**: Apply to your preferred asset and timeframe
2. **Keep Defaults**: Start with default settings
3. **Backtest**: Review historical performance
4. **Paper Trade**: Test with simulated money first
5. **Go Live**: Start small and scale up
---
## 💡 Pro Tips
**Tip 1: Combine Timeframes**
Use higher timeframe (4H) for trend direction, lower timeframe (1H) for entries.
**Tip 2: Avoid News Events**
Major news can cause whipsaws. Consider manual intervention during high-impact events.
**Tip 3: Monitor Momentum Strength**
Dashboard shows momentum in sigma (σ). Values >1.0σ indicate very strong momentum.
**Tip 4: Adjust for Volatility**
In high-volatility markets, increase threshold and stop loss. In quiet markets, decrease them.
**Tip 5: Review Losing Trades**
Check if losses are hitting stop loss or reversing. Adjust stop accordingly.
---
## 📝 Changelog
**v1.0** - Initial Release
- Momentum-based signal generation
- EMA trend filter
- Programmable R:R ratio
- Partial profit taking (3 stages)
- Trade cooldown system
- Session filters (Tokyo/London/New York)
- Weekend off toggle
- Smart dashboard (auto-hides in real-time)
- Clean visual design
---
## 🙏 Credits
Developed by **Hash Capital Research**
If you find this strategy useful, please give it a like and share with others!
---
## ⚖️ Disclaimer
This strategy is for educational purposes only. Trading involves substantial risk of loss and is not suitable for all investors. Past performance is not indicative of future results. Always do your own research and consult with a qualified financial advisor before trading.
---
## 📬 Feedback
Have suggestions or found a bug? Leave a comment below! I'm continuously improving this strategy based on community feedback.
---
**Happy Trading! 🚀📈**
Skrypt open-source
W zgodzie z duchem TradingView twórca tego skryptu udostępnił go jako open-source, aby użytkownicy mogli przejrzeć i zweryfikować jego działanie. Ukłony dla autora. Korzystanie jest bezpłatne, jednak ponowna publikacja kodu podlega naszym Zasadom serwisu.
Quant research firm developing proprietary indicators, trading automation, and risk frameworks for digital & macro markets. Free indicator channel (telegram) t.me/hashcapitalresearchchannel I hashadaptive.com
Wyłączenie odpowiedzialności
Informacje i publikacje nie stanowią i nie powinny być traktowane jako porady finansowe, inwestycyjne, tradingowe ani jakiekolwiek inne rekomendacje dostarczane lub zatwierdzone przez TradingView. Więcej informacji znajduje się w Warunkach użytkowania.
Skrypt open-source
W zgodzie z duchem TradingView twórca tego skryptu udostępnił go jako open-source, aby użytkownicy mogli przejrzeć i zweryfikować jego działanie. Ukłony dla autora. Korzystanie jest bezpłatne, jednak ponowna publikacja kodu podlega naszym Zasadom serwisu.
Quant research firm developing proprietary indicators, trading automation, and risk frameworks for digital & macro markets. Free indicator channel (telegram) t.me/hashcapitalresearchchannel I hashadaptive.com
Wyłączenie odpowiedzialności
Informacje i publikacje nie stanowią i nie powinny być traktowane jako porady finansowe, inwestycyjne, tradingowe ani jakiekolwiek inne rekomendacje dostarczane lub zatwierdzone przez TradingView. Więcej informacji znajduje się w Warunkach użytkowania.