PROTECTED SOURCE SCRIPT

CAPITAL 121

44
//version=5
indicator("CAPITAL X", overlay=true)

// === הגדרות משתמש ===
yPos = input.string("Top", "מיקום אנכי של ה־Watermark", options = ["Top", "Middle", "Bottom"], inline = '1')
xPos = input.string("Right", "מיקום אופקי של ה־Watermark", options = ["Left", "Center", "Right"], inline = '1')
offsetY = input.int(20, "מרחק אנכי מהקצה", minval=0, maxval=100)
txtCol = input.color(color.rgb(255, 255, 255, 80), 'צבע טקסט', inline = '2')
txtSize = input.string('Large', 'גודל טקסט', options = ['Huge', 'Large', 'Normal', 'Small'], inline = '2')

// ATR והגדרות תנודתיות
lengthATR = input.int(14, title='אורך ATR')
atrRedThreshold = input.float(7.0, "רף אדום (%)", minval=0)
atrYellowThreshold = input.float(3.0, "רף צהוב (%)", minval=0)

// חישוב ATR
atrValue = ta.atr(lengthATR)
atrPercent = (atrValue / close) * 100
atrDisplay = "ATR (" + str.tostring(lengthATR) + "): " + str.tostring(atrValue, "#.##") + " (" + str.tostring(atrPercent, "#.##") + "%)"
atrEmoji = atrPercent >= atrRedThreshold ? "🔴" : atrPercent >= atrYellowThreshold ? "🟡" : "🟢"

// גודל טקסט
sizer = switch txtSize
"Huge" => size.huge
"Large" => size.large
"Normal" => size.normal
=> size.small

// מיקום טבלה על המסך
posTable = str.lower(yPos) + '_' + str.lower(xPos)

// === תצוגת טבלת Watermark ===
var table watermarkTable = table.new(posTable, 1, 1, border_width=0)
if barstate.islast
table.cell(watermarkTable, 0, 0, atrDisplay + " " + atrEmoji, text_color=txtCol, text_size=sizer, text_halign=text.align_left)

// === חישוב ממוצעים נעים ===
smaShortLength = input.int(20, title='SMA Short Length', minval=1)
smaLongLength = input.int(100, title='SMA Long Length', minval=1)
smaShort = ta.sma(close, smaShortLength)
smaLong = ta.sma(close, smaLongLength)

// ממוצע נוסף (ניטרלי)
showCustomMA = input.bool(true, title='הצג ממוצע נע מותאם אישית')
customMALength = input.int(50, title='Custom MA Length')
customMA = ta.sma(close, customMALength)
plot(showCustomMA ? customMA : na, color=color.orange, linewidth=1, title='Custom MA')

// ציור ממוצעים עיקריים
plot(smaShort, color=color.yellow, linewidth=2, title='SMA 20')
plot(smaLong, color=color.blue, linewidth=2, title='SMA 100')

// איתותים
buySignal = ta.crossover(smaShort, smaLong)
sellSignal = ta.crossunder(smaShort, smaLong)

// הצגת אזורי קנייה ומכירה
plotshape(buySignal, title='אזור קנייה', text='אזור קנייה', location=location.belowbar,
style=shape.labelup, size=size.small, color=color.green, textcolor=color.white)

plotshape(sellSignal, title='אזור מכירה', text='אזור מכירה', location=location.abovebar,
style=shape.labeldown, size=size.small, color=color.red, textcolor=color.white)

// התראות
alertcondition(buySignal, title='אזור קנייה', message='זוהה אזור קנייה!')
alertcondition(sellSignal, title='אזור מכירה', message='זוהה אזור מכירה!')

// === Volume Profile Zone (פרופיל ווליום בסיסי) ===
showVolumeProfile = input.bool(true, title="הצג Volume Profile איזורי (ניסיוני)")
vpRange = input.int(100, title="טווח ברים לניתוח Volume Profile")

var float maxVol = na
var float vwap = na
if showVolumeProfile and bar_index > vpRange
float totalVol = 0.0
float volWeightedPrice = 0.0
for i = 0 to vpRange
totalVol += volume
volWeightedPrice += volume * close
maxVol := totalVol
vwap := volWeightedPrice / totalVol

plot(showVolumeProfile and not na(vwap) ? vwap : na, color=color.purple, style=plot.style_line, linewidth=2, title='Volume Profile VWAP')

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 TradingView. Read more in the Terms of Use.