PROTECTED SOURCE SCRIPT
Güncellendi

EMTB Pro

96
EMTB Pro 1 MIN SCALPER Strategy Description

Overview
The EMTB Pro 1 MIN SCALPER is a PineScript v5 trading strategy designed for scalping on a 1-minute timeframe. It combines multiple technical indicators and filters to generate precise buy and sell signals, aiming to capitalize on short-term price movements. The strategy is highly customizable, allowing traders to adjust inputs such as price sources, moving averages, stop-loss/take-profit settings, and trading sessions. It is ideal for active traders in volatile markets like forex, crypto, or indices.

Key Features
- Scalping Focus: Optimized for 1-minute charts to capture quick price movements.
- Multiple Indicators: Uses moving averages (MA), Average True Range (ATR) for trailing stops, Relative Strength Index (RSI) filter, and an optional trend filter.
- Flexible Risk Management: Supports percentage-based or fixed stop-loss/take-profit, trailing stops, and pyramiding (up to 5 positions).
- Session Filter: Allows trading during specific sessions (London, New York, or 24/7).
- Heikin Ashi Option: Optionally uses Heikin Ashi candles for smoother price data.
- Visual Feedback: Plots buy/sell signals, stop-loss/take-profit markers, and an optional RSI debug plot for analysis.
- User-Friendly Inputs: Extensive customization options grouped for ease of use (e.g., RSI settings, MA types).

Technical Components

1. Price Source Selection:
- Traders can choose the price source for calculations: open, close, high, low, or an EMA-based moving average (EMA:EMA-based MA).
- The EMA-based MA combines a short-term EMA (default length: 6) with an optional secondary MA (e.g., SMA, WMA, VWMA) and an offset for fine-tuning.

2. Moving Average (MA) Signal:
- The strategy uses a short-term MA (default: 3-period Hull Moving Average, HMA) to generate buy/sell signals based on crossovers with a trailing stop.
- MA types include SMA, EMA, WMA, or HMA, configurable via the 'smoothing' input.
- Buy signal: MA crosses above the trailing stop.
- Sell signal: Trailing stop crosses above the MA.

3. Trailing Stop (ATR-Based):
- A dynamic trailing stop is calculated using the Average True Range (ATR, default length: 14) multiplied by a user-defined factor (default: 1.5).
- The trailing stop adjusts based on price movement, locking in profits or limiting losses.

4. RSI Filter:
- An optional RSI filter (default: enabled) restricts trades to specific RSI ranges:
- Buy: RSI between 20 and 50 (default), indicating potential oversold conditions.
- Sell: RSI between 50 and 80 (default), indicating potential overbought conditions.
- RSI length is configurable (default: 14).
- Validation ensures rsiBuyMax > rsiBuyMin and rsiSellMax > rsiSellMin to prevent invalid settings.

5. Trend Filter:
- An optional trend filter (default: enabled) uses a longer-term EMA (default length: 50) to ensure trades align with the market trend:
- Buy trades require the price to be above the trend EMA (uptrend).
- Sell trades require the price to be below the trend EMA (downtrend).

6. Session Filter:
- Restricts trading to specific sessions: London (08:30–14:00), New York (09:30–16:00), or 24/7 (default: enabled).
- Useful for targeting high-volatility periods or avoiding low-liquidity times.

7. Risk Management:
- Stop-Loss: Configurable as a percentage (default: 2%) or fixed value.
- Take-Profit: Configurable as a percentage (default: disabled) or fixed value (default: 15).
- Trailing Stop: Optionally enabled (default: true) to follow price movements.
- Pyramiding: Allows up to 5 simultaneous trades in the same direction.
- Position Sizing: Fixed quantity (default: 1) with an initial capital of 100 units.

8. Visualizations:
- Plots the trailing stop (red), trend MA (blue), and EMA-based MA (yellow, if selected).
- Buy signals (green triangles) and sell signals (red triangles) with text labels.
- Take-profit (white circles) and stop-loss (purple circles) markers.
- Bar coloring: Green for bullish bars, red for bearish bars.
- Optional RSI debug plot (blue) with horizontal lines for buy/sell thresholds (green/red, dashed).

Entry and Exit Logic
- Long Entry: Triggered when buyCondition is true, which requires:
- Price above trailing stop.
- MA crossover above trailing stop.
- Uptrend (if trend filter enabled).
- Within trading session (if session filter enabled).
- RSI between rsiBuyMin and rsiBuyMax (if RSI filter enabled).
- AllowBuy is true, and fewer than 5 open trades.
- Short Entry: Similar conditions for sellCondition, with price below trailing stop, downtrend, and RSI between rsiSellMin and rsiSellMax.
- Exits:
- Take-profit hit: Closes all positions.
- Trailing stop hit: Closes long/short positions dynamically.
- Stop-loss hit: Closes positions if trailing stop is disabled.
- Opposite signal: Closes long positions on sell signals and vice versa.

Customization Options
The strategy offers extensive inputs for tailoring to different markets or preferences:
- Price Source: Choose between raw prices or EMA-based MA.
- MA Type and Period: Adjust the short-term MA for signal generation.
- ATR Settings: Modify ATR length and multiplier for trailing stop sensitivity.
- RSI Filter: Enable/disable, adjust length, and set buy/sell ranges.
- Trend Filter: Toggle on/off and adjust EMA length.
- Session Filter: Select trading sessions or trade 24/7.
- Risk Management: Configure stop-loss/take-profit as percentages or fixed values, enable/disable trailing stop.
- Heikin Ashi: Smooth price data for less noise.
- EMA-based MA: Fine-tune with secondary MA type and offset.

Usage Instructions
1. Add to TradingView:
- Copy the PineScript code into the TradingView Pine Editor.
- Click “Add to Chart” to apply the strategy.
2. Configure Inputs:
- Access the strategy settings to adjust inputs (e.g., RSI ranges, MA period, session filters).
- Default settings are optimized for a 1-minute timeframe but can be tweaked for other markets or timeframes.
3. Backtesting:
- Use TradingView’s Strategy Tester to evaluate performance on historical data.
- Adjust parameters like stopLoss, takeProfit, or atrMultiplier based on results.
4. Live Trading:
- Ensure your broker’s spreads and commissions align with the strategy’s scalping nature.
- Monitor the chart for buy/sell signals and use the RSI debug plot (showRSI=true) to verify RSI conditions.
5. Risk Warning:
- Scalping involves high risk due to frequent trades and tight margins. Test thoroughly before using real capital.
- Consider market conditions (e.g., volatility, liquidity) when deploying the strategy.

Example Settings for Forex (e.g., EUR/USD, 1-Minute)
- Price Source: close
- MA Type: HMA, Period: 3
- ATR: Length 14, Multiplier 1.5
- RSI Filter: Enabled, Buy Range 20–50, Sell Range 50–80, Length 14
- Trend Filter: Enabled, Length 50
- Session: 24/7 or London/New York for high volatility
- Stop-Loss: 2% (percentage-based)
- Take-Profit: 15 (fixed value)
- Trailing Stop: Enabled

Development Notes
- The strategy was developed in PineScript v5, ensuring compatibility with TradingView’s latest features.
- Several bugs were fixed during development:
- Resolved 'Undeclared identifier "color"' by using color.<color> (e.g., color.white for take-profit markers).
- Fixed 'Cannot use "plot"/"hline" in local scope' by moving RSI debug plots to the global scope.
- Addressed 'Cannot use global variable "smoothing"' by passing it as a function parameter.
- Eliminated function name conflicts by renaming the second ma() function to maMain().
- The code is well-documented with clear section headers (e.g., Inputs, RSI, Plots) for easy navigation.

Limitations and Considerations
- Market Dependency: Performance varies by market (e.g., forex, crypto, stocks) and timeframe. Backtest thoroughly.
- Broker Spreads: High spreads can erode profits in scalping strategies. Choose a low-spread broker.
- Overfitting Risk: Avoid excessive optimization of inputs, as it may reduce robustness.
- No Guarantee: Past performance does not guarantee future results. Use at your own risk.

How to Share Feedback
If you use this strategy, feel free to share your results or suggestions in the comments on TradingView! Questions about customization or bug reports are welcome. I’m happy to assist with tweaks or optimizations.

Credits
Developed with contributions from the TradingView community and debugged with external support. Special thanks to those who helped resolve PineScript errors!
Sürüm Notları
The RSI visualization has been completely removed from the script. This includes the RSI plot line as well as all related horizontal threshold lines (Buy/Sell Min/Max).
Sürüm Notları
-Fix
Sürüm Notları
-Input

Feragatname

Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, işlem veya diğer türden tavsiye veya tavsiyeler anlamına gelmez ve teşkil etmez. Kullanım Şartları'nda daha fazlasını okuyun.