Advertisement
Guest User

Untitled

a guest
May 23rd, 2019
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.98 KB | None | 0 0
  1. //@version=3
  2. study(title="CD ~ Bitmex Funding Influence Periods", shorttitle="CD ~ Mex Time", overlay=true)
  3.  
  4. //checkboxes
  5. iMove1 = input(title="Build up period 1", type=bool, defval=true)
  6. iBuy1 = input(title="Buy window 1", type=bool, defval=true)
  7. iSell1 = input(title="Take profit period 1", type=bool, defval=true)
  8. iMove2 = input(title="Build up period 2", type=bool, defval=true)
  9. iBuy2 = input(title="Buy window 2", type=bool, defval=true)
  10. iSell2 = input(title="Take profit period 2", type=bool, defval=true)
  11. iMove3 = input(title="Build up period 3", type=bool, defval=true)
  12. iBuy3 = input(title="Buy window 3", type=bool, defval=true)
  13. iSell3 = input(title="Take profit period 3", type=bool, defval=true)
  14. iUse1 = input(title="Extra 1", type=bool, defval=false)
  15. iUse2 = input(title="Extra 2", type=bool, defval=false)
  16. iUse3 = input(title="Extra 3", type=bool, defval=false)
  17.  
  18. //Session choice
  19. Sess1 = input(title="Build up period 1", type=string, defval="0244-0400:1234567")
  20.  
  21. Sess2 = input(title="Buy window 1", type=string, defval="0400-0401:1234567")
  22.  
  23. Sess3 = input(title="Take Profit period 1", type=string, defval="0401-0414:1234567")
  24.  
  25. Sess4 = input(title="Build up period 2", type=string, defval="1044-1200:1234567")
  26.  
  27. Sess5 = input(title="Buy window 2", type=string, defval="1200-1201:1234567")
  28.  
  29. Sess6 = input(title="Take Profit period 2", type=string, defval="1201-1214:1234567")
  30.  
  31. Sess7 = input(title="Build up period 3", type=string, defval="1844-2000:1234567")
  32.  
  33. Sess8 = input(title="Buy window 3", type=string, defval="2000-2001:1234567")
  34.  
  35. Sess9 = input(title="Take Profit period 3", type=string, defval="2001-2014:1234567")
  36.  
  37. Sess10 = input(title="Extra 1", type=string, defval="0000-0001:1234567")
  38.  
  39. Sess11 = input(title="Extra 2", type=string, defval="0000-0001:1234567")
  40.  
  41. Sess12 = input(title="Extra 3", type=string, defval="0000-0001:1234567")
  42.  
  43. // **** Logic
  44. sessToUse1 =iMove1 == 1 ? Sess1 : '0800-1530:2'
  45. sessToUse2 = iBuy1 == 1 ? Sess2 : '0800-1530:3'
  46. sessToUse3 = iSell1 == 1 ? Sess3 : '0800-1530:4'
  47. sessToUse4 = iMove2 == 1 ? Sess4 : '0800-1530:5'
  48. sessToUse5 = iBuy2 == 1 ? Sess5 : '0800-1530:6'
  49. sessToUse6 = iSell2 == 1 ? Sess6 : '0800-1530:7'
  50. sessToUse7 = iMove3 == 1 ? Sess7 : '0800-1530:1'
  51. sessToUse8 = iBuy3 == 1 ? Sess8 : '0800-1530:3'
  52. sessToUse9 = iSell3 == 1 ? Sess9 : '0800-1530:4'
  53. sessToUse10 = iUse1 == 1 ? Sess10 : '0800-1530:5'
  54. sessToUse11 = iUse2 == 1 ? Sess11 : '0800-1530:6'
  55. sessToUse12 = iUse3 == 1 ? Sess12 : '0800-1530:7'
  56.  
  57.  
  58.  
  59. // *** Apply custom rules
  60. bgPlot1 = (iMove1 == 0 ? time(period) : time(period, sessToUse1))
  61. bgPlot2 = (iBuy1 == 0 ? time(period) : time(period, sessToUse2))
  62. bgPlot3 = (iSell1 == 0 ? time(period) : time(period, sessToUse3))
  63. bgPlot4 = (iMove2 == 0 ? time(period) : time(period, sessToUse4))
  64. bgPlot5 = (iBuy2 == 0 ? time(period) : time(period, sessToUse5))
  65. bgPlot6 = (iSell2 == 0 ? time(period) : time(period, sessToUse6))
  66. bgPlot7 = (iMove3 == 0 ? time(period) : time(period, sessToUse7))
  67. bgPlot8 = (iBuy3 == 0 ? time(period) : time(period, sessToUse8))
  68. bgPlot9 = (iSell3 == 0 ? time(period) : time(period, sessToUse9))
  69. bgPlot10 = (iUse1 == 0 ? time(period) : time(period, sessToUse10))
  70. bgPlot11 = (iUse2 == 0 ? time(period) : time(period, sessToUse11))
  71. bgPlot12 = (iUse3 == 0 ? time(period) : time(period, sessToUse12))
  72.  
  73. // Set the background colour
  74. bgcolor(iMove1 and bgPlot1 > 0 ? #0F1626 : na, transp=80)
  75. bgcolor(iBuy1 and bgPlot2 > 0 ? #33FFAF : na, transp=40)
  76. bgcolor(iSell1 and bgPlot3 > 0 ? #FF533D : na, transp=90)
  77. bgcolor(iMove2 and bgPlot4 > 0 ? #0F1626 : na, transp=80)
  78. bgcolor(iBuy2 and bgPlot5 > 0 ? #33FFAF : na, transp=40)
  79. bgcolor(iSell2 and bgPlot6 > 0 ? #FF533D : na, transp=90)
  80. bgcolor(iMove3 and bgPlot7 > 0 ? #0F1626 : na, transp=80)
  81. bgcolor(iBuy3 and bgPlot8 > 0 ? #33FFAF : na, transp=40)
  82. bgcolor(iSell3 and bgPlot9 > 0 ? #FF533D : na, transp=90)
  83. bgcolor(iUse1 and bgPlot10 > 0 ? gray : na, transp=0)
  84. bgcolor(iUse2 and bgPlot11 > 0 ? gray : na, transp=0)
  85. bgcolor(iUse3 and bgPlot12 > 0 ? gray : na, transp=0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement