MACD, RSI, & RVOL Strategy
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © BobBarker42069

//@version=4
strategy("MACD, RSI, & RVOL Strategy", overlay=true, max_bars_back=5000, 
 default_qty_type= strategy.cash, calc_on_order_fills=false, calc_on_every_tick=false, 
 pyramiding=0, default_qty_value=100000, initial_capital=100000)
strategy.risk.allow_entry_in(strategy.direction.long)

length = input( 14 )
overSold = input( 30 )
overBought = input( 70 )
price = close
vrsi = rsi(price, length)
co = crossover(vrsi, overSold)
cu = crossunder(vrsi, overBought)
fastLength = input(12)
slowlength = input(26)
MACDLength = input(9)
MACD = ema(close, fastLength) - ema(close, slowlength)
aMACD = ema(MACD, MACDLength)
delta = MACD - aMACD

RVOLlen = input(14, minval=1, title="RVOL Length")
av = sma(volume, RVOLlen)
RVOL = volume / av



if (not na(vrsi)) 
	if ((co and crossover(delta, 0)) or (co and crossover(RVOL, 2)) or (crossover(delta, 0) and crossover(RVOL, 2)))
		strategy.entry("MACD & RSI BUY Long", strategy.long, comment="BUY LONG")

		
	if ((cu and crossunder(delta, 0)) or (cu and crossunder(RVOL, 5)) or (crossunder(delta, 0) and crossunder(RVOL, 5)))
		strategy.entry("MACD & RSI SELL Short", strategy.short, comment="SELL LONG")
	
		
//plot(strategy.equity, title="equity", color=color.red, linewidth=2, style=plot.style_areabr)