xmd79

Bull Bear VOL

Nov 21st, 2021
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.63 KB | None | 0 0
  1. //@version=5
  2. indicator('Bull Bear VOL', overlay=false, timeframe='5')
  3.  
  4. TimeFrame = input.timeframe('D', title='Khoang Thoi Gian Kiem Dinh')
  5. Source = input(hlc3, title='Pivot')
  6. start = request.security('', TimeFrame, time)
  7. mavol = request.security('', TimeFrame, ta.sma(volume, 99))
  8.  
  9. //------------------------------------------------
  10. change_1 = ta.change(start)
  11. newSession = change_1 > 0 ? 1 : 0
  12.  
  13. value = high - low
  14. buy = Source - low
  15. sell = high - Source
  16.  
  17. buyer = volume * (buy / value)
  18. seller = volume * (sell / value)
  19.  
  20. cal(a, b) =>
  21. sum = 0.0
  22. if a == 1
  23. sum := b
  24. sum
  25. if a == 0
  26. sum := sum[1] + b
  27. sum
  28. sum
  29. bullis = cal(newSession, buyer)
  30. bearis = cal(newSession, seller)
  31. MR = bullis / bearis
  32. mfi = math.pow(10, math.log10(mavol)) / 2 - math.pow(10, math.log10(mavol)) / (1 + MR)
  33. winner = bullis - bearis
  34. plot(mfi, color=barstate.isconfirmed and mfi > 0 ? color.aqua : barstate.isconfirmed and mfi < 0 ? color.orange : color.gray, title='Buy Sell MFI ')
  35. plot(winner, color=barstate.isconfirmed and winner > 0 ? color.lime : barstate.isconfirmed and winner < 0 ? color.red : color.gray, title='Buy Sell Winner ')
  36. plot(0, color=color.new(color.gray, 0))
  37.  
  38. London = input.session('0300-1200', title='Khung gio Phien Au UTC')
  39. NY = input.session('0800-1700', title='Khung gio Phien My UTC')
  40.  
  41. bgcolor(time(timeframe.period, London) ? color.green : na, title='London Session', transp=90)
  42. bgcolor(time(timeframe.period, NY) ? color.red : na, title='New York Session', transp=90)
  43. bgcolor(newSession ? color.white : na, title='Begin Calculate Time', transp=90)
  44. //bgcolor(Asian, title="Asian")
  45.  
  46.  
Advertisement
Add Comment
Please, Sign In to add comment