xmd79

BANKNIFTY Public v1.0

Oct 1st, 2021
1,053
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.93 KB | None | 0 0
  1. //@version=4
  2. //Author : @ILuvMarkets
  3. study("BANKNIFTY Public v1.0", overlay=true)
  4.  
  5. _res = input(title="Resolution", type=input.resolution, defval="D")
  6.  
  7. LIGHTTRANSP = 90
  8. AVGTRANSP = 80
  9. HEAVYTRANSP = 70
  10.  
  11. i_posColor = input(color.rgb(38, 166, 154), title="Positive Color")
  12. i_negColor = input(color.rgb(240, 83, 80), title="Negative Color")
  13.  
  14. var table _table = table.new(position.top_right, 10, 20, border_width = 1)
  15.  
  16. if barstate.isfirst
  17. _r = 0, _c = 0
  18. table.cell(_table,_c, _r, "Symbol", bgcolor = color.black, text_color = color.white, text_halign = text.align_center, text_size = size.small ), _c := _c+1
  19. table.cell(_table,_c, _r, "Vol T", bgcolor = color.black, text_color = color.white, text_halign = text.align_center, text_size = size.small ), _c := _c+1
  20. table.cell(_table,_c, _r, "Close", bgcolor = color.black, text_color = color.white, text_halign = text.align_center, text_size = size.small ), _c := _c+1
  21. table.cell(_table,_c, _r, "Chg %", bgcolor = color.black, text_color = color.white, text_halign = text.align_center, text_size = size.small ), _c := _c+1
  22. table.cell(_table,_c, _r, "Pts", bgcolor = color.black, text_color = color.white, text_halign = text.align_center, text_size = size.small ), _c := _c+1
  23.  
  24. f_fillRow(_row_orig, _symbol) =>
  25. _c = 0
  26. _row = _row_orig + 0 // to accomodate for the INDEX data
  27. [_pts, _chg_pct, _close,_vol] = security("NSE:" + _symbol, _res, [close - close[1], (close - close[1])/close[1], close, volume])
  28. _c_color = _pts > 0 ? i_posColor : i_negColor
  29. _transp = abs(_chg_pct) > .01 ? HEAVYTRANSP : abs(_chg_pct) > 0.005? AVGTRANSP : LIGHTTRANSP
  30. table.cell(_table, _c, _row, _symbol, bgcolor = color.new(_c_color, _transp), text_color = _c_color, text_halign = text.align_left, text_size = size.small), _c := _c+1
  31. table.cell(_table, _c, _row, tostring(_vol/pow(10,3), '#,###'), bgcolor = color.new(_c_color, _transp), text_color = _c_color, text_halign = text.align_right, text_size = size.small), _c := _c+1
  32. table.cell(_table, _c, _row, tostring(_close, '#,###.##'), bgcolor = color.new(_c_color, _transp), text_color = _c_color, text_halign = text.align_right, text_size = size.small), _c := _c+1
  33. table.cell(_table, _c, _row, tostring(_chg_pct, '#,###.##%'), bgcolor = color.new(_c_color, _transp), text_color = _c_color, text_halign = text.align_right, text_size = size.small), _c := _c+1
  34. table.cell(_table, _c, _row, tostring(_pts, '#,###.#'), bgcolor = color.new(_c_color, _transp), text_color = _c_color, text_halign = text.align_right, text_size = size.small), _c := _c+1
  35.  
  36. if barstate.islast
  37. f_fillRow(1, "HDFCBANK")
  38. f_fillRow(2, "ICICIBANK")
  39. f_fillRow(3, "KOTAKBANK")
  40. f_fillRow(4, "AXISBANK")
  41. f_fillRow(5, "SBIN")
  42. f_fillRow(6, "INDUSINDBK")
  43. f_fillRow(7, "AUBANK")
  44. f_fillRow(8, "BANDHANBNK")
  45. f_fillRow(9, "FEDERALBNK")
  46. f_fillRow(10, "IDFCFIRSTB")
  47. f_fillRow(11, "PNB")
  48. f_fillRow(12, "RBLBANK")
  49.  
Advertisement
Add Comment
Please, Sign In to add comment