Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //@version=5
- indicator('Bull Bear VOL', overlay=false, timeframe='5')
- TimeFrame = input.timeframe('D', title='Khoang Thoi Gian Kiem Dinh')
- Source = input(hlc3, title='Pivot')
- start = request.security('', TimeFrame, time)
- mavol = request.security('', TimeFrame, ta.sma(volume, 99))
- //------------------------------------------------
- change_1 = ta.change(start)
- newSession = change_1 > 0 ? 1 : 0
- value = high - low
- buy = Source - low
- sell = high - Source
- buyer = volume * (buy / value)
- seller = volume * (sell / value)
- cal(a, b) =>
- sum = 0.0
- if a == 1
- sum := b
- sum
- if a == 0
- sum := sum[1] + b
- sum
- sum
- bullis = cal(newSession, buyer)
- bearis = cal(newSession, seller)
- MR = bullis / bearis
- mfi = math.pow(10, math.log10(mavol)) / 2 - math.pow(10, math.log10(mavol)) / (1 + MR)
- winner = bullis - bearis
- plot(mfi, color=barstate.isconfirmed and mfi > 0 ? color.aqua : barstate.isconfirmed and mfi < 0 ? color.orange : color.gray, title='Buy Sell MFI ')
- plot(winner, color=barstate.isconfirmed and winner > 0 ? color.lime : barstate.isconfirmed and winner < 0 ? color.red : color.gray, title='Buy Sell Winner ')
- plot(0, color=color.new(color.gray, 0))
- London = input.session('0300-1200', title='Khung gio Phien Au UTC')
- NY = input.session('0800-1700', title='Khung gio Phien My UTC')
- bgcolor(time(timeframe.period, London) ? color.green : na, title='London Session', transp=90)
- bgcolor(time(timeframe.period, NY) ? color.red : na, title='New York Session', transp=90)
- bgcolor(newSession ? color.white : na, title='Begin Calculate Time', transp=90)
- //bgcolor(Asian, title="Asian")
Advertisement
Add Comment
Please, Sign In to add comment