Untitled

 avatar
unknown
plain_text
a month ago
2.7 kB
7
Indexable
//@version=5
strategy("[blackcat] L3 Banker Fund Flow Strategy", overlay=false)

// Kullanıcı ayarları için parametreler
fundtrend_length = input.int(27, title="Fund Trend Length", minval=1)
bullbear_ema_length = input.int(13, title="Bull/Bear EMA Length", minval=1)
scale_min = input.float(0, title="Scaling Min Value", minval=-100, maxval=100)
scale_max = input.float(100, title="Scaling Max Value", minval=0, maxval=200)
ema120 = input.int(120, title="Bull/Bear EMA Length", minval=1)

// Entry/Exit seviyeleri
entry_level = input.int(41, title="Entry Level (Bullbear <)", minval=0, maxval=100)
exit_level = input.int(75, title="Exit Level (Bullbear >)", minval=0, maxval=100)

// Banker fund trend hesaplama
xsa(src, len, wei) =>
    sumf = 0.0
    ma = 0.0
    out = 0.0
    sumf := nz(sumf[1]) - nz(src[len]) + src
    ma := na(src[len]) ? na : sumf / len
    out := na(out[1]) ? ma : (src * wei + out[1] * (len - wei)) / len
    out

fundtrend = (3 * xsa((close - ta.lowest(low, fundtrend_length)) / (ta.highest(high, fundtrend_length) - ta.lowest(low, fundtrend_length)) * 100, 5, 1) -     2 * xsa(xsa((close - ta.lowest(low, fundtrend_length)) / (ta.highest(high, fundtrend_length) - ta.lowest(low, fundtrend_length)) * 100, 5, 1), 3, 1) - 50) * 1.032 + 50

typ = (2 * close + high + low + open) / 5
lol = ta.lowest(low, fundtrend_length)
hoh = ta.highest(high, fundtrend_length)
bullbearline = ta.ema((typ - lol) / (hoh - lol) * 100, bullbear_ema_length)

// Entry ve exit koşulları - kesişim ve seviye şartlarıyla
bankerentry = ta.crossover(fundtrend, bullbearline) and bullbearline < entry_level
bankerexit = ta.crossunder(fundtrend, bullbearline) and bullbearline > exit_level

emafilter = bullbear_ema_length > ema120

long = ta.crossover(fundtrend, bullbearline) and emafilter
short = ta.crossunder(fundtrend, bullbearline)

// Strategy giriş ve çıkış
if (long)
    strategy.entry("Long", strategy.long)

if (short)
    strategy.close("Long")

// Ana çizgilerin çizimi
plot(fundtrend, color=color.orange, title="Fund Trend", linewidth=2)
plot(bullbearline, color=color.purple, title="Bull/Bear Line", linewidth=2)

// Seviye çizgileri
hline(entry_level, "Entry Level", color=color.new(color.green, 50), linestyle=hline.style_dashed)
hline(exit_level, "Exit Level", color=color.new(color.red, 50), linestyle=hline.style_dashed)

// Giriş/çıkış sinyallerini işaretleme
plotshape(series=long, style=shape.labelup, location=location.belowbar, color=color.new(color.green, 0), text="Buy")
plotshape(series=short, style=shape.labeldown, location=location.abovebar, color=color.new(color.red, 0), text="Sell")
Leave a Comment