PROTECTED SOURCE SCRIPT
Updated

Wunder Trend Reversal bot

7 254
Wunder Trend Reversal bot

1. Wunder Trend Reversal Bot - this has only one goal to find a reversal of the trend.
2. The strategy determines, based on the specified value for the filter, a market reversal based on the price actions of the previous bars.
3. A short EMA is used to filter false signals after the reversal signal was received. Crossing the EMA and changing its direction confirms the trend change.
4. There are 2 ways to calculate stop loss and take profit. You can choose one of them:
- Classic stop loss and take profit in a fixed percentage
- ATR stop loss and take pro
5. ATR uses risk reward (R:R) to calculate take profit. The script calculates the risk-reward based on a certain stop loss level and uses it to calculate the take profit
6. A function for calculating risk on the portfolio (your deposit) has been added to the script. When this option is enabled, you get a calculation of the entry amount in dollars relative to your Stop Loss. In the settings, you can select the risk percentage on your portfolio. The loss will be calculated from the amount that will be displayed on the chart.

For example. Deposit - $1000, you set the risk to 1%. SL 5%. Entry volume will be $200. The loss at SL will be $10.10$ this is your 1% risk or 1% of the deposit.

Important! The risk per trade must be less than the Stop Loss value. If the risk is greater than SL, then you should use leverage.

The amount of funds entering the trade is calculated in dollars. This option was created if you want to send the dollar amount from Tradingview to the exchange. However, putting your volume in dollars you get the incorrect net profit and drawdown indication in the backtest results, as TradingView calculates the backtest volume in contracts.

To display the correct net profit and drawdown values in Tradingview Backtest results, use the ”Volume in contracts” option.
Release Notes
Added optimization using additional indicators:
- EMA
- SuperTrend
- MACD
- POC for the previous day

To enter Long, it is important to have several factors. First, we need to have the break of the low over within the last few bars, for this we will be looking for the lowest value over the last few bars. For confirmation, the supertrend indicator will be used, which should show a growing market. The histogram must be less than zero for a long entry and greater than zero for a short entry. Price must be above POC. Opposite logic is used to entry short.
Release Notes
- Visual bug fixed
Release Notes
- Visual bug fixed
Release Notes
- Removed POC filter due to a change in the array processing system for Pine Script. Script will be updated soon
Release Notes
New Features Added and How They Work:
1. Enhanced Backtest Period Control
The new version replaces basic year/month/day inputs with precise timestamp controls. You can now set exact start and end times for backtesting, including timezone-aware timestamps. This allows for more accurate historical analysis by testing specific market periods rather than just calendar dates.

2. Unified Trade Direction Control
Replaces the separate allow_longs and allow_shorts checkboxes with a single dropdown menu. You can select "LONG", "SHORT", "BOTH", or "NONE" to control exactly which types of trades the strategy will execute, simplifying your setup and making it impossible to select conflicting options.

3. Advanced Risk/Reward System
Adds a sophisticated Risk/Reward (RR) system with multiple representation options. You can choose between "Simple fraction" format (like 4:5) or "Decimal" format (like 0.50). The system intelligently activates these controls only when both Take Profit and Stop Loss are enabled, ensuring proper configuration.

4. Conditional TP/SL Activation
Introduces independent toggles for Take Profit (TP) and Stop Loss (SL). You can now choose to use only TP, only SL, or both. This allows for flexible strategy variations, such as letting profits run without a fixed TP (exiting only via Trailing Stop) or using a Stop Loss without a predetermined profit target.

5. Trailing Stop Feature
Adds a sophisticated trailing stop system that automatically adjusts your stop loss to lock in profits during strong trends. You define:

Activation Percentage: How far in your favor the price must move to trigger the trailing stop

Execution Percentage: The distance the trailing stop maintains from the highest favorable price reached
The trailing stop continuously adjusts upward for long trades (or downward for short trades) as the price moves favorably.

6. Move Stop Loss to Breakeven
Automatically moves your initial stop loss to your entry price (breakeven) once the trade has moved a specified percentage in your favor. This eliminates risk once the trade has shown a certain amount of profit, protecting your capital by ensuring you can't lose money on trades that have already been profitable.

7. Enhanced Higher-Timeframe EMA Filter
-Transforms the basic EMA filter into a comprehensive module with multiple features:
-Timeframe Selection: Choose any timeframe (D, W, 60, 240, etc.) for the HTF EMA
- Slope Coloring: EMA line color changes based on slope direction (green for rising, red for falling, white for neutral)
- Slope Gate: Optional filter that only allows entries when the HTF EMA slope confirms the trade direction
- Smoothing Control: Adjustable smoothing for more stable slope calculations
- Customizable Thresholds: Set specific slope thresholds for coloring and gating

8. Improved High/Low Filter
Enhances the basic high/low detection with an "OR Window" feature. Instead of just checking if the current bar is a new high/low, the system scans back a user-defined number of bars (up to 20) and triggers if ANY bar within that window was a new high/low. This makes the filter more responsive to recent price action.

9. Modular Filter System
Each technical filter (SMA, Supertrend, MACD) now has its own enable/disable toggle and settings group. This allows you to:

- Enable/disable individual filters without affecting others
- Adjust parameters for each filter independently
- Create custom filter combinations for different market conditions

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.