sadelenecek kod örneği....
PHP Code:
//@version=6
indicator("..", overlay = true, behind_chart = false, max_lines_count=500, max_labels_count=500, max_polylines_count=100, max_boxes_count=100, max_bars_back = 500)
/////////////next bar hesaplamadır//////
src777 = close
o777 = open
h777 = high
l777 = low
c777 = close
_indicator1 = (o777 - o777[1]) / o777[1]
_indicator2 = (h777 - h777[1]) / h777[1]
_indicator3 = (l777 - l777[1]) / l777[1]
_indicator4 = (c777 - c777[1]) / c777[1]
_indicator5 = (src777 - src777[1]) / src777[1]
// Inputs on Tangent Function :
tangentdiff(_src777) =>
nz((_src777 - _src777[1]) / _src777[1])
// Deep Learning Activation Function (Tanh) :
ActivationFunctionTanh(v) =>
(1 - math.exp(-2 * v)) / (1 + math.exp(-2 * v))
// DEEP LEARNING
// INPUTS :
input_1 = _indicator1
input_2 = _indicator2
input_3 = _indicator3
input_4 = _indicator4
// LAYERS :
// Input Layers
n_0 = ActivationFunctionTanh(input_1 + 0)
n_1 = ActivationFunctionTanh(input_2 + 0)
n_2 = ActivationFunctionTanh(input_3 + 0)
n_3 = ActivationFunctionTanh(input_4 + 0)
//
fun_open() =>
float _output = na
n_4 = ActivationFunctionTanh(0.030535 * n_0 + 5.113012 * n_1 + -26.085717 * n_2 + -5.320280 * n_3 + 7.354752)
n_5 = ActivationFunctionTanh(4.167948 * n_0 + 7.225875 * n_1 + -0.871215 * n_2 + -8.894535 * n_3 + -7.064751)
n_6 = ActivationFunctionTanh(-0.806293 * n_0 + -0.304470 * n_1 + -3.909741 * n_2 + -5.009985 * n_3 + 5.127558)
n_7 = ActivationFunctionTanh(-29.736063 * n_0 + 28.668433 * n_1 + 0.138417 * n_2 + -57.588543 * n_3 + 2.824914)
n_8 = ActivationFunctionTanh(-0.429393 * n_0 + 0.482744 * n_1 + -0.789797 * n_2 + -2.987460 * n_3 + -4.310747)
n_9 = ActivationFunctionTanh(1.758357 * n_0 + -0.618090 * n_1 + 2.449362 * n_2 + -1.583126 * n_3 + 1.165846)
_output := ActivationFunctionTanh(-0.653030 * n_4 + -4.646999 * n_5 + -1.678999 * n_6 + -17.077652 * n_7 + 0.875426 * n_8 + -6.672465 * n_9 + 6.940722)
_output
fun_high() =>
float _output = na
n_4 = ActivationFunctionTanh(10.186543 * n_0 + -30.964897 * n_1 + 21.672385 * n_2 + -40.895894 * n_3 + 7.957443)
n_5 = ActivationFunctionTanh(-15.252332 * n_0 + 14.845403 * n_1 + 10.621491 * n_2 + -23.817824 * n_3 + 2.947530)
n_6 = ActivationFunctionTanh(-15.179010 * n_0 + -30.011878 * n_1 + 35.650459 * n_2 + -61.480486 * n_3 + 3.898503)
n_7 = ActivationFunctionTanh(35.656454 * n_0 + -11.134354 * n_1 + -28.071578 * n_2 + 2.923959 * n_3 + -1.805703)
n_8 = ActivationFunctionTanh(3.462374 * n_0 + -13.644019 * n_1 + -30.226394 * n_2 + -1.083953 * n_3 + 23.032872)
n_9 = ActivationFunctionTanh(-47.265829 * n_0 + 19.021801 * n_1 + 10.565216 * n_2 + -27.520789 * n_3 + 6.947500)
_output := ActivationFunctionTanh(-0.696537 * n_4 + -1.349433 * n_5 + 27.262956 * n_6 + -1.042353 * n_7 + -0.540196 * n_8 + -10.735585 * n_9 + 1.303216)
_output
fun_low() =>
float _output = na
n_4 = ActivationFunctionTanh(4.363108 * n_0 + -18.301472 * n_1 + -15.376884 * n_2 + 21.208559 * n_3 + -0.458119)
n_5 = ActivationFunctionTanh(-2.651826 * n_0 + 5.205410 * n_1 + -5.920993 * n_2 + -4.847458 * n_3 + 8.315580)
n_6 = ActivationFunctionTanh(13.885322 * n_0 + -5.517922 * n_1 + -15.241118 * n_2 + -8.673229 * n_3 + -4.954015)
n_7 = ActivationFunctionTanh(10.490466 * n_0 + -25.201536 * n_1 + 10.262121 * n_2 + -1.116144 * n_3 + -5.254103)
n_8 = ActivationFunctionTanh(-14.687736 * n_0 + 9.030202 * n_1 + -17.332462 * n_2 + 8.068070 * n_3 + 0.755134)
n_9 = ActivationFunctionTanh(0.895168 * n_0 + -1.737740 * n_1 + 4.899143 * n_2 + -7.718495 * n_3 + 5.493688)
_output := ActivationFunctionTanh(4.132907 * n_4 + -17.501595 * n_5 + 4.617443 * n_6 + -28.476857 * n_7 + -5.888234 * n_8 + -24.434500 * n_9 + 41.318760)
_output
fun_close() =>
float _output = na
n_4 = ActivationFunctionTanh(22.427157 * n_0 + -26.691701 * n_1 + 4.937141 * n_2 + 9.034960 * n_3 + -10.692978)
n_5 = ActivationFunctionTanh(-38.288087 * n_0 + 10.050028 * n_1 + -44.706345 * n_2 + -17.816354 * n_3 + 30.566226)
n_6 = ActivationFunctionTanh(-33.995444 * n_0 + 14.501766 * n_1 + -43.286508 * n_2 + -13.387415 * n_3 + 24.708075)
n_7 = ActivationFunctionTanh(-14.392948 * n_0 + 28.483095 * n_1 + -22.979338 * n_2 + -7.658263 * n_3 + -5.650564)
n_8 = ActivationFunctionTanh(28.837901 * n_0 + -26.354494 * n_1 + 0.520683 * n_2 + 25.004913 * n_3 + -17.883236)
n_9 = ActivationFunctionTanh(-4.811354 * n_0 + -4.036420 * n_1 + -8.332775 * n_2 + -1.157164 * n_3 + 0.466793)
_output := ActivationFunctionTanh(-22.053311 * n_4 + 3.652552 * n_5 + -4.390465 * n_6 + 2.103060 * n_7 + 20.027285 * n_8 + 11.510129 * n_9 + -0.415015)
_output
// Current Open Values
_chg_open = tangentdiff(o777) * 100
_seed_open = (fun_open() - _chg_open) / 100
f_open = o777 * (1 - _seed_open)
// Current High Values
_chg_high = tangentdiff(h777) * 100
_seed_high = (fun_high() - _chg_high) / 100
f_high = h777 * (1 - _seed_high)
// Current Low Values
_chg_low = tangentdiff(l777) * 100
_seed_low = (fun_low() - _chg_low) / 100
f_low = l777 * (1 - _seed_low)
// Current Close Values
_chg_c = tangentdiff(c777) * 100
_seed_c = (fun_close() - _chg_c) / 100
f_close = c777 * (1 - _seed_c)
plotcandle(f_close, f_high, f_low, f_open, color = f_close > f_close[100] ? color.rgb(243, 244, 237, 95) : color.rgb(248, 4, 4, 95), wickcolor = color.rgb(4, 4, 4), title = "N-BAR")
//@version=6
// ============================================================================
// CONFIRMATION SETTINGS
// ============================================================================
confirmationMode = input.string("Confirmed Only", "Signal Mode",
options=["Confirmed Only", "Confirmed + Preview", "Preview Only"],
tooltip="Confirmed Only = No repainting | Preview = Shows potential signals",
group="SIGNAL CONTROLS")
confirmationBars = input.int(0, "Extra Confirmation Bars",
minval=0, maxval=5,
tooltip="Additional bars to wait before confirming signal (0 = immediate)",
group="SIGNAL CONTROLS")
// ============================================================================
// SENSITIVITY PRESET SYSTEM - UNIVERSAL (ALL INSTRUMENTS & TIMEFRAMES)
// ============================================================================
input_sensitivity = input.string("Medium", "Sensitivity Preset",
options=["Very High", "High", "Medium", "Low", "Very Low", "Custom"],
tooltip="Very High = Most signals | Very Low = Fewest, highest quality signals",
group="MAIN CONTROLS")
// ATR Multiplier: PRIMARY sensitivity control (adapts to any instrument/timeframe)
float atrMultiplier = switch input_sensitivity
"Very High" => 0.8
"High" => 1.2
"Medium" => 2.0
"Low" => 2.8
"Very Low" => 3.5
=> na
// Percentage Threshold: MINIMAL backup (prevents issues when ATR is too small)
float percentThreshold = switch input_sensitivity
"Very High" => 0.03
"High" => 0.05
"Medium" => 0.08
"Low" => 0.12
"Very Low" => 0.15
=> na
// ============================================================================
// MANUAL SETTINGS FOR CUSTOM MODE
// ============================================================================
bool isCustom = input_sensitivity == "Custom"
input_method = input.string("average", "Calculation Method",
options=["average", "high_low"],
tooltip="average = smoother | high_low = more responsive",
group="ADVANCED SETTINGS")
input_percentamount = isCustom ? input.float(0.08, "Percentage Reversal (%)",
minval=0.01, maxval=1.0, step=0.01,
tooltip="Price must reverse by this % - acts as minimum threshold",
group="ADVANCED SETTINGS") : 0.08
input_revAmount = isCustom ? input.float(1.0, "Absolute Reversal",
minval=0.01, maxval=50.0, step=0.1,
tooltip="Minimum absolute price reversal amount (safety floor)",
group="ADVANCED SETTINGS") : 1.0
input_atrreversal = isCustom ? input.float(2.0, "ATR Multiplier",
minval=0.1, maxval=10.0, step=0.1,
tooltip="Primary sensitivity control - reversal = ATR x this multiplier",
group="ADVANCED SETTINGS") : 2.0
input_atrlength = input.int(14, "ATR Length", minval=1, maxval=50,
tooltip="Period for ATR calculation (14 is standard)",
group="ADVANCED SETTINGS")
input_averagelength = input.int(5, "Average Length", minval=1, maxval=50,
tooltip="Smoothing period for high/low calculation when using 'average' method",
group="ADVANCED SETTINGS")
// ============================================================================
// ZONE SETTINGS
// ============================================================================
input_showSupplyDemand = input.string("Pivot", "Supply/Demand Display",
options=["Pivot", "Arrow", "None"],
tooltip="Visual style for supply/demand zones",
group="ZONES")
input_numbersuppdemandtoshow = input.int(3, "Number of Zones",
minval=0, maxval=20,
tooltip="Maximum number of zones to display",
group="ZONES")
input_showsupplydemandcloud = input.bool(false, "Show Supply/Demand Zones",
tooltip="Display rectangular zones at pivot points",
group="ZONES")
input_zoneExtension = input.int(20, "Zone Box Extension (bars)",
minval=5, maxval=100,
tooltip="How many bars forward to extend zones",
group="ZONES")
zoneThickness = input.float(0.02, "Zone Thickness (%)",
minval=0.01, maxval=0.2, step=0.01,
tooltip="Thickness of rectangular zone as % of price",
group="ZONES")
// ============================================================================
// LABEL SETTINGS
// ============================================================================
input_lineExtension = input.int(5, "Stop Line Extension",
minval=1, maxval=50,
tooltip="Bars to extend horizontal reversal lines",
group="LABELS")
input_maxLines = input.int(10, "Maximum Lines to Display",
minval=3, maxval=50,
tooltip="Maximum number of reversal lines on chart",
group="LABELS")
labelSizeOption = input.string("Normal", "Label Size",
options=["Small", "Normal", "Large"],
group="LABELS")
labelSize = switch labelSizeOption
"Small" => size.small
"Normal" => size.normal
"Large" => size.large
=> size.normal
// ============================================================================
// INFO TABLE SETTINGS
// ============================================================================
showInfoTable = input.bool(true, "Show Info Table",
tooltip="Display indicator settings and status",
group="INFO TABLE")
tablePosition = input.string("Top Right", "Table Position",
options=["Top Right", "Top Left", "Top Center", "Bottom Right", "Bottom Left", "Bottom Center"],
group="INFO TABLE")
tableSizeOption = input.string("Normal", "Table Size",
options=["Tiny", "Small", "Normal", "Large", "Huge"],
group="INFO TABLE")
// ============================================================================
// CALCULATE FINAL REVERSAL THRESHOLD - FIXED CALCULATION
// ============================================================================
float finalATRMult = isCustom ? input_atrreversal : atrMultiplier
float finalPctThreshold = isCustom ? input_percentamount : percentThreshold
atrValue = ta.atr(input_atrlength)
// FIXED: Removed the /100 division - percentages now work correctly
reversalAmount = math.max(close * finalPctThreshold / 100,
math.max(input_revAmount, finalATRMult * atrValue))
// ============================================================================
// MOVING AVERAGE SIGNALS
// ============================================================================
superfast_length = 9
fast_length = 14
slow_length = 21
mov_avg9 = ta.ema(close, superfast_length)
mov_avg14 = ta.ema(close, fast_length)
mov_avg21 = ta.ema(close, slow_length)
buy = mov_avg9 > mov_avg14 and mov_avg14 > mov_avg21 and low > mov_avg9
stopbuy = mov_avg9 <= mov_avg14
buynow = not buy[1] and buy
var int buysignal = 0
buysignal := buynow and not stopbuy ? 1 : buysignal == 1 and stopbuy ? 0 : buysignal
sell = mov_avg9 < mov_avg14 and mov_avg14 < mov_avg21 and high < mov_avg9
stopsell = mov_avg9 >= mov_avg14
sellnow = not sell[1] and sell
var int sellsignal = 0
sellsignal := sellnow and not stopsell ? 1 : sellsignal == 1 and stopsell ? 0 : sellsignal
// ============================================================================
// COLORS
// ============================================================================
GREEN = #00FF00
RED = #FF0000
PURPLE = #ab47bc
// ============================================================================
// ZIGZAG CALCULATION
// ============================================================================
priceh = input_method == "high_low" ? high : ta.ema(high, input_averagelength)
pricel = input_method == "high_low" ? low : ta.ema(low, input_averagelength)
pricehConfirmed = priceh[confirmationBars]
pricelConfirmed = pricel[confirmationBars]
actualHighConfirmed = high[confirmationBars]
actualLowConfirmed = low[confirmationBars]
var float zhigh = na
var float zlow = na
var float zhighActual = na
var float zlowActual = na
var int zhighbar = 0
var int zlowbar = 0
var int direction = 0
if na(zhigh) or na(zlow)
zhigh := pricehConfirmed
zlow := pricelConfirmed
zhighActual := actualHighConfirmed
zlowActual := actualLowConfirmed
zhighbar := bar_index - confirmationBars
zlowbar := bar_index - confirmationBars
direction := 1
var float lastConfirmedPivotPrice = na
var float lastConfirmedPivotActual = na
var int lastConfirmedPivotBar = 0
var bool lastConfirmedPivotIsHigh = false
var bool confirmedPivotDetected = false
confirmedPivotDetected := false
if direction == 1
if pricehConfirmed > zhigh
zhigh := pricehConfirmed
zhighActual := actualHighConfirmed
zhighbar := bar_index - confirmationBars
if zhigh - pricelConfirmed >= reversalAmount
lastConfirmedPivotPrice := zhigh
lastConfirmedPivotActual := zhighActual
lastConfirmedPivotBar := zhighbar
lastConfirmedPivotIsHigh := true
confirmedPivotDetected := true
direction := -1
zlow := pricelConfirmed
zlowActual := actualLowConfirmed
zlowbar := bar_index - confirmationBars
else if direction == -1
if pricelConfirmed < zlow
zlow := pricelConfirmed
zlowActual := actualLowConfirmed
zlowbar := bar_index - confirmationBars
if pricehConfirmed - zlow >= reversalAmount
lastConfirmedPivotPrice := zlow
lastConfirmedPivotActual := zlowActual
lastConfirmedPivotBar := zlowbar
lastConfirmedPivotIsHigh := false
confirmedPivotDetected := true
direction := 1
zhigh := pricehConfirmed
zhighActual := actualHighConfirmed
zhighbar := bar_index - confirmationBars
// ============================================================================
// PREVIEW DETECTION
// ============================================================================
var float previewPivotPrice = na
var int previewPivotBar = 0
var bool previewIsHigh = false
var bool showPreview = false
showPreview := false
if confirmationMode != "Confirmed Only"
var float zhigh_preview = na
var float zlow_preview = na
var int direction_preview = 0
if na(zhigh_preview)
zhigh_preview := priceh
zlow_preview := pricel
direction_preview := 1
if direction_preview == 1
if priceh > zhigh_preview
zhigh_preview := priceh
if zhigh_preview - pricel >= reversalAmount
previewPivotPrice := zhigh_preview
previewPivotBar := bar_index
previewIsHigh := true
showPreview := true
direction_preview := -1
zlow_preview := pricel
else if direction_preview == -1
if pricel < zlow_preview
zlow_preview := pricel
if priceh - zlow_preview >= reversalAmount
previewPivotPrice := zlow_preview
previewPivotBar := bar_index
previewIsHigh := false
showPreview := true
direction_preview := 1
zhigh_preview := priceh
// ============================================================================
// SIGNAL DETECTION
// ============================================================================
var float EIL = na
var float EIH = na
var float EILActual = na
var float EIHActual = na
var int EILBar = 0
var int EIHBar = 0
var int dir789 = 0
var int signal = 0
if confirmedPivotDetected
if lastConfirmedPivotIsHigh
EIH := lastConfirmedPivotPrice
EIHActual := lastConfirmedPivotActual
EIHBar := lastConfirmedPivotBar
dir789 := -1
else
EIL := lastConfirmedPivotPrice
EILActual := lastConfirmedPivotActual
EILBar := lastConfirmedPivotBar
dir789 := 1
if dir789 > 0 and pricelConfirmed > EIL
signal := signal <= 0 ? 1 : signal
else if dir789 < 0 and pricehConfirmed < EIH
signal := signal >= 0 ? -1 : signal
U1 = signal > 0 and signal[1] <= 0
D1 = signal < 0 and signal[1] >= 0
// ============================================================================
// HELPER FUNCTION
// ============================================================================
formatPrice(float price) =>
priceStr = str.tostring(price, format.mintick)
parts = str.split(priceStr, ".")
intPart = array.get(parts, 0)
decPart = array.size(parts) > 1 ? "." + array.get(parts, 1) : ""
intLen = str.length(intPart)
result = ""
for i = 0 to intLen - 1
if i > 0 and (intLen - i) % 3 == 0
result := result + ","
result := result + str.substring(intPart, i, i + 1)
result + decPart
// ============================================================================
// REVERSAL LABELS
// ============================================================================
var array<line> allLines = array.new<line>()
var array<int> lineStartBars = array.new<int>()
var array<int> lineEndBars = array.new<int>()
if U1 and confirmationMode != "Preview Only"
pivotBar = EILBar
exactLow = EILActual
lbl = label.new(pivotBar, exactLow, "\n" + formatPrice(EIL),
style=label.style_label_upper_right,
color=color.new(GREEN, 100),
textcolor=color.white,
size=labelSize,
textalign=text.align_left,
xloc=xloc.bar_index)
endBar = pivotBar + input_lineExtension
horizLine = line.new(pivotBar, exactLow, endBar, exactLow,
color=color.new(GREEN, 0),
width=5,
style=line.style_solid,
extend=extend.none)
array.push(allLines, horizLine)
array.push(lineStartBars, pivotBar)
array.push(lineEndBars, endBar)
if D1 and confirmationMode != "Preview Only"
pivotBar = EIHBar
exactHigh = EIHActual
lbl = label.new(pivotBar, exactHigh, "\n" + formatPrice(EIH),
style=label.style_label_lower_right,
color=color.new(RED, 100),
textcolor=color.white,
size=labelSize,
textalign=text.align_left,
xloc=xloc.bar_index)
endBar = pivotBar + input_lineExtension
horizLine = line.new(pivotBar, exactHigh, endBar, exactHigh,
color=color.new(RED, 0),
width=5,
style=line.style_solid,
extend=extend.none)
array.push(allLines, horizLine)
array.push(lineStartBars, pivotBar)
array.push(lineEndBars, endBar)
// ============================================================================
// LINE MANAGEMENT
// ============================================================================
while array.size(allLines) > input_maxLines
oldLine = array.shift(allLines)
line.delete(oldLine)
array.shift(lineStartBars)
array.shift(lineEndBars)
// ============================================================================
// PREVIEW LABELS
// ============================================================================
if showPreview and confirmationMode != "Confirmed Only" and barstate.islast
if previewIsHigh
label.new(previewPivotBar, high, "OLASILIK\n" + formatPrice(previewPivotPrice),
style=label.style_label_lower_right,
color=color.new(#FF6B6B, 70),
textcolor=color.new(color.white, 40),
size=labelSize,
textalign=text.align_left)
else
label.new(previewPivotBar, low, "OLASILIK\n" + formatPrice(previewPivotPrice),
style=label.style_label_upper_right,
color=color.new(#6BCF7F, 70),
textcolor=color.new(color.white, 40),
size=labelSize,
textalign=text.align_left)
// ============================================================================
// SUPPLY/DEMAND ZONES - THIN HORIZONTAL RECTANGLES
// ============================================================================
var array<box> allBoxes = array.new<box>()
if confirmedPivotDetected and input_showsupplydemandcloud
// Pivot LOW = Demand Zone (GREEN), Pivot HIGH = Supply Zone (RED)
bool isDemandZone = lastConfirmedPivotIsHigh == false
color zoneColor = isDemandZone ? color.new(GREEN, 85) : color.new(RED, 85)
color zoneBorder = isDemandZone ? color.new(GREEN, 40) : color.new(RED, 40)
// Use actual pivot price for zone placement
float pivotPrice = lastConfirmedPivotActual
// Create thin rectangle centered on pivot
float halfThickness = (pivotPrice * zoneThickness / 100) / 2
float zoneTop = pivotPrice + halfThickness
float zoneBottom = pivotPrice - halfThickness
int zoneStart = lastConfirmedPivotBar
int zoneEnd = zoneStart + input_zoneExtension
zoneBox = box.new(zoneStart, zoneTop, zoneEnd, zoneBottom,
border_color=zoneBorder,
bgcolor=zoneColor,
border_width=1,
extend=extend.none,
text = isDemandZone ? "DEMAND" : "SUPPLY",
text_size = size.tiny,
text_color = isDemandZone ? color.new(GREEN, 20) : color.new(RED, 20),
text_halign = text.align_center,
text_valign = text.align_center)
array.push(allBoxes, zoneBox)
// Manage box count
while array.size(allBoxes) > input_numbersuppdemandtoshow and input_numbersuppdemandtoshow > 0
oldBox = array.shift(allBoxes)
box.delete(oldBox)
// ============================================================================
// INFORMATION TABLE
// ============================================================================
tablePos = switch tablePosition
"Top Right" => position.top_right
"Top Left" => position.top_left
"Top Center" => position.top_center
"Bottom Right" => position.bottom_right
"Bottom Left" => position.bottom_left
"Bottom Center" => position.bottom_center
=> position.top_right
headerSize = switch tableSizeOption
"Tiny" => size.tiny
"Small" => size.small
"Normal" => size.normal
"Large" => size.large
"Huge" => size.huge
=> size.normal
cellSize = switch tableSizeOption
"Tiny" => size.tiny
"Small" => size.small
"Normal" => size.small
"Large" => size.normal
"Huge" => size.large
=> size.small
//var table infoTable = table.new(tablePos, 2, 8, bgcolor=color.new(#1E1E1E, 5),
//frame_color=color.new(GREEN, 40), frame_width=2,
//border_width=1, border_color=color.new(#444444, 60))
//if barstate.islast and showInfoTable
//table.cell(infoTable, 0, 0, "YÖRÜK", text_color=color.new(GREEN, 0),
//text_size=headerSize, bgcolor=color.new(#0A0A0A, 0))
//table.cell(infoTable, 1, 0, "2026", text_color=color.new(GREEN, 0),
//text_size=headerSize, bgcolor=color.new(#0A0A0A, 0))
//table.cell(infoTable, 0, 1, "Mode:", text_color=color.white, text_size=cellSize,
//bgcolor=color.new(#1E1E1E, 0))
//color modeColor = color.new(GREEN, 0)
//if confirmationMode == "Confirmed + Preview"
//modeColor := color.new(#FFA500, 0)
//if confirmationMode == "Preview Only"
//modeColor := color.new(#FF6B6B, 0)
//table.cell(infoTable, 0, 7, "SİSTEM:", text_color=color.white,
//text_size=cellSize, bgcolor=color.new(#1E1E1E, 0))
//trendText = buysignal == 1 ? "LONG" : sellsignal == 1 ? "SHORT" : "NÖTR"
//trendTextColor = buysignal == 1 ? color.green : sellsignal == 1 ? color.red : color.purple
//table.cell(infoTable, 1, 7, trendText, text_color=trendTextColor,
//text_size=cellSize, bgcolor=color.new(#1E1E1E, 0))
// ===========================sonnn=================================================
//@version=5
_indicator18 = (o777 - o777[1]) / o777[1]
_indicator28 = (h777 - h777[1]) / h777[1]
n_08 = ActivationFunctionTanh(_indicator18), n_18 = ActivationFunctionTanh(_indicator28)
f_open8 = o777 * (1 - (ActivationFunctionTanh(0.03 * n_08 + 5.11 * n_18) - tangentdiff(o777) * 1000) / 1000)
f_high8 = h777 * (1 - (ActivationFunctionTanh(10.1 * n_08 - 30.9 * n_18) - tangentdiff(h777) * 1000) / 1000)
f_low8 = l777 * (1 - (ActivationFunctionTanh(4.36 * n_08 - 18.3 * n_18) - tangentdiff(l777) * 1000) / 1000)
f_close8 = c777 * (1 - (ActivationFunctionTanh(22.4 * n_08 - 26.6 * n_18) - tangentdiff(c777) * 1000) / 1000)
// --- 3 Bölüntülü Bar Çizimi ---
isBull8 = f_close8 > f_open8
mainColor8 = isBull8 ? color.green : color.red
plotcandle(f_open8, f_open8 + (f_close8 - f_open8) * 0.33, f_open8, f_open8 + (f_close8 - f_open8) * 0.33, "X", color = color.new(color.gray, 75))
plotcandle(f_open8 + (f_close8 - f_open8) * 0.33, f_high8, f_low8, f_open8 + (f_close8 - f_open8) * 0.66, "Y", color = color.new(mainColor8, 40))
plotcandle(f_open8 + (f_close8 - f_open8) * 0.66, f_close8, f_open8 + (f_close8 - f_open8) * 0.66, f_close8, "Z", color = color.new(color.gray, 75))
////////////////////////////15 DAKİKALIK GANN HESAPLAMA/////////
// --- 2. Gann Modülü (Hatanın Giderildiği Bölüm) ---
tf_gann = input.timeframe('15', title='Gann Zaman Dilimi')
p_range = input.float(0.1, title='Gann Fiyat Aralığı')
t_range = input.int(101, title='Gann Bar Aralığı')
f_zigzag(_h, _l) =>
var int _tr = 0
_up = _h > _h[1]
_dn = _l < _l[1]
_tr := (_tr > 0 and _dn) ? -1 : (_tr < 0 and _up) ? 1 : (_tr == 0 ? (_up ? 1 : -1) : _tr)
ta.change(_tr) > 0 ? _l[1] : ta.change(_tr) < 0 ? _h[1] : na
// v5'te fixnan fonksiyonu ta. kütüphanesine ait değildir, doğrudan çağrılır
zigzag_src = request.security(syminfo.tickerid, tf_gann, fixnan(f_zigzag(high, low)))
f_bull_gann_line(_pr, _tr, _src) =>
_decay = _pr / _tr
var float _g_line = na
_g_line := _g_line - _decay
if ta.change(_src) > 0
_g_line := _src
_g_line
bull_gann_1_1 = f_bull_gann_line(p_range, t_range, zigzag_src)
// --- 5. Görselleştirmeler ---
plot(ta.change(zigzag_src) > 0 ? na : bull_gann_1_1, title='Gann', color=color.new(color.yellow, 0), linewidth=1, style=plot.style_linebr)
/////////////////
////////// TREND TAKİBİ İÇİN KULLANILAN KOD.////////
var string vanity_group = "Visual Settings"
magic_wand_toggle = input.bool(true, "Show Active CISD Level (Plot)", group=vanity_group)
drama_filter = input.string("Both", "Triggered CISD Display", options=["Both", "Bullish Only", "Bearish Only", "None"], group=vanity_group)
amnesia_mode = input.bool(false, "Limit Displayed Historical Lines", group=vanity_group)
short_term_memory = input.int(10, "Max Lines to Show", minval=1, group=vanity_group)
yell_at_me = input.bool(true, "Show Labels", group=vanity_group)
girth_units = input.int(1, "Line Width", minval=1, group=vanity_group)
scream_volume = input.string(size.normal, "Label Size", options=[size.tiny, size.small, size.normal, size.large], group=vanity_group)
hipster_font_toggle = input.string("Default", "Font Family", options=["Default", "Monospace"], group=vanity_group)
fashion_choice = input.string("Solid", "Triggered Line Style", options=["Solid", "Dashed", "Dotted"], group=vanity_group)
crayon_box = "Colors"
shrek_mode = input.color(color.new(#e2fb01, 0), "Bullish CISD", group=crayon_box)
blood_bath = input.color(color.new(#d400ff, 0), "Bearish CISD", group=crayon_box)
nerd_stats = "Debug"
paranoia_switch = input.bool(false, "Debug: Show Extreme Tracking", group=nerd_stats)
gossip_column = "HTF Trend Panel"
stalker_mode = input.bool(true, "Show Multi-Timeframe Table", group=gossip_column)
feng_shui = input.string("Bottom Right", "Table Position", options=["Top Right", "Middle Right", "Bottom Right", "Bottom Left"], group=gossip_column)
eye_test = input.string("Small", "Table Size", options=["Tiny", "Small", "Normal", "Large"], group=gossip_column)
// ---------------------------------------------------------
var string fancy_typeface = hipster_font_toggle == "Monospace" ? font.family_monospace : font.family_default
decode_fashion_statement(outfit) =>
switch outfit
"Solid" => line.style_solid
"Dashed" => line.style_dashed
=> line.style_dotted
chosen_style = decode_fashion_statement(fashion_choice)
var int vibes = 0
var float bagholder_entry = na
var int time_machine_setting = na
var float pain_threshold = na
var label sticky_note_of_shame = na
var array<line> graveyard_of_hopes = array.new<line>()
var array<label> choir_of_screams = array.new<label>()
consult_the_crystal_ball(int bias) =>
int temporal_shift = 0
float ancient_price = open
for i = 0 to 500
int candle_attitude = close[i] > open[i] ? 1 : close[i] < open[i] ? -1 : 0
if candle_attitude == 0
continue
bool mood_match = candle_attitude == bias
if not mood_match
break
temporal_shift := i
ancient_price := open[i]
[ancient_price, bar_index - temporal_shift]
archaeologist_jones(int bias) =>
int i = 1
bool artifact_found = false
int dig_site_idx = 0
float artifact_value = na
for j = 1 to 500
i := j
int candle_attitude = close[i] > open[i] ? 1 : close[i] < open[i] ? -1 : 0
if candle_attitude == 0
continue
bool is_correct_era = candle_attitude == bias
if not artifact_found
if is_correct_era
artifact_found := true
dig_site_idx := i
artifact_value := open[i]
else
if not is_correct_era
break
dig_site_idx := i
artifact_value := open[i]
[artifact_value, bar_index - dig_site_idx]
if vibes == 0 and bar_index > 10
int first_impression = close > open ? 1 : close < open ? -1 : 0
if first_impression == 0
for k = 1 to 50
first_impression := close[k] > open[k] ? 1 : close[k] < open[k] ? -1 : 0
if first_impression != 0
break
if first_impression != 0
vibes := first_impression
[origin_price, origin_time] = consult_the_crystal_ball(first_impression)
bagholder_entry := origin_price
time_machine_setting := origin_time
pain_threshold := first_impression == 1 ? high : low
int candle_personality = close > open ? 1 : close < open ? -1 : 0
float fresh_hopium = na
int fresh_timestamp = na
if vibes == 1
if high > pain_threshold
pain_threshold := high
if candle_personality == 1
[p_price, p_idx] = consult_the_crystal_ball(1)
fresh_hopium := p_price
fresh_timestamp := p_idx
else
[p_price, p_idx] = archaeologist_jones(1)
fresh_hopium := p_price
fresh_timestamp := p_idx
bagholder_entry := fresh_hopium
time_machine_setting := fresh_timestamp
else if vibes == -1
if low < pain_threshold
pain_threshold := low
if candle_personality == -1
[p_price, p_idx] = consult_the_crystal_ball(-1)
fresh_hopium := p_price
fresh_timestamp := p_idx
else
[p_price, p_idx] = archaeologist_jones(-1)
fresh_hopium := p_price
fresh_timestamp := p_idx
bagholder_entry := fresh_hopium
time_machine_setting := fresh_timestamp
bool shorts_squeezed = vibes == -1 and close > bagholder_entry
bool longs_rekt = vibes == 1 and close < bagholder_entry
if shorts_squeezed or longs_rekt
bool should_i_paint_it = false
if drama_filter == "Both"
should_i_paint_it := true
else if drama_filter == "Bullish Only"
should_i_paint_it := shorts_squeezed
else if drama_filter == "Bearish Only"
should_i_paint_it := longs_rekt
if should_i_paint_it
color mood_ring = shorts_squeezed ? shrek_mode : blood_bath
//line tragedy_line = line.new(time_machine_setting, bagholder_entry, bar_index, bagholder_entry, color=mood_ring, width=girth_units, style=chosen_style)
//array.push(graveyard_of_hopes, tragedy_line)
label loud_noise = na
//if yell_at_me
//int middle_of_nowhere = math.round((time_machine_setting + bar_index) / 2)
//string gibberish = shorts_squeezed ? "+ALL" : "-SAT"
//color ink_color = shorts_squeezed ? shrek_mode : blood_bath
//loud_noise := label.new(middle_of_nowhere, bagholder_entry, gibberish, style=shorts_squeezed ? label.style_label_down : label.style_label_up, color=color.new(#000000, 100), textcolor=ink_color, size=scream_volume, text_font_family = fancy_typeface)
//array.push(choir_of_screams, loud_noise)
int new_emotional_state = shorts_squeezed ? 1 : -1
vibes := new_emotional_state
[reset_price, reset_time] = consult_the_crystal_ball(new_emotional_state)
bagholder_entry := reset_price
time_machine_setting := reset_time
pain_threshold := new_emotional_state == 1 ? high : low
color active_crayon = vibes == 1 ? shrek_mode : blood_bath
plot(magic_wand_toggle ? bagholder_entry : na, "TR", color=active_crayon, linewidth=girth_units, style=plot.style_line)
//////////////////////BU KODUN SONUDUR.///////////////////
// --- 1. Dalga Mantığı ---
isClosed = barstate.isconfirmed
spaceUp = (high - close) * 0.65
spaceDown = (open - low) * 0.65
brightRed = color.rgb(0, 0, 0) // Siyah
brightGreen = color.white // Beyaz
// Ham Koşullar (Senin formülün)
bullRaw12 = isClosed and close[3] < open[3] and close < open and close < low[3]
bearRaw12 = isClosed and close[3] > open[3] and close > open and close > high[3]
// --- 2. 6 Bar Hafıza Taraması ---
// Son 6 bar içinde herhangi bir siyah veya beyaz sinyal var mı?
hasSiyahIn6 = ta.highest(bullRaw12 ? 1 : 0, 6) > 0
hasBeyazIn6 = ta.highest(bearRaw12 ? 1 : 0, 6) > 0
// Karar Yapısı
isZit = hasSiyahIn6 and hasBeyazIn6
isAl = hasBeyazIn6 and not hasSiyahIn6
isSat = hasSiyahIn6 and not hasBeyazIn6
// --- 3. Ofsetli Sembol Yerleştirme ---
// Etiketleri bar_index - 3 diyerek tam 'kırılma' barına ofsetliyoruz
if bullRaw12
label.new(bar_index - 3, high[3] + spaceUp, '1', style=label.style_none, textcolor=brightRed, size=size.huge)
label.new(bar_index-3, high + spaceUp, '0', style=label.style_none, textcolor=brightRed, size=size.huge)
if bearRaw12
label.new(bar_index - 3, low[3] - spaceDown, '1', style=label.style_none, textcolor=brightGreen, size=size.huge)
label.new(bar_index-3, low - spaceDown, '0', style=label.style_none, textcolor=brightGreen, size=size.huge)
// --- 4. Durum Bildirimleri ---
if isZit and not isZit[1]
label.new(bar_index-3, high + (spaceUp * 4), "", color=color.orange, textcolor=color.white, style=label.style_label_down)
///////////////////////
// --- 2. KİLİTLEME MEKANİZMASI (LOCK) ---
var bool lockAL = false
var bool lockSAT = false
if bearRaw12
lockAL := true
lockSAT := false
if bullRaw12
lockSAT := true
lockAL := false
// --- 3. 6 Bar Hafıza ve Karar ---
hasSiyahIn63 = ta.highest(bullRaw12 ? 1 : 0, 6) > 0
hasBeyazIn63 = ta.highest(bearRaw12 ? 1 : 0, 6) > 0
isZit3 = hasSiyahIn63 and hasBeyazIn63
// Zıtlık yokken kilitlerin hükmü geçerlidir
isAlZone = lockAL and not isZit3
isSatZone = lockSAT and not isZit3
// Barları da kilitli bölge rengine göre boyayalım ki nizam tam olsun
//barcolor(isZit3 ? color.gray : isAlZone ? color.lime : isSatZone ? color.red : na)
////////////////////
///////////////////
// --- 5. Yörük Sinyali & PSAR ---
psar = ta.sar(0.0, 0.001, 0.99)
plot(psar, "PSAR4", style=plot.style_line, color=color.new(color.red, 00))
psar1 = ta.sar(0.0, 0.01, 0.99)
plot(psar1, "PSAR1", style=plot.style_line, color=color.new(color.fuchsia, 00))
//////////////////////////////İMZA BÖLÜMÜ/////////////
var tb = table.new(position.bottom_center, 1, 1, bgcolor = #161114)
if barstate.isfirst
table.cell(tb, 0, 0, 'Yatırım tavsiyesi olarak KULLANILAMAZ. @yörük@ 2026 ', text_size = size.normal, text_color = #f4f2ef)
///////////////////DERİN ÖĞRENME BÖLÜMÜDÜR//////////////
//@version=5
// --- INPUTS ---
lookback = input.int(20, "Pivot Lookback", minval=2)
showLiquidity = input.bool(true, "Show BSL/SSL Lines")
showOTE = input.bool(true, "Show OTE Levels")
// --- LIQUIDITY CALCULATIONS (Pivot Highs/Lows) ---
ph = ta.pivothigh(high, lookback, lookback)
pl = ta.pivotlow(low, lookback, lookback)
// Arrays to manage lines
var line bsl_line = na
var line ssl_line = na
// --- DETECT & DRAW BUY SIDE LIQUIDITY (BSL) ---
if not na(ph)
if not na(bsl_line)
line.set_extend(bsl_line, extend.none)
bsl_line := line.new(bar_index[lookback], ph, bar_index, ph, color=color.green, width=2, extend=extend.right)
label.new(bar_index[lookback], ph, ".", style=label.style_label_down, color=color.green, textcolor=color.white, size=size.tiny)
// --- DETECT & DRAW SELL SIDE LIQUIDITY (SSL) ---
if not na(pl)
if not na(ssl_line)
line.set_extend(ssl_line, extend.none)
ssl_line := line.new(bar_index[lookback], pl, bar_index, pl, color=color.red, width=2, extend=extend.right)
label.new(bar_index[lookback], pl, ".", style=label.style_label_up, color=color.red, textcolor=color.white, size=size.tiny)
// --- REAL-TIME LIQUIDITY SWEEP LOGIC ---
// high and low variables always represent the most recent tick on the live bar
if not na(bsl_line) and high >= line.get_y1(bsl_line)
line.set_style(bsl_line, line.style_dotted)
line.set_color(bsl_line, color.new(color.green, 50))
if not na(ssl_line) and low <= line.get_y1(ssl_line)
line.set_style(ssl_line, line.style_dotted)
line.set_color(ssl_line, color.new(color.red, 50))
////////////////
//////////////////POLİNOM HESAPLMASIDIR//////////////////////////////
source14 = input.source(close, 'Source')
length14 = input.int(2, 'Period', 1)
displayExt = input.bool(true, "", inline = "ext")
extrapolate = input.int(1, 'Extrapolate', 0, inline = "ext")
degree = input.int(1, 'Degree', 1)
colorUp = input.color(color.rgb(255, 235, 59, 100), "", inline = "col")
colorDn = input.color(color.rgb(223, 64, 251, 100), "", inline = "col")
polyreg(source14, length14, degree, extrapolate) =>
if barstate.islast
total = length14 + extrapolate
X_all = matrix.new<float>(total, degree + 1, 0.0)
for i = 0 to total - 1
for j = 0 to degree
matrix.set(X_all, i, j, math.pow(i, j))
// y (length × 1), oldest→newest over the fit window
y = matrix.new<float>(length14, 1, 0.0)
for i = 0 to length14 - 1
matrix.set(y, i, 0, source14[length14 - 1 - i])
// X_train (first `length` rows of X_all)
X_tr = matrix.new<float>(length14, degree + 1, 0.0)
for i = 0 to length14 - 1
for j = 0 to degree
matrix.set(X_tr, i, j, matrix.get(X_all, i, j))
// OLS via normal equations: (X'X)^(-1)b = X'y ⇒ b = (X'X)^(-1) X'y
Xt = matrix.transpose(X_tr) // X'
XtX = matrix.mult(Xt, X_tr) // (X'X)
Xty = matrix.mult(Xt, y) // X'y
XtX_inv = matrix.inv(XtX) // (X'X)^(-1)
b = matrix.mult(XtX_inv, Xty) // b = (X'X)^(-1) X'y
// Predictions for all rows (fit + extrap)
preds = matrix.mult(X_all, matrix.col(b,0))
preds
dist = ta.highest(ta.sma(high-low, length14), length14)*2
predictions = polyreg(source14, length14, degree, extrapolate)
drawLine(offset)=>
var lastPred = float(na)
var color = color(na)
var labels = array.new<label>()
var prevValue = float(na)
if barstate.islast
chartPoints = array.new<chart.point>()
chartPoints1 = array.new<chart.point>()
if labels.size() > 0
for l in labels
l.delete()
for [index, prediction] in predictions
Directioncolor = prediction > prevValue ? colorUp : colorDn
prevValue := prediction
predZone = index >= length14
if offset == 0
marker = displayExt ? (predZone ? "•" : "⬥") : (predZone ? "" : "⬥")
txtColor = predZone ? chart.fg_color : Directioncolor
labels.push(label.new(chart.point.from_index(index = bar_index + index - length14 + 1, price = prediction+offset), marker, color = color(na), textcolor = txtColor, style = label.style_label_center))
else if predZone and displayExt
chartPoints.push(value = chart.point.from_index(index = bar_index + index - length14 + 1, price = prediction+offset))
else if not predZone
chartPoints1.push(value = chart.point.from_index(index = bar_index + index - length14 + 1, price = prediction+offset))
if index == length14+extrapolate-1 and displayExt
lastPred := prediction
if offset < 0
style = Directioncolor == colorUp ? label.style_label_lower_left : label.style_label_upper_left
label.delete(label.new(bar_index+extrapolate, lastPred-offset, str.tostring(lastPred-offset, "##,###,###.###"), style = style, textcolor = chart.fg_color, color = color(na))[1])
label.delete(label.new(bar_index+extrapolate, lastPred, str.tostring(lastPred, "##,###,###.###"), style = style, textcolor = chart.fg_color, color = color(na))[1])
label.delete(label.new(bar_index+extrapolate, lastPred+offset, str.tostring(lastPred+offset, "##,###,###.###"), style = style, textcolor = chart.fg_color, color = color(na))[1])
color := chart.fg_color
//polyline.delete(polyline.new(chartPoints, line_width = 1, line_style = line.style_dashed, line_color = color)[1])
//polyline.delete(polyline.new(chartPoints1, line_width = 1, line_style = line.style_solid, line_color = color)[1])
lastPred
// --------------------------------------------------------------------------------------------------------------------}
drawLine(dist)
drawLine(0)
drawLine(-dist)
//////////////zaman bölümlemesidir. 240 dakka için açılışı trend çizgisidir///////////////////////////////
Yer İmleri