Skip to main content

Wunder Trend Reversal Bot: Setup Guide and Trading Strategy

Written by Ben Ross

This document explains how to use the Wunder Trend Reversal Bot, a multi‑filter trend reversal strategy designed for automated trading via TradingView and WunderTrading. It covers all input parameters, their limits, the logic behind the signals, integration with WunderTrading, and best practices for backtesting and live trading.


How to automate Wunder Trend Reversal Bot on WunderTrading

  1. Go to the Signal Bot tab and press Create Bot.

  2. Fill in all fields in General section and choose TradingView Strategy as a Bot start condition.

  3. Decide whether you want to insert Max Capital limit and press Create Bot. You will see the following window with Webhook URL and placeholders:

  4. Leave the window opened and go to the TradingView's Supercharts. Click Indicators and select your strategy.

  5. Once strategy is applied to the chart, choose Trading pair and the Timeframe.

  6. Adjust your strategy Inputs and Properties, then press Ok.

  7. Open Alert and select your strategy in the Condition field.

  8. Open the Message tab, enter an Alert name, then copy the TradingView Strategy JSON from the Signal Bot window and paste it into the TradingView alert Message field.

  9. Go to the Notifications tab and insert Webhook URL from the Signal bot - https://wtalerts.com/bot/trading_view_strategy . Click Create to finish the process.


    Your bot is now fully connected to TradingView and ready to execute trades automatically based on your strategy signals. Whenever the strategy triggers an alert, TradingView will send the webhook with the configured placeholders, allowing the bot to receive accurate, real-time order data.

    Before running the bot in live conditions, we strongly recommend testing the setup on a demo account or with minimal capital to ensure everything works as expected. Double-check your strategy settings, alert configuration, and placeholder values to avoid execution errors.

    Once verified, your automated workflow will run continuously, requiring no manual intervention.

    You can always check and research your signals in the TV Logs and the Signal Bot logs:

1. Strategy Overview

The Wunder Trend Reversal Bot is a trend‑reversal strategy that combines multiple technical filters to identify potential reversal points. It looks for price making new highs or lows, then confirms the reversal using trend‑following indicators:

  • High/Low Filter: Detects when price makes a new high or low over a lookback period.

  • SMA Filter: Price must be above (for longs) or below (for shorts) a simple moving average.

  • Supertrend: Identifies the prevailing trend direction.

  • MACD: Uses histogram crossing zero to confirm momentum shift.

  • Higher‑Timeframe EMA (optional): Adds a higher‑timeframe trend filter and slope gate.

When all conditions align, the strategy enters a trade with an ATR‑based stop‑loss and optional take‑profit (fixed ATR distance or risk‑reward derived). It also includes trailing stop and move to breakeven features, and is fully equipped to send alerts to WunderTrading for automated execution.


2. Quick Start

  1. Add the script to your TradingView chart.

  2. Set the backtest period (optional).

  3. Configure Risk & Money Management – define your capital and risk per trade.

  4. Enable/disable TP and SL – choose whether to use take‑profit and/or stop‑loss.

    (Note: TP/SL are calculated using ATR; fixed percentage inputs are not available in this version – only ATR‑based.)

  5. Adjust ATR length and multiplier to set your desired stop distance.

  6. Enable/disable filters (HTF EMA, High/Low, SMA, Supertrend, MACD) as desired.

    The default settings have all filters enabled – you may want to start with defaults and then optimise.

  7. Set trade direction (Long, Short, Both, None).

  8. Configure trailing stop and breakeven if needed.

  9. Set WunderTrading comments for automated signals.

  10. Run a backtest and evaluate performance.


3. Input Parameters Reference

All inputs are grouped in the script’s settings panel. Each input is described below with its type, limits, default value, and any conditions that affect its visibility/activation.

3.1 Backtest Date Range

Input

Type

Limits

Default

Description

Start

bool

true/false

false

Enable start date restriction.

Start Period

time

any valid timestamp

24 Mar 2023 00:00 +0300

The beginning of the backtest period.

Finish

bool

true/false

false

Enable end date restriction.

End Period

time

any valid timestamp

24 Mar 2025 23:59 +0300

The end of the backtest period.

Note: Both toggles must be enabled to activate the date filter.


3.2 Risk and Money Management

Input

Type

Limits

Default

Description

Capital $

int

min=1, max=1,000,000

1000

The amount of capital used for position sizing.

Volume in contract

bool

true/false

true

When enabled, position size is displayed in contracts; when disabled, in quote currency. This affects the Strategy Tester and the webhook signal.

Risk Per Trade % (visible only when the inline toggle is enabled)

float

min=0.01, step=0.1

3.0

The percentage of capital risked per trade when a stop loss is used.


3.3 Strategy Settings (TP/SL)

Input

Type

Limits

Default

Description

Use TP

bool

true/false

false

Enable take‑profit. TP is calculated as entry ± ATR × multiplier.

Use SL

bool

true/false

false

Enable stop‑loss. SL is calculated as low – ATR×mult (long) or high + ATR×mult (short).

Note: There are no fixed‑percentage TP/SL inputs in this version – only ATR‑based.


3.4 ATR SL/TP

Visible only when Use TP or Use SL is enabled.

Input

Type

Limits

Default

Description

ATR length

int

min=1

14

Lookback period for the Average True Range.

SL multiplier

float

min=0, step=0.01

0.9

Multiplier applied to ATR for stop‑loss distance. For take‑profit, the same multiplier is used in the opposite direction (entry ± ATR×mult).


3.5 Risk / Reward

Visible only when both TP and SL are enabled.

This section allows you to derive take‑profit from the stop‑loss using a risk‑reward ratio, overriding the fixed ATR‑based TP.

Input

Type

Limits / Options

Default

Description / Activation Condition

condition RR

bool

true/false

true

Master switch for using Risk/Reward ratio. When disabled, TP is set using ATR×mult (fixed distance).

simple fraction / Decimal

string

Simple fr, Decimal

Simple fr

Choose RR representation.

Risk (simple fraction)

int

min=1, max=100

4

Numerator of the RR fraction. (Active only when simple fraction is selected.)

Reward (simple fraction)

int

min=1, max=100

5

Denominator of the RR fraction. (Active only when simple fraction is selected.)

decimal RR

float

min=0.01, max=99.99

0.50

Decimal RR value (e.g., 0.5 means risk:reward = 1:2). (Active only when Decimal is selected.)

  • Note: RR is calculated as Risk / Reward. If RR = 0.5, TP is placed at a distance twice the SL distance.*


3.6 Core Settings (Trade Direction)

Input

Type

Options

Default

Description

Trade direction

string

LONG, SHORT, BOTH, NONE

BOTH

Restricts the direction in which the strategy can open trades.


3.7 Trailing Stop

Input

Type

Limits

Default

Description

Use TS

bool

true/false

true

Enable trailing stop.

Trailing Stop Activation (%)

float

min=0.01, step=0.1

2.0

Price movement (in percent from entry) that triggers the trailing stop.

Trailing Stop Execution (%)

float

min=0.01, step=0.1

1.0

The distance (in percent) behind the highest price (long) or lowest price (short) where the stop is placed after activation.


3.8 Move Stop Loss to Breakeven

Input

Type

Limits

Default

Description

Use MSL

bool

true/false

true

Enable move to breakeven.

MSL activation (%)

float

min=0.01, step=0.1

0.5

Price movement (in percent from entry) that triggers moving the stop‑loss to breakeven.


3.9 Higher‑Timeframe EMA

This module calculates an EMA from a higher timeframe and can optionally use its slope as a filter.

Input

Type

Limits

Default

Description / Activation

Enable HTF EMA

bool

true/false

false

Master switch for the entire HTF EMA module.

EMA timeframe

timeframe

any valid TF (e.g., 60, 240, D, W)

'D'

The higher timeframe to request the EMA from.

EMA length

int

min=1

20

Period of the EMA.

Color by slope

bool

true/false

false

If enabled, the plotted EMA line changes color based on its slope (green > +threshold, red < -threshold, white otherwise).

Slope gate

bool

true/false

false

If enabled, entries are allowed only when the EMA slope confirms direction: long if slope > +threshold, short if slope < -threshold.

Smoothing length

int

min=1

10

Length for a secondary EMA applied to the HTF EMA to smooth the slope calculation. (Active only when color by slope or slope gate is enabled.)

Slope threshold

float

min=0, step=0.001

0.001

The threshold (in price units) for slope positivity/negativity.

The EMA is plotted on the main chart (force_overlay=true). When both color and gate are disabled, the EMA is still plotted but not used as a filter.


3.10 High/Low Filter

This filter triggers when price makes a new high or low and then looks for a reversal confirmation.

Input

Type

Limits

Default

Description

Enable High/Low filter

bool

true/false

true

Master switch.

Lookback (bars)

int

min=1

5

Number of bars to look back to determine a new high/low. A bar is considered a new high if high >= highest(high, lookback), similarly for low.

OR window (bars)

int

min=1, max=20

4

The strategy scans this many bars (including current) to see if any bar triggered a new high/low. If at least one bar in the window did, the condition is true. However, final entry also requires the current bar itself to be a new high/low (see note below).

Note: The final entry condition validLong requires both lowcond (any bar in OR window made new low) and lowFilter (current bar made new low). Therefore, for a trade to occur, the current bar must be a new low/high. The OR window alone does not trigger a trade unless the current bar also qualifies.


3.11 SMA Filter

Input

Type

Limits

Default

Description

Enable SMA Filter

bool

true/false

true

Master switch.

SMA length

int

min=1

20

Period of the simple moving average.

For longs: price must be above the SMA. For shorts: price must be below the SMA.


3.12 Supertrend

Input

Type

Limits

Default

Description

Enable Supertrend filter

bool

true/false

true

Master switch.

ATR Length

int

min=1

100

ATR period used in Supertrend calculation.

Factor

float

min=0.01, step=0.01

8.0

Multiplier for the ATR to set the band width.

Supertrend direction:

  • direction < 0 → uptrend (allows longs)

  • direction > 0 → downtrend (allows shorts)

The Supertrend is plotted with coloured fills between the middle of the bar and the Supertrend line.


3.13 MACD

Input

Type

Limits

Default

Description

Enable MACD filter

bool

true/false

true

Master switch.

Fast Length

int

min=1

12

Fast EMA period.

Slow Length

int

min=1

26

Slow EMA period.

Signal Smoothing

int

min=1, max=50

9

Signal line period.

Oscillator MA Type

string

SMA, EMA

EMA

Type of MA for the MACD line.

Signal Line MA Type

string

SMA, EMA

EMA

Type of MA for the signal line.

The MACD histogram is used as a filter:

  • For longs: histogram < 0 (MACD below signal, suggesting bullish reversal from bearish momentum)

  • For shorts: histogram > 0 (MACD above signal, suggesting bearish reversal from bullish momentum)

The MACD is plotted in a separate pane (force_overlay=false).


3.14 WunderTrading Comments

These strings are inserted into the alert messages for WunderTrading bot recognition. They should match the comments configured in your WunderTrading bot.

Input

Type

Default

Description

Enter Long Comment

string

'Add me'

Comment from your WunderTrading Signal bot for the long entry signals.

Exit Long Comment

string

'Add me'

Comment from your WunderTrading Signal bot for the for long exit signals.

Enter Short Comment

string

'Add me'

Comment from your WunderTrading Signal bot for the for short entry signals.

Exit Short Comment

string

'Add me'

Comment from your WunderTrading Signal bot for the for short exit signals.

Exit All Comment

string

'Add me'

(Not currently used in this version, but reserved for future.)


5. Best Practices

5.1 Capital & Risk Management

  • Start with a realistic capital – Use the amount you intend to trade.

  • Risk per trade – Conservative values (1‑2%) are recommended. The default 3% is moderately aggressive.

  • Volume in contract – Keep enabled (true) for realistic backtest results (position sized in contracts). Disable only if you need dollar‑based signals for WunderTrading (the webhook will then send quote currency volume).

5.2 Filter Selection

  • The strategy combines five independent filters. While this can reduce false signals, it may also lead to very few trades. You can disable some filters to increase trade frequency.

  • Start with all filters enabled (default) and observe performance. If the strategy produces too few trades, consider disabling the least effective filter for your market.

  • Optimise each filter independently – change one parameter at a time to understand its impact.

5.3 High/Low Filter

  • The lookback determines how “new” a high/low must be. Smaller values (e.g., 3‑5) generate more signals; larger values (e.g., 10‑20) are stricter.

  • The OR window is currently somewhat redundant (see note in 3.10). You can leave it at default.

5.4 SMA Filter

  • The SMA length should be aligned with your trading timeframe. A length of 20 is a common short‑term trend filter.

5.5 Supertrend

  • Supertrend is sensitive to its parameters. Higher ATR length and factor produce a smoother, less sensitive trend. Start with default and adjust based on market volatility.

5.6 MACD

  • The MACD filter uses histogram sign, not crossover of lines. For a true reversal strategy, histogram crossing zero is a common momentum shift signal.

  • You may experiment with different MA types (SMA vs. EMA) and lengths.

5.7 Higher‑Timeframe EMA

  • This filter is optional but powerful. When enabled, it adds a higher‑timeframe trend context.

  • The slope gate can significantly reduce trades; use it only if you want strong alignment with the higher‑timeframe trend.

  • The slope threshold should be set based on the price scale of your asset. Start with a small value like 0.001 and adjust.

5.8 TP/SL and Risk/Reward

  • Use TP and Use SL are disabled by default. Enable them to set exits.

  • If you enable both TP and SL, you can choose between fixed ATR‑based TP or RR‑based TP. RR is more consistent because it scales with the stop distance.

  • ATR multiplier controls the stop distance. Larger values mean wider stops (lower risk per trade if using same % risk). Adjust to suit your market’s volatility.

5.9 Trailing Stop & Breakeven

  • Both are enabled by default. They help lock in profits but can be too tight in volatile markets. Backtest with different activation percentages.

  • The trailing stop executes after the activation level is reached, then trails by the execution percentage. This is a typical implementation.

5.10 Backtesting

  • Use a representative date range – include both trending and ranging periods.

  • Optimise cautiously – avoid overfitting. Test on out‑of‑sample data.

  • Check for look‑ahead bias – The script uses close for entry price, meaning the trade is assumed to happen at the closing price of the signal bar. In reality, you would enter on the next bar’s open. This may slightly overstate performance. Consider this when evaluating results.

  • Commission is set to 0.075% by default – ensure this matches your broker.


6. Important Notes & Limitations

  • No fixed‑percentage TP/SL – This version only supports ATR‑based stops and targets. If you prefer fixed percentages, you would need to modify the script.

  • Pyramiding is set to 0 – only one position at a time.

  • Margin settings are 0 – the strategy does not use leverage; position size is based on cash.

  • The High/Low filter’s OR window logic may be redundant; the final condition requires the current bar to be a new high/low anyway. This may be a design choice or a leftover. It does not break the strategy.

  • The strategy uses request.security() with lookahead = barmerge.lookahead_on and gaps = barmerge.gaps_off for the HTF EMA. This provides the previous completed HTF bar’s value, avoiding look‑ahead.

  • The MACD plot is in a separate pane – if you prefer it on the main chart, you can change force_overlay to true in the plot calls.

  • The Supertrend fill uses the middle of the bar ((open+close)/2) as the reference; this is for visual convenience and does not affect calculations.

The Wunder Trend Reversal Bot identifies potential reversal points using a multi‑filter approach (High/Low, SMA, Supertrend, MACD, and optional HTF EMA). Its complexity offers powerful filtering but also increases the risk of overfitting if not carefully validated. As with all automated strategies, historical success is not indicative of future performance. To trade safely, it is essential to first run the strategy on a demo account with real‑time data. This allows you to observe how the signals perform in current market conditions, fine‑tune parameters, and ensure the logic aligns with your trading style. Demo trading helps you avoid costly mistakes while you gain experience. Always use prudent risk management and never risk more than you can afford to lose.

Did this answer your question?