improved volume
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © KriptoTraderYusuf
//@version=5

indicator('improved Volume', shorttitle='Vol', overlay=false, format = format.volume)
ma = input(defval = true, title = "Length", inline = "ma")
len = input(defval = 21, title = "", inline = "ma")
src = input.string(defval = "SMA", title = "Average", options = ["SMA", "EMA"], inline = "ma")
type = ma ? (src == "SMA" ? math.round(ta.sma(volume, len)) : math.round(ta.ema(volume, len))) : na
clr = close > open ? color.green : color.red
plot(math.round(volume), title='Volume', style=plot.style_columns, color = clr)
plot(type, title= "Average", color=color.new(color.yellow, 50), style=plot.style_area)


plot(type * 2 , title= "2x Ortalama", color=color.new(color.yellow, 0), style=plot.style_line, show_last = 1)
plot(type * 3 , title= "3x Ortalama", color=color.new(color.yellow, 0), style=plot.style_line, show_last = 1)
plot(type * 4 , title= "4x Ortalama", color=color.new(color.yellow, 0), style=plot.style_line, show_last = 1)

kesx1 = ta.cross(volume, (type *1))
kesx2 = ta.cross(volume, (type *2))
kesx3 = ta.cross(volume, (type *3))
kesx4 = ta.cross(volume, (type *4))

alertcondition(kesx1, title='1x Hacim Sinyali', message='Hacim 1X Seviyesinde!')
alertcondition(kesx2, title='2x Hacim Sinyali', message='Hacim 2X Seviyesinde!')
alertcondition(kesx3, title='3x Hacim Sinyali', message='Hacim 3X Seviyesinde!')
alertcondition(kesx4, title='4x Hacim Sinyali', message='Hacim 4X Seviyesinde!')
