//@version=6 indicator("RSI TMA", overlay=true) // Arrows on the main chart (overlay=true) // Input parameters rsiLength = input.int(2, title="RSI Length") rsiPrice = input.source(close, title="RSI Price") halfLength = input.int(2, title="Half Length") devPeriod = input.int(100, title="Deviation Period") deviations = input.float(0.7, title="Deviations") noDellArr = input.bool(false, title="No Delete Arrows") arrOtstup = input.int(0, title="Arrow Offset") arrUpColor = input.color(color.lime, title="Arrow Up Color") arrDnColor = input.color(color.red, title="Arrow Down Color") alertsMessage = input.bool(false, title="Alerts Message") alertsSound = input.bool(false, title="Alerts Sound") alertsEmail = input.bool(false, title="Alerts Email") alertsMobile = input.bool(false, title="Alerts Mobile") signalBar = input.int(0, title="Signal Bar") ...
//@version=5
indicator("Aradya Signal's ",shorttitle = "Sfi Scalper 1.0", overlay = true)
src = input(hl2, title="Source",group = "Aradya Signal's")
Multiplier = input.float(2,title="Sensitivity (0.5 - 5)", step=0.1, defval=2, minval=0.5, maxval=5,group = "Aradya Signal's")
atrPeriods = input.int(14,title="ATR Length", defval=10,group = "Aradya Signal's")
atrCalcMethod= input.string("Method 1",title = "ATR Calculation Methods",options = ["Method 1","Method 2"],group = "Aradya Signal's")
stopLossVal = input.float(2.0, title="Stop Loss Percent (0 for Disabling)", minval=0,group = "Aradya Signal's")
showBuySellSignals = input.bool(true,title="Show Buy/Sell Signals", defval=true,group = "Aradya Signal's")
percent(nom, div) =>
100 * nom / div
src1 = ta.hma(open, 5)[1]
src2 = ta.hma(close, 12)
momm1 = ta.change(src1)
momm2 = ta.change(src2)
f1(m, n) => m >= n ? m : 0.0
f2(m, n) => m >= n ? 0.0 : -m
m1 = f1(momm1, momm2)
m2 = f2(momm1, momm2)
sm1 = math.sum(m1, 1)
sm2 = math.sum(m2, 1)
cmoCalc = percent(sm1-sm2, sm1+sm2)
hh = ta.highest(2)
h1 = ta.dev(hh, 2) ? na : hh
hpivot = fixnan(h1)
ll = ta.lowest(2)
l1 = ta.dev(ll, 2) ? na : ll
lpivot = fixnan(l1)
rsiCalc = ta.rsi(close,9)
lowPivot = lpivot
highPivot = hpivot
sup = rsiCalc < 25 and cmoCalc > 50 and lowPivot
res = rsiCalc > 75 and cmoCalc < -50 and highPivot
atr2 = ta.sma(ta.tr, atrPeriods)
atr= atrCalcMethod == "Method 1" ? ta.atr(atrPeriods) : atr2
up=src-(Multiplier*atr)
up1 = nz(up[1],up)
up := close[1] > up1 ? math.max(up,up1) : up
dn=src+(Multiplier*atr)
dn1 = nz(dn[1], dn)
dn := close[1] < dn1 ? math.min(dn, dn1) : dn
trend = 1
trend := nz(trend[1], trend)
trend := trend == -1 and close > dn1 ? 1 : trend == 1 and close < up1 ? -1 : trend
buySignal = trend == 1 and trend[1] == -1
sellSignal = trend == -1 and trend[1] == 1
pos = 0.0
pos:= buySignal? 1 : sellSignal ? -1 : pos[1]
longCond = buySignal and pos[1]!= 1
shortCond = sellSignal and pos[1]!=-1
entryOfLongPosition = ta.valuewhen(longCond , close, 0)
entryOfShortPosition = ta.valuewhen(shortCond, close, 0)
sl = stopLossVal > 0 ? stopLossVal / 100 : 99999
stopLossForLong = entryOfLongPosition * (1 - sl)
stopLossForShort = entryOfShortPosition * (1 + sl)
takeProfitForLong1R = entryOfLongPosition * (1 + sl)
takeProfitForShort1R = entryOfShortPosition * (1 - sl)
takeProfitForLong2R = entryOfLongPosition * (1 + sl*2)
takeProfitForShort2R = entryOfShortPosition * (1 - sl*2)
takeProfitForLong3R = entryOfLongPosition * (1 + sl*3)
takeProfitForShort3R = entryOfShortPosition * (1 - sl*3)
long_sl = low < stopLossForLong and pos[1]==1
short_sl = high> stopLossForShort and pos[1]==-1
takeProfitForLongFinal = high>takeProfitForLong3R and pos[1]==1
takeProfitForShortFinal = low <takeProfitForShort3R and pos[1]==-1
if long_sl or short_sl or takeProfitForLongFinal or takeProfitForShortFinal
pos:=0
lindex = ta.valuewhen(longCond, bar_index, 0)
sindex= ta.valuewhen(shortCond, bar_index, 0)
entryColor = pos==1? color.rgb(33, 149, 243, 100) : color.rgb(39, 137, 176)
if barstate.islast and pos!=0
lineEntry = line.new(bar_index, pos>0?entryOfLongPosition :entryOfShortPosition , pos>0?lindex:sindex, pos>0?entryOfLongPosition :entryOfShortPosition , color=entryColor )
line.delete(lineEntry[1])
stopLine = line.new(bar_index, pos>0?stopLossForLong :stopLossForShort , pos>0?lindex:sindex, pos>0?stopLossForLong :stopLossForShort , color=color.rgb(234, 35, 35) )
tpLine1 = line.new(bar_index, pos>0?takeProfitForLong1R:takeProfitForShort1R, pos>0?lindex:sindex, pos>0?takeProfitForLong1R:takeProfitForShort1R, color=color.rgb(8, 138, 147))
tpLine2 = line.new(bar_index, pos>0?takeProfitForLong2R:takeProfitForShort2R, pos>0?lindex:sindex, pos>0?takeProfitForLong2R:takeProfitForShort2R, color=color.rgb(8, 138, 147))
tpLine3 = line.new(bar_index, pos>0?takeProfitForLong3R:takeProfitForShort3R, pos>0?lindex:sindex, pos>0?takeProfitForLong3R:takeProfitForShort3R, color=color.rgb(8, 138, 147))
line.delete(stopLine [1])
line.delete(tpLine1[1])
line.delete(tpLine2[1])
line.delete(tpLine3[1])
labelEntry = label.new(bar_index, pos>0?entryOfLongPosition :entryOfShortPosition , color=color.rgb(8, 138, 147) , textcolor=#ffffff, style=label.style_label_left, text="Entry: " + str.tostring(pos>0?entryOfLongPosition :entryOfShortPosition ))
label.delete(labelEntry[1])
labelStop = label.new(bar_index, pos>0?stopLossForLong :stopLossForShort , color=color.rgb(228, 39, 39) , textcolor=#ffffff, style=label.style_label_left, text="Stop Loss: " + str.tostring(math.round((pos>0?stopLossForLong :stopLossForShort) *100)/100))
labelTp1 = label.new(bar_index, pos>0?takeProfitForLong1R:takeProfitForShort1R, color=color.rgb(8, 138, 147), textcolor=#ffffff, style=label.style_label_left, text="TP1: " +str.tostring(math.round((pos>0?takeProfitForLong1R:takeProfitForShort1R) * 100)/100))
labelTp2 = label.new(bar_index, pos>0?takeProfitForLong2R:takeProfitForShort2R, color=color.rgb(8, 138, 147), textcolor=#ffffff, style=label.style_label_left, text="TP2: " + str.tostring(math.round((pos>0?takeProfitForLong2R:takeProfitForShort2R) * 100)/100))
labelTp3 = label.new(bar_index, pos>0?takeProfitForLong3R:takeProfitForShort3R, color=color.rgb(8, 138, 147), textcolor=#ffffff, style=label.style_label_left, text="TP3: " + str.tostring(math.round((pos>0?takeProfitForLong3R:takeProfitForShort3R) * 100)/100))
label.delete(labelStop [1])
label.delete(labelTp1[1])
label.delete(labelTp2[1])
label.delete(labelTp3[1])
changeCond = trend != trend[1]
[macdLine, signalLine, histLine] = ta.macd(close, 12, 26, 9)
// === Branding Table ===
var table brandingTable = table.new(position.middle_center, 1, 1, border_width=1, frame_color=color.black, bgcolor=#ffffff00)
table.cell(brandingTable, 0, 0, " @Aradya-TrendpulseNxT", bgcolor=#ffffff00, text_color=color.rgb(54, 58, 69, 75), text_size=size.tiny)
plotshape(longCond and showBuySellSignals ? up : na, title="", text="Buy", location=location.belowbar, style=shape.labelup, size=size.normal, color=color.new(color.rgb(25, 161, 66),transp = 0), textcolor=color.white )
plotshape(shortCond and showBuySellSignals ? dn : na, title="", text="Sell", location=location.abovebar, style=shape.labeldown, size=size.normal, color=color.new(color.rgb(237, 30, 30),transp = 0), textcolor=color.white)
mPlot = plot(ohlc4, title="", style=plot.style_circles, linewidth=0)
alertcondition(changeCond, title="Trend Direction Change ", message="Trend direction has changed ! ")
alertLongText = str.tostring(syminfo.ticker) + " BUY ALERT! " +
"Entry Price: " + str.tostring(entryOfLongPosition) +
", Take Profit 1: " + str.tostring(takeProfitForLong1R) +
", Take Profit 2: " + str.tostring(takeProfitForLong2R) +
", Take Profit 3: " + str.tostring(takeProfitForLong3R) +
", Stop Loss Price: " + str.tostring(stopLossForLong)
alertShortText = str.tostring(syminfo.ticker) + " SELL ALERT!" +
", Entry Price: " + str.tostring(entryOfShortPosition) +
", Take Profit 1: " + str.tostring(takeProfitForShort1R) +
", Take Profit 2: " + str.tostring(takeProfitForShort2R) +
", Take Profit 3: " + str.tostring(takeProfitForShort3R) +
", Stop Loss Price: " + str.tostring(stopLossForShort)
longJson = '{"content": "' + alertLongText + '"}'
shortJson = '{"content": "' + alertShortText + '"}'
if longCond
alert(longJson, alert.freq_once_per_bar_close)
if shortCond
alert(shortJson, alert.freq_once_per_bar_close)
// === Settings ===
useVolume = input.bool(false, "Enable Volume Confirmation")
volThreshold = input.float(1.5, "Volume Multiplier", step=0.1)
// === Logic ===
// Base trend comparison
greenBar = close > close[13]
redBar = close < close[50]
neutral = not greenBar and not redBar
// Volume logic (if enabled)
volOk = not useVolume or volume > ta.sma(volume, 20) * volThreshold
// Final bar color with transparency
barColor = greenBar and volOk ? color.new(color.rgb(38, 222, 49), 0) : // Green
redBar and volOk ? color.new(color.rgb(244, 33, 29), 0) : // Red
color.new(color.rgb(88, 57, 146), 20) // Purple (neutral, slight transparency)
// Plot the candles
plotcandle(open, high, low, close, color=barColor, wickcolor=barColor, bordercolor=barColor)
// === Optional Alerts ===
alertcondition(greenBar and volOk, "Green Bar", "Potential upward trend (Green bar)")
alertcondition(redBar and volOk, "Red Bar", "Potential downward trend (Red bar)")
// VWAP calculation (built-in function)
vwapLine = ta.vwap
// Plot VWAP
plot(vwapLine, color=color.rgb(34, 0, 255, 43), linewidth=1, title="VWAP")
Comments
Post a Comment