PulseHub
OPEN-SOURCE SCRIPT

ayan BTC RADAR

147
//version=6
indicator("FIROZ BTC RADAR", overlay=true, max_labels_count=500)

//====================
// INPUTS
//====================
rsiLength = input.int(14, "RSI Length")
rsiOB = input.int(70, "RSI Overbought")
rsiOS = input.int(30, "RSI Oversold")

fastLen = input.int(12, "MACD Fast")
slowLen = input.int(26, "MACD Slow")
signalLen = input.int(9, "MACD Signal")

//====================
// RSI
//====================
rsi = ta.rsi(close, rsiLength)

//====================
// MACD
//====================
[macdLine, signalLine, hist] = ta.macd(close, fastLen, slowLen, signalLen)

//====================
// BUY / SELL
//====================
buySignal = ta.crossover(hist, 0) and ta.crossover(rsi, rsiOS)
sellSignal = ta.crossunder(hist, 0) and ta.crossunder(rsi, rsiOB)

//====================
// TREND
//====================
string trend = hist >= 0 ? "Bullish" : "Bearish"

//====================
// CONFIDENCE
//====================
int confidence = 60

if buySignal
confidence := 95
else if sellSignal
confidence := 95
else if hist > 0 and rsi > 50
confidence := 80
else if hist < 0 and rsi < 50
confidence := 80
else
confidence := 60

//====================
// BUY LABEL
//====================
if buySignal
label.new(
bar_index + 2,
low,
"🟢 BUY\n" + str.tostring(confidence) + "%",
style=label.style_label_up,
color=color.green,
textcolor=color.white)

//====================
// SELL LABEL
//====================
if sellSignal
label.new(
bar_index + 2,
high,
"🔴 SELL\n" + str.tostring(confidence) + "%",
style=label.style_label_down,
color=color.red,
textcolor=color.white)

//====================
// ALERTS
//====================
alertcondition(buySignal, title="BUY", message="FIROZ BTC RADAR BUY")
alertcondition(sellSignal, title="SELL", message="FIROZ BTC RADAR SELL")

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by PulseWire. Read more in the Terms of Use.