Skip to main content

Wunder Keltner Bot: Setup Guide and Trading Strategy

The Wunder Keltner bot is based on the breakout of the Keltner channel.

Written by Anna Smith


How to automate Wunder Keltner 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 the strategy is applied to the chart, choose a 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 Keltner Bot is a trend‑following strategy based on Keltner Channels combined with Directional Movement (DI) and an optional ADX strength filter. It enters long when price breaks above the upper Keltner band with +DI above -DI, and short when price breaks below the lower band with -DI above +DI. You can choose between three stop‑loss/take‑profit calculation methods: Keltner, FIX (percentage), or ATR. Additional features include trailing stop, move to breakeven, and full WunderTrading JSON alert integration for automated execution.

The strategy is designed for futures/spot and includes a built‑in position sizing model based on a fixed capital and risk per trade.


2. Quick Start

  1. Add the script to your TradingView chart.

  2. Set the backtest period (optional) to limit the date range.

  3. Configure Core Settings – choose trade direction (Long, Short, Both, None).

  4. Adjust Risk & Money Management – define your capital and risk per trade.

  5. Select your SL/TP type (Keltner, FIX, or ATR) and enable/disable TP/SL.

  6. Fine‑tune Keltner and DI parameters for your asset/timeframe.

  7. Enable optional features (ADX filter, trailing stop, breakeven) as needed.

  8. Set WunderTrading comments if you plan to use automated alerts.

  9. Run a backtest and optimize parameters.


3. Input Parameters Reference

All inputs are grouped logically in the script’s settings panel. Below is a detailed description of each input, its type, limits, default value, and any conditions that activate/deactivate it.

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 Core Settings

Input

Type

Options

Default

Description

Trade direction

string

LONG, SHORT, BOTH, NONE

BOTH

Restricts the direction in which the strategy can open trades.


3.3 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 % (only visible when the inline toggle is enabled)

float

min=0.01, step=0.1

5.0

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


3.4 SL/TP Settings

Input

Type

Options / Limits

Default

Description / Activation Condition

SL/TP TYPE

string

Keltner, FIX, ATR

Keltner

Selects the method for calculating stop‑loss and take‑profit.

Use TP

bool

true/false

true

Enable take‑profit.

Use SL

bool

true/false

true

Enable stop‑loss.

Take Profit (%)

float

min=0.1

3.5

Used when SL/TP TYPE = FIX and either RR is disabled or SL is disabled. (Active only when those conditions are met.)

Stop Loss (%)

float

min=0.1, max=100

3.5

Used when SL/TP TYPE = FIX and SL is enabled. (Active only when SL/TP TYPE = FIX and Use SL = true.)


3.5 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.


3.6 Risk / Reward

Visible only when both TP and SL are enabled.

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 via fixed percentage or ATR.

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 (e.g., 4/5 = 0.8 means for every 1 unit risk, reward is 1/0.8 = 1.25).*


3.7 Trailing Stop

Input

Type

Limits

Default

Description

Use TS

bool

true/false

false

Enable trailing stop.

Trailing Stop Activation (%)

float

min=0.01, step=0.1

0.4

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

Trailing Stop Execution (%)

float

min=0.01, step=0.1

0.6

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

false

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 Keltner Long

Parameters for the long‑side Keltner Channel.

Input

Type

Limits

Default

Description

SMA length 1

int

min=1

15

First SMA period for the channel midline.

SMA length 2

int

min=1

30

SMA period for the average true range of the bars (high-low).

Multiplier

float

step=0.1

3.0

Multiplier applied to the range SMA to set band width.


3.10 Keltner Short

Parameters for the short‑side Keltner Channel.

Input

Type

Limits

Default

Description

SMA length 1

int

min=1

20

First SMA period for the channel midline.

SMA length 2

int

min=1

110

SMA period for the average true range of the bars.

Multiplier

float

step=0.1

2.9

Multiplier applied to the range SMA.


3.11 DI Long & Short

These inputs control the Directional Movement indicators used as filters.

DI LONG

Input

Type

Limits

Default

Description

DI Length

int

min=1

14

Period for the Directional Movement calculation.

key level for ADX

int

min=1

30

Threshold for +DI; long entry requires +DI > this value.

DI SHORT

Input

Type

Limits

Default

Description

DI Length

int

min=1

14

Period for the Directional Movement calculation.

key level for ADX

int

min=1

25

Threshold for -DI; short entry requires -DI > this value.


3.12 ADX Strength Filter

Input

Type

Limits

Default

Description / Activation

Use ADX strength filter

bool

true/false

false

Master switch. When enabled, entries require ADX >= minimum and ADX rising.

ADX min (Long)

int

min=1

15

Minimum ADX value for long entries. (Active only when ADX filter is on.)

ADX min (Short)

int

min=1

15

Minimum ADX value for short entries. (Active only when ADX filter is on.)

ADX rising bars

int

min=1

3

Number of consecutive bars ADX must be rising to confirm trend strength.


3.13 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 small – Use a capital amount that reflects your real trading size. The Capital $ input is used for position sizing based on risk.

  • Risk per trade – A common conservative value is 1‑2% of capital. The default 5% is aggressive; adjust based on your risk tolerance and strategy win rate.

  • Volume in contract – Keep this 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 Parameter Selection

  • Keltner settings – The two SMA lengths control the channel’s responsiveness. Shorter lengths react faster but may produce more false signals. Test different combinations.

  • SL/TP TYPE

    • Keltner uses the opposite band as stop‑loss. This is a dynamic, volatility‑adjusted stop. Works well in trending markets.

    • FIX uses fixed percentages – simpler but may not adapt to changing volatility.

    • ATR uses a multiple of ATR – also volatility‑adjusted.

      Choose based on your asset’s behaviour.

  • Risk/Reward – If you enable RR, the take‑profit is automatically derived from the stop‑loss distance. This ensures a consistent risk‑reward ratio. Only use RR when both TP and SL are enabled.

5.3 ADX Filter

  • The ADX filter helps avoid choppy markets. If you enable it, start with ADX min around 20‑25 and ADX rising bars = 2‑3. Adjust to balance trade frequency and quality.

5.4 Trailing Stop & Breakeven

  • These features can lock in profits but may also reduce overall profitability if set too tight. Backtest with different activation levels.

  • Use them as complements to your main SL/TP, not as replacements.

5.5 Backtesting

  • Use a realistic date range – Include both trending and sideways periods to evaluate robustness.

  • Optimize cautiously – Avoid over‑optimizing on a small sample. Test parameters across multiple markets/timeframes.

  • Check for look‑ahead bias – The script only uses past data; all conditions are evaluated on the current bar close. However, note that entries use open and close of the same bar, which is a form of intra‑bar assumption. In real trading, you would enter at the next bar’s open. The script uses close for entry price, which may create a slight mismatch. Consider this when interpreting backtest results.

5.6 Commission & Slippage

  • The strategy sets a default commission of 0.075% (adjustable in the strategy settings). Ensure this reflects your broker’s fees.

  • Slippage is not modelled; consider adding a small buffer in your expectations.


6. Important Notes & Limitations

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

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

  • The script uses strategy.cash for default quantity type; position size is calculated from capital and risk.

  • The strategy uses two separate Keltner channels for long and short – they can have independent parameters. This allows optimisation for different market directions.

  • The visual plots (Keltner, ADX, DI) can be hidden via the Indicator Visibility toggles to reduce chart clutter.

The Wunder Keltner Bot is a trend‑following strategy that combines Keltner Channels with DI and optional ADX filters. Its flexibility allows you to choose between three stop‑loss methods and add trailing/breakeven features. While the strategy has been designed with robustness in mind, past performance in backtests does not guarantee future results. Market conditions change, and any trading strategy involves risk of loss. Before committing real capital, it is strongly recommended to test the strategy extensively in a demo environment using live market data. This will help you understand its behaviour, optimise parameters for your chosen asset and timeframe, and gain confidence in its signals. Start small, monitor closely, and adjust as needed. Remember that no strategy is foolproof – always practice proper risk management.

Did this answer your question?