PROTECTED SOURCE SCRIPT
تم تحديثه

Boa-Impulse MACD with Filters, Sessions,Date Range Added

Original indicator is according LazyBears IMACD

1. User Inputs:
MACD Parameters: You define the lengths for the Moving Average (MA) and Signal Line for the Impulse MACD indicator. You can also toggle whether to enable bar colors based on the MACD.
Stop Loss and Take Profit: You can choose between using tick or point-based stop loss and take profit values. Both are configurable for different strategies.
Timeframe Filters: This allows you to apply conditions based on different timeframes (e.g., 60-minute, 240-minute, or daily), which could be used to filter trades based on longer-term trends.
Session-based Filters: You can limit trading to specific time sessions (e.g., morning, afternoon) and select different timezone options.
MACD Signal Line Exit Filter: Option to exit trades when the MACD crosses the signal line.
Backtesting Date Range: You can set a specific date range for backtesting, controlling which trades are considered during backtesting periods.
2. Impulse MACD Calculation:
Impulse MACD is calculated using custom functions: calc_smma() (Smoothed Moving Average) and calc_zlema() (Zero-Lag Exponential Moving Average).
The script uses these to generate the Impulse MACD value (md), the Signal Line (sb), and the Histogram (sh). The primary condition for entry and exit will be based on crossovers of these values.
3. Session Checks:
The script evaluates whether the current time is within the specified trading session (using isInSessionX).
It will only enter trades during the defined sessions if the restricted_trading_times option is enabled.
4. Higher Timeframe Filters:
The script checks the Impulse MACD values on multiple timeframes (e.g., 60-minute, 240-minute, daily). The strategy will only consider long trades if all specified timeframes are bullish and short trades if all are bearish.
5. Entry Conditions:
The entry signals are determined by zero-crosses of the Impulse MACD (zero_cross_up for long, zero_cross_down for short).
If the conditions are met (crossovers, session, timeframe filters, date range), it will open a long or short position.
6. Exit Conditions:
Signal Line Exit Filter: If the MACD crosses the signal line (and the option is enabled), the strategy will exit positions.
Additionally, the strategy has stop loss and take profit levels that are applied to each trade using the strategy.exit() function.
7. Stop Loss and Take Profit:
You can set stop loss and take profit based on either ticks or points. This is calculated with the current minimum tick value for the symbol.
8. Debug Plots:
The script plots the Impulse MACD and Signal Line values on the chart to visualize the trading signals.
The strategy also visualizes the sessions using different colored shapes on the chart for debugging and analysis.
Summary of the Strategy:
Buy (Long) when:
The Impulse MACD crosses above 0 (zero crossover).
The entry conditions (session, timeframe filters, and date range) are met.
Optionally, the strategy can use the MACD signal line exit filter to close long positions early.
Sell (Short) when:
The Impulse MACD crosses below 0 (zero crossover).
The entry conditions (session, timeframe filters, and date range) are met.
Optionally, the strategy can use the MACD signal line exit filter to close short positions early.
The Stop Loss and Take Profit levels are configurable based on your preferences, either in ticks or points, to protect your trades.

This strategy is highly customizable, providing flexibility in how it operates during different market conditions (based on timeframes and session filters). It’s designed to be used for various market types and timeframes, incorporating a multi-layer approach (Impulse MACD, timeframes, sessions).
ملاحظات الأخبار
fix the date range issue

إخلاء المسؤولية