Instantly share code, notes, and snippets.

@StefanKrecher StefanKrecher/RSI+MA.js
Last active Jan 4, 2019

Embed
What would you like to do?
//@version=2
study("RSI+MA", overlay=true)
// data series for RSI with length 14
rsi = rsi(close, 14)
// data series for Moving Average with length 9
ma = sma(close, 9)
// data series for buy signals:
//price should be below the moving average and RSI should be smaller than 40
buy_signals = close < ma and rsi < 30
// data series for sell signals:
//price should be above the moving average and RSI should be above 60
sell_signals = close > ma and rsi > 70
// draw some shapes on the chart if conditions are met
plotshape(buy_signals, style=shape.triangleup, text="up")
plotshape(sell_signals, style=shape.triangledown, text="down")
// create alert conditions so that alerts can be create via the add alerts dialog
alertcondition(buy_signals, title='Buy-Signal', message='price is below the MA and RSI is below 40')
alertcondition(sell_signals, title='Sell-Signal', message='price is above the MA and RSI is above 60')
@Hanhan1989

This comment has been minimized.

Copy link

Hanhan1989 commented Jan 4, 2019

Thanks so good !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment