# RSI-VWAP

### Top FREE crypto trading bot for Tradingview!&#x20;

To make our community more profitable we decided to start a series in which we will review open-source TradingView strategies. The aim of the review is to select a strategy (or a number of strategies) from TradingView and run a reality check on it, optimise them and convert into alerts, so you can set it up as a bot on Wunderbit Trading platform.

![Performance of RSI-VWAP - free TradingView bot strategy.](https://1298640921-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lxzdw8maMUh98DLsWjS%2F-MB8xOqGoBRvghacTjJE%2F-MB8xTr2gobWi4Y86123%2FRSI-VWAP.png?alt=media\&token=41a27ebd-d1ca-4f63-a673-f49577a1e793)

#### Note

You need a TradingView Pro subscription to be able to receive Webhook notifications on Wunderbit. Sign up to TradingView now: <https://www.tradingview.com/chart?offer_id=10&aff_id=23245>

### **What we will provide**

* Open-strategy source
* Strategy adjustment for particular exchange, pair and timeframe
* Backtest

{% embed url="<https://youtu.be/bMCjT6VvsgE>" %}
Video overview of RSI-VWAP - free TradingView bot strategy.
{% endembed %}

### Description

This week we found a nice strategy for a 15 min time frame. The original idea was taken from: [XaviZ](https://www.tradingview.com/u/XaviZ/)[l](https://www.tradingview.com/u/Koi_Capital/). Originally. This is a simple strategy that is using the RSI indicator with [VWAP](https://www.tradingview.com/scripts/vwap/) as a source instead of the closing price. You will find the original strategy code here: [RSI-VWAP](https://www.tradingview.com/script/ia49d7a0/)

{% hint style="info" %}
**IMPORTANT**

* This is a trend strategy and works better in the trending market&#x20;
* We added the trend identifier using the EMA and SMA interaction
* We Added Take profit and Stop Loss levels
* We added inputs for the period selection, so you could see how the strategy is performing on a monthly basis.
  {% endhint %}

### Settings

Applicable to [FTX](https://ftx.com/#a=2594970): ETH-PERP 15 min

| **Input**                 | **Value** |
| ------------------------- | --------- |
| Period                    | 14        |
| RSI-VWAP LENGTH LONG      | 15        |
| RSI-VWAP OVERSOLD LONG    | 15        |
| RSI-VWAP OVERBOUGHT LONG  | 72        |
| RSI-VWAP LENGTH SHORT     | 14        |
| RSI-VWAP OVERSOLD SHORT   | 8         |
| RSI-VWAP OVERBOUGHT SHORT | 72        |
| Long Take Profit %        | NA (100)  |
| Long Stop Loss%           | 3.3       |
| Trailing Stop Long        | NA (100)  |
| Short Take Profit %       | NA (100)  |
| Short Stop Loss%          | 4         |
| Trailing Stop Short       | NA (100)  |

### Revised strategy script code

You can copy this code and paste it into your TradingView

```
// © Wunderbit Trading

//@version=4
strategy("RSI-VWAP INDICATOR", overlay=false, initial_capital = 1000, currency = "USD", pyramiding = 3, commission_type=strategy.commission.percent, commission_value=0.07, default_qty_type = strategy.percent_of_equity, default_qty_value = 100)

/// TREND
ribbon_period = input(14, "Period", step=1)

leadLine1 = ema(close, ribbon_period)
leadLine2 = sma(close, ribbon_period)

p1 = plot(leadLine1, color= #53b987, title="EMA", transp = 50, linewidth = 1)
p2 = plot(leadLine2, color= #eb4d5c, title="SMA", transp = 50, linewidth = 1)
fill(p1, p2, transp = 60, color = leadLine1 > leadLine2 ? #53b987 : #eb4d5c)

// Initial inputs
Act_RSI_VWAP_long = input(true, "RSI VOLUME WEIGHTED AVERAGE PRICE LONG")
RSI_VWAP_length_long = input(15, "RSI-VWAP LENGTH LONG")
RSI_VWAP_overSold_long = input(15, "RSI-VWAP OVERSOLD LONG", type=input.float)
RSI_VWAP_overBought_long = input(72, "RSI-VWAP OVERBOUGHT LONG", type=input.float)

Act_RSI_VWAP_short = input(true, "RSI VOLUME WEIGHTED AVERAGE PRICE SHORT")
RSI_VWAP_length_short = input(14, "RSI-VWAP LENGTH SHORT")
RSI_VWAP_overSold_short = input(8, "RSI-VWAP OVERSOLD SHORT", type=input.float)
RSI_VWAP_overBought_short = input(72, "RSI-VWAP OVERBOUGHT SHORT", type=input.float)

// RSI with VWAP as source
RSI_VWAP_long = rsi(vwap(close), RSI_VWAP_length_long)
RSI_VWAP_short = rsi(vwap(close), RSI_VWAP_length_short)

// Plot Them Separately.
//Plotting LONG, Put overlay=false
r_long=plot(RSI_VWAP_long, color = RSI_VWAP_long > RSI_VWAP_overBought_long ? color.red : RSI_VWAP_long < RSI_VWAP_overSold_long ? color.lime : color.blue, title="rsi", linewidth=2, style=plot.style_line)
h1_long=plot(RSI_VWAP_overBought_long, color = color.gray, style=plot.style_stepline)
h2_long=plot(RSI_VWAP_overSold_long, color = color.gray, style=plot.style_stepline)
fill(r_long,h1_long, color = RSI_VWAP_long > RSI_VWAP_overBought_long ? color.red : na, transp = 60)
fill(r_long,h2_long, color = RSI_VWAP_long < RSI_VWAP_overSold_long ? color.lime : na, transp = 60)

// Plotting SHORT, Put overlay=false
r_short=plot(RSI_VWAP_short, color = RSI_VWAP_short > RSI_VWAP_overBought_short ? color.red : RSI_VWAP_short < RSI_VWAP_overSold_short ? color.lime : color.blue, title="rsi", linewidth=2, style=plot.style_line)
h1_short=plot(RSI_VWAP_overBought_short, color = color.gray, style=plot.style_stepline)
h2_short=plot(RSI_VWAP_overSold_short, color = color.gray, style=plot.style_stepline)
fill(r_short,h1_short, color = RSI_VWAP_short > RSI_VWAP_overBought_short ? color.red : na, transp = 60)
fill(r_short,h2_short, color = RSI_VWAP_short < RSI_VWAP_overSold_short ? color.lime : na, transp = 60)


///////  STRATEGY Take Profit / Stop Loss ////////
////// LONG //////
long_tp_inp = input(100, title='Long Take Profit %', step=0.1)/100
long_sl_inp = input(3.3, title='Long Stop Loss %', step=0.1)/100
long_trailing = input(100, title='Trailing Stop Long', step=0.1) / 100

long_take_level = strategy.position_avg_price * (1 + long_tp_inp)
long_stop_level = strategy.position_avg_price * (1 - long_sl_inp)

////// SHORT //////
short_tp_inp = input(100, title='Short Take Profit %', step=0.1)/100
short_sl_inp = input(4, title='Short Stop Loss %', step=0.1)/100
short_trailing = input(100, title='Trailing Stop short', step=0.1) / 100

short_take_level = strategy.position_avg_price * (1 - short_tp_inp)
short_stop_level = strategy.position_avg_price * (1 + short_sl_inp)

///Strategy_Conditions
/// LONG ///
entry_long =crossover(RSI_VWAP_long, RSI_VWAP_overSold_long) and leadLine2<leadLine1
entry_price_long=valuewhen(entry_long,close,0)
exit_long =crossunder(RSI_VWAP_long, RSI_VWAP_overBought_long)

/// SHORT ///

entry_short =crossunder(RSI_VWAP_short, RSI_VWAP_overBought_short) and leadLine2>leadLine1
entry_price_short=valuewhen(entry_short,close,0)
exit_short =crossover(RSI_VWAP_short, RSI_VWAP_overSold_short)

////// BACKTEST PERIOD ///////
testStartYear = input(2019, "Backtest Start Year")
testStartMonth = input(1, "Backtest Start Month")
testStartDay = input(1, "Backtest Start Day")
testPeriodStart = timestamp(testStartYear,testStartMonth,testStartDay,0,0)

testStopYear = input(9999, "Backtest Stop Year")
testStopMonth = input(12, "Backtest Stop Month")
testStopDay = input(31, "Backtest Stop Day")
testPeriodStop = timestamp(testStopYear,testStopMonth,testStopDay,0,0)

testPeriod() =>
    time >= testPeriodStart and time <= testPeriodStop ? true : false

if testPeriod()
    if strategy.position_size == 0 or strategy.position_size > 0
        strategy.entry("long", true, when = entry_long, comment="*** INSERT OPEN LONG COMMENT FROM WBT ***")
        strategy.exit("long", stop=long_stop_level, limit=long_take_level, trail_points=entry_price_long * long_trailing / syminfo.mintick, trail_offset=entry_price_long * long_trailing / syminfo.mintick, comment="*** INSERT CLOSE LONG COMMENT FROM WBT ***")
        strategy.close("long", when=exit_long, comment = "*** INSERT CLOSE LONG COMMENT FROM WBT ***")

    if strategy.position_size == 0 or strategy.position_size < 0
        strategy.entry("short", false, when = entry_short, comment="*** INSERT OPEN SHORT COMMENT FROM WBT ***")
        strategy.exit("TP/SL/TRS_short","short", stop=short_stop_level, limit=short_take_level, trail_points=entry_price_short * short_trailing / syminfo.mintick, trail_offset=entry_price_short * short_trailing / syminfo.mintick, comment = "*** INSERT CLOSE SHORT COMMENT FROM WBT ***")
        strategy.close("short", when=exit_short, comment = "*** INSERT CLOSE SHORT COMMENT FROM WBT ***")
```

Follow this guide to automate your TradingView **STRATEGY** alerts. (no need for study script).

{% embed url="<https://youtu.be/G1pPYlRh1FU>" %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://wundertrading.gitbook.io/bots/free-tradingview-strategies/rsi-vwap.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
