OPEN-SOURCE SCRIPT

Fibobull Düzeltme Türkce Vol.2

//version=5
//FiboBuLL
indicator("Fibobull Düzeltme Türkce Vol.2", overlay=true)

devTooltip = "Deviation is a multiplier that affects how much the price should deviate from the previous pivot in order for the bar to become a new pivot."
depthTooltip = "The minimum number of bars that will be taken into account when calculating the indicator."

// Pivots threshold
threshold_multiplier = input.float(title="Deviation", defval=10, minval=0, tooltip=devTooltip)
depth = input.int(title="Depth", defval=3, minval=2, tooltip=depthTooltip)
reverse = input(false, "Reverse", display = display.data_window)
var extendLeft = input(false, "Extend Left    |    Extend Right", inline = "Extend Lines")
var extendRight = input(true, "", inline = "Extend Lines")
var extending = extend.none
if extendLeft and extendRight
extending := extend.both
if extendLeft and not extendRight
extending := extend.left
if not extendLeft and extendRight
extending := extend.right

prices = input(true, "Show Prices", display = display.data_window)
levels = input(true, "Show Levels", inline = "Levels", display = display.data_window)
labelsPosition = input.string("Left", "Labels Position", options = ["Left", "Right"], display = display.data_window)
var int backgroundTransparency = input.int(85, "Background Transparency", minval = 0, maxval = 100, display = display.data_window)

// Text size input
textSize = input.string(title="Text Size", defval="normal", options=["small", "normal", "large"], display = display.data_window)

import TradingView/ZigZag/7 as zigzag

update() =>
var settings = zigzag.Settings.new(threshold_multiplier, depth, color(na), false, false, false, false, "Absolute", true)
var zigzag.ZigZag zigZag = zigzag.newInstance(settings)
var zigzag.Pivot lastP = na
var float startPrice = na
var float endPrice = na // End price değişkenini ekliyoruz
var float height = na
settings.devThreshold := ta.atr(10) / close * 100 * threshold_multiplier
if zigZag.update()
lastP := zigZag.lastPivot()
if not na(lastP)
var line lineLast = na
if na(lineLast)
lineLast := line.new(lastP.start, lastP.end, xloc=xloc.bar_time, color=color.gray, width=1, style=line.style_dashed)
else
line.set_first_point(lineLast, lastP.start)
line.set_second_point(lineLast, lastP.end)

startPrice := reverse ? lastP.start.price : lastP.end.price
endPrice := reverse ? lastP.end.price : lastP.start.price // End price'i burada atıyoruz
height := (startPrice > endPrice ? -1 : 1) * math.abs(startPrice - endPrice)
[lastP, startPrice, endPrice, height]

[lastP, startPrice, endPrice, height] = update()

_draw_line(price, col) =>
var id = line.new(lastP.start.time, lastP.start.price, time, price, xloc=xloc.bar_time, color=col, width=1, extend=extending)
line.set_xy1(id, lastP.start.time, price)
line.set_xy2(id, lastP.end.time, price)
id

_draw_label(price, txt, txtColor) =>
x = labelsPosition == "Left" ? lastP.start.time : not extendRight ? lastP.end.time : time
labelStyle = labelsPosition == "Left" ? label.style_label_right : label.style_label_left
align = labelsPosition == "Left" ? text.align_right : text.align_left
var id = label.new(x=x, y=price, xloc=xloc.bar_time, text=txt, textcolor=txtColor, style=labelStyle, textalign=align, color=#00000000, size=textSize)
label.set_xy(id, x, price)
label.set_text(id, txt)
label.set_textcolor(id, txtColor)

_label_txt(level, price) =>
(levels ? level : "") + (prices ? "\n(" + str.tostring(price, format.mintick) + ")" : "")

_crossing_level(series float sr, series float r) =>
(r > sr and r < sr[1]) or (r < sr and r > sr[1])

processLevel(bool show, float value, string label, color colorL, line lineIdOther) =>
r = startPrice + height * value
crossed = _crossing_level(close, r)
if show and not na(lastP)
lineId = _draw_line(r, colorL)
_draw_label(r, _label_txt(label, r), colorL)
if crossed
alert("Autofib: " + syminfo.ticker + " crossing level " + str.tostring(label))
if not na(lineIdOther)
linefill.new(lineId, lineIdOther, color = color.new(colorL, backgroundTransparency))
lineId
else
lineIdOther

// Define the text values and colors for each level
show_tepe = input(true, "Show Tepe", display = display.data_window)
color_tepe = input(color.new(color.gray, 50), "Tepe Color", display = display.data_window)

show_tepeye_yakin = input(true, "Show Tepeye Yakın", display = display.data_window)
color_tepeye_yakin = input(color.new(color.green, 50), "Tepeye Yakın Color", display = display.data_window)

show_hala_duzeltiyor = input(true, "Show Düzeltiyor", display = display.data_window)
color_hala_duzeltiyor = input(color.new(color.red, 50), "Düzeltiyor Color", display = display.data_window)

show_alim_yerleri = input(true, "Show Alım Yerleri", display = display.data_window)
color_alim_yerleri = input(color.new(color.blue, 50), "Alım Yerleri Color", display = display.data_window)

show_alabilirsin = input(true, "Show Alabilirsin", display = display.data_window)
color_alabilirsin = input(color.new(color.orange, 50), "Alabilirsin Color", display = display.data_window)

show_almaya_devam = input(true, "Show Almaya Devam", display = display.data_window)
color_almaya_devam = input(color.new(color.purple, 50), "Almaya Devam Color", display = display.data_window)

show_maliyet_dusur = input(true, "Show Maliyet Düşür", display = display.data_window)
color_maliyet_dusur = input(color.new(color.yellow, 50), "Maliyet Düşür Color", display = display.data_window)

show_maliyet_dusur_stop_ol = input(true, "Show Maliyet Düşür - Altında Stop OL", display = display.data_window)
color_maliyet_dusur_stop_ol = input(color.new(color.red, 50), "Maliyet Düşür - Altında Stop OL Color", display = display.data_window)

// Determine the text labels based on the direction
labelTepe = startPrice > endPrice ? "Tepe" : "Dip"
labelTepeyeYakin = startPrice > endPrice ? "Tepeye Yakın" : "Dibe Yakın"
labelHalaDuzeltiyor = startPrice > endPrice ? "Düzeltiyor" : "Düşüşü Düzeltiyor"
labelAlimYerleri = startPrice > endPrice ? "Alış Yerleri" : "Satış Yerleri"
labelAlabilirsin = startPrice > endPrice ? "Alabilirsin" : "Satabilirsin"
labelAlmayaDevam = startPrice > endPrice ? "Almaya Devam" : "Satmaya Devam"
labelMaliyetDusur = startPrice > endPrice ? "Maliyet Düşür" : "Stop Hazırlan"
labelMaliyetDusurStopOl = startPrice > endPrice ? "Maliyet Düşür-Altında Stop OL" : "Son Seviye Üstünde Stop OL"

// Process each text level
lineIdTepe = processLevel(show_tepe, 0.0, labelTepe, color_tepe, line(na))
lineIdTepeyeYakin = processLevel(show_tepeye_yakin, 0.236, labelTepeyeYakin, color_tepeye_yakin, lineIdTepe)
lineIdHalaDuzeltiyor = processLevel(show_hala_duzeltiyor, 0.382, labelHalaDuzeltiyor, color_hala_duzeltiyor, lineIdTepeyeYakin)
lineIdAlimYerleri = processLevel(show_alim_yerleri, 0.5, labelAlimYerleri, color_alim_yerleri, lineIdHalaDuzeltiyor)
lineIdAlabilirsin = processLevel(show_alabilirsin, 0.618, labelAlabilirsin, color_alabilirsin, lineIdAlimYerleri)
lineIdAlmayaDevam = processLevel(show_almaya_devam, 0.65, labelAlmayaDevam, color_almaya_devam, lineIdAlabilirsin)
lineIdMaliyetDusur = processLevel(show_maliyet_dusur, 0.786, labelMaliyetDusur, color_maliyet_dusur, lineIdAlmayaDevam)
lineIdMaliyetDusurStopOl = processLevel(show_maliyet_dusur_stop_ol, 1.0, labelMaliyetDusurStopOl, color_maliyet_dusur_stop_ol, lineIdMaliyetDusur)
Bands and ChannelsBill Williams IndicatorsBreadth Indicators

开源脚本

本着真正的TradingView精神,此脚本的作者已将其开源,以便交易者可以理解和验证它。向作者致敬!您可以免费使用它,但在出版物中重复使用此代码受网站规则约束。 您可以收藏它以在图表上使用。

想在图表上使用此脚本?

免责声明