0% found this document useful (0 votes)
274 views2 pages

Deepseek Pinescript 20250418 2221cc

The document is a Pine Script code for a trading indicator called 'Non-Repainting Scalping Master'. It utilizes RSI, moving averages, and ATR to generate buy and sell signals while ensuring non-repainting behavior. The script includes risk management features such as stop loss and take profit calculations.

Uploaded by

XT ZALIM
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
274 views2 pages

Deepseek Pinescript 20250418 2221cc

The document is a Pine Script code for a trading indicator called 'Non-Repainting Scalping Master'. It utilizes RSI, moving averages, and ATR to generate buy and sell signals while ensuring non-repainting behavior. The script includes risk management features such as stop loss and take profit calculations.

Uploaded by

XT ZALIM
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

//@version=5

indicator("Non-Repainting Scalping Master", overlay=true, max_bars_back=1000,


max_lines_count=500)

// —————— Inputs ———————


rsiLength = input.int(13, "RSI Length", minval=1)
rsiOverbought = input.int(65, "Overbought Level", minval=50, maxval=90)
rsiOversold = input.int(35, "Oversold Level", minval=10, maxval=50)
maLength = input.int(21, "MA Length", minval=1)
atrLength = input.int(14, "ATR Length", minval=1)
atrMultiplier = input.float(2.0, "ATR Multiplier", step=0.1)

// —————— Non-Repainting Logic ———————


var label lastLongLabel = na
var label lastShortLabel = na
var float lastUpperBand = na
var float lastLowerBand = na

// —————— Calculations (confirmed bar only) ———————


ma = ta.sma(close, maLength)
atrValue = ta.atr(atrLength)
upperBand = ma + (atrValue * atrMultiplier)
lowerBand = ma - (atrValue * atrMultiplier)

// Store confirmed values


if ta.barstate.isconfirmed
lastUpperBand := upperBand
lastLowerBand := lowerBand

// —————— Signal Conditions (confirmed bars only) ———————


rsiValue = ta.rsi(close, rsiLength)
bullishSignal = ta.crossover(close, lastLowerBand) and rsiValue < rsiOversold
bearishSignal = ta.crossunder(close, lastUpperBand) and rsiValue > rsiOverbought

// —————— Plotting (non-repainting) ———————


plot(ma, "MA", color.new(#2962FF, 0))
plot(lastUpperBand, "Upper Band", color.new(#FF6D00, 0))
plot(lastLowerBand, "Lower Band", color.new(#00C853, 0))

// —————— Signal Arrows (non-repainting) ———————


if ta.barstate.isconfirmed
if bullishSignal
lastLongLabel := label.new(bar_index, low, "BUY",
style=label.style_label_up, color=#00C853, textcolor=color.white,
yloc=yloc.belowbar)
if bearishSignal
lastShortLabel := label.new(bar_index, high, "SELL",
style=label.style_label_down, color=#FF1744, textcolor=color.white,
yloc=yloc.abovebar)

// —————— Alerts (trigger on close) ———————


alertcondition(bullishSignal and ta.barstate.isconfirmed, "Long Entry", "Bullish
Entry Signal")
alertcondition(bearishSignal and ta.barstate.isconfirmed, "Short Entry", "Bearish
Entry Signal")

// —————— Risk Management ———————


stopLoss = atrValue * 1.5
takeProfit = atrValue * 2.5
if bullishSignal and ta.barstate.isconfirmed
line.new(bar_index, close - stopLoss, bar_index + 1, close - stopLoss,
color=color.red, width=2)
line.new(bar_index, close + takeProfit, bar_index + 1, close + takeProfit,
color=color.green, width=2)

if bearishSignal and ta.barstate.isconfirmed


line.new(bar_index, close + stopLoss, bar_index + 1, close + stopLoss,
color=color.red, width=2)
line.new(bar_index, close - takeProfit, bar_index + 1, close - takeProfit,
color=color.green, width=2)

You might also like