speed pump
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © ilyassamialp
// amaç= hacim ve fiyat hareketliliklerini tespit ederek al sinyali oluşturmak. açıklam; hacim ve fiyatta geçmiş mum ortalamalarını tespit ederek aktif mumda hedef yüzdeye ulaşınca sinyal vermeli
//@version=5
indicator(title="speed pump",overlay=true)

// girdiler
hacimcarpani= input.int(2,minval=1,step=1,title="hacim x")
fiyatyuzdesi= input.float(1.05,minval=1.001,step=0.001,title="fiyat %")
ortalamafiyatsapmasi= input.float(1.02,minval=1.001,step=0.001,title="ort fiyat sapması %")
rsi7= input.int(30,minval=30,step=1,title="rsi 7")
rsi14= input.int(30,minval=30,step=1,title="rsi 14")
cmf20= input.float(0.01,minval=0.01,step=0.01,title="cmf 20")

// değerler
oh= math.avg(volume[1],volume[2],volume[3],volume[4],volume[5],volume[6],volume[7],volume[8],volume[9],volume[10])//,volume[11],volume[12],volume[13],volume[14],volume[15],volume[16],volume[17],volume[18],volume[19],volume[20],volume[21],volume[22])
of= math.avg(close[1],close[2],close[3],close[4],close[5],close[6],close[7],close[8],close[9],close[10])//,close[11],close[12],close[13],close[14],close[15],close[16],close[17],close[18],close[19],close[20],close[21],close[22],close[23],close[24],close[25],close[26])

// sonuçlar
hacimx = oh * hacimcarpani
fiyatx = of * fiyatyuzdesi
ofs= of * ortalamafiyatsapmasi
//////////////////////////////////////
//Chaikin Money Flow (CMF) indikatörü
var cumVol = 0.
cumVol += nz(volume)
if barstate.islast and cumVol == 0
    runtime.error("No volume is provided by the data vendor.")
ad = close==high and close==low or high==low ? 0 : ((2*close-low-high)/(high-low))*volume
mf = math.sum(ad,20) / math.sum(volume,20)
/////////////////////////////////////
// koşul
ivmeleme = volume >= hacimx and close >= fiyatx and ta.rsi(close,7) >= rsi7 and ta.rsi(close,14) >= rsi14 and mf >= cmf20 and open <= ofs

// gösterge
plotshape(ivmeleme,title="BUY - AL",text="ivme",textcolor=color.white,style=shape.labelup,size=size.normal,location=location.belowbar,color=color.green)

// alarm
alertcondition(ivmeleme, title='BUY - AL', message='')

//plot(oh,color=color.purple)
plot(of,color=color.silver)
