//@version=4 study(title = "Scalping Master", shorttitle = "", overlay = true, precision = 4, linktoseries = false, max_bars_back = 1000, max_lines_count = 500) // BULB Indicator settings recommendation = input(true, title = "BULB") rsiSource = close rsiLength = 13 rsiOverbought = 65 rsiOvesold = 30 rsiValue = rsi(rsiSource, rsiLength) isOverbought = rsiValue >= rsiOverbought isOversold = rsiValue <= rsiOvesold var laststate = 0 var hh = low var ll = high // Track label references var label lastBuyLabel = na var label lastSellLabel = na obLabelText() => "sell" osLabelText() => "buy" createOverBoughtLabel() => label.new(x=bar_index, y=high, yloc=yloc.price, style=label.style_label_down, color=#F70700, size=size.normal, text=obLabelText(), textcolor=color.white) createOversoldLabel() => label.new(x=bar_index, y=low, yloc=yloc.price, style=label.style_label_up, color=#22E139, size=size.normal, text=osLabelText(), textcolor=color.white) if (isOverbought and recommendation) hh := high if not na(lastSellLabel) label.delete(lastSellLabel) lastSellLabel := createOverBoughtLabel() laststate := 1 if (isOversold and recommendation) ll := low if not na(lastBuyLabel) label.delete(lastBuyLabel) lastBuyLabel := createOversoldLabel() laststate := 2 // Detect BUY signal buySignal = laststate == 1 and isOversold and recommendation if (buySignal) if not na(lastBuyLabel) label.delete(lastBuyLabel) lastBuyLabel := createOversoldLabel() // Detect SELL signal sellSignal = laststate == 2 and isOverbought and recommendation if (sellSignal) if not na(lastSellLabel) label.delete(lastSellLabel) lastSellLabel := createOverBoughtLabel() // Define alert conditions alertcondition(buySignal, title="BUY Signal", message="BUY signal triggered") alertcondition(sellSignal, title="SELL Signal", message="SELL signal triggered") // Custom ATR Bands settings mal = input(defval = 47, type = input.integer, title = "Half Length") mva = sma(close, mal) atrl = input(defval = 89, type = input.integer, title = "Atr Length") atrv = atr(atrl) atrm = input(defval = 3.0, type = input.float, title = "Atr Multiplier") pEnv = mva + (mva * (atrv / close * atrm)) mEnv = mva - (mva * (atrv / close * atrm)) plot(mva, title = "Simple Moving Average", linewidth = 2) plot(pEnv, color=color.red, title="High Envelope", linewidth=2) plot(mEnv, color=color.green, title="Low Envelope", linewidth=2)