xmd79

Future week Calendar; custom day sessions

Mar 7th, 2023
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 25.38 KB | None | 0 0
  1.  
  2. // © twingall
  3. //customize the week ahead with 4x individual daily sessions (each day with it's own sessions)
  4. //add optional text labels and optional time/date stamps, for key events of the week
  5.  
  6. //@version=5
  7. indicator(title="Future week Calendar; custom day sessions", overlay=true, max_boxes_count = 500, max_lines_count = 500)
  8. mult =input.int(0, "Boxes; weeks back to show(0 = upcoming week only)", minval =0, tooltip="with setting of 0 (only showing upcoming 7 days); the projected session boxes should disappear as price passes through their RHS")
  9.  
  10. //mult2 =input.int(0, "Labels; weeks back to show (0 = upcoming week only)", minval =0,tooltip="i.e. with setting boxes = 1 above and Labels = 0; 1 week of historical boxes show, but labels will auto-delete as price passes through RHS of a box")
  11. userTimezone = input.string("America/New_York", "input your timezone", options =["America/New_York", "UTC-10", "UTC-9", "UTC-8", "UTC-7", "UTC-6", "UTC-5", "UTC-4", "UTC-3",
  12. "UTC-2", "UTC-1","UTC", "UTC+1", "UTC+2", "UTC+3", "UTC+4","UTC+5","UTC+6","UTC+7","UTC+8","UTC+9","UTC+10","UTC+11","UTC+12","UTC+13"])
  13. colorNone = color.new(color.white, 100)
  14. ma = ta.sma(close, 500)
  15. ma2 = ta.sma(close, 50)
  16. week = 7*24*3600*1000
  17. oneBartime = timeframe.in_seconds(timeframe.period)*1000
  18. boxHeight = input.int(70, minval =20, maxval = 110, step =3, title ="Box Height", tooltip = "Arbitrary units, based on multiplier of ADR; 70 seems optimal for most timeframes")
  19. atrMult = ta.atr(1000)*boxHeight //ta.atr(200)
  20. showDay = input.bool(true, "Day Name", inline ='1', group = 'text formatting')
  21. showTime =input.bool(true, "Time", inline ='1', group = 'text formatting')
  22. showDate=input.bool(true, "Date", inline ='2', group = 'text formatting')
  23. usaFormat = input.bool(false, "(USA format: MM/dd)",inline ='2', group = 'text formatting')
  24. valignChoice = input.string(text.align_top,"Position:", options = [text.align_top, text.align_center, text.align_bottom], inline ='4', group = 'text formatting')
  25. txtSize = input.string(size.small,"Size:", options = [size.auto, size.tiny, size.small, size.normal, size.large, size.huge], inline ='4', group = 'text formatting')
  26. txtCol = input.color(color.black, "Color:", inline ='4', group = 'text formatting')
  27. delHistLabs = input.bool(true, "delete historical labels", inline ='5', group = 'text formatting', tooltip = "Labels will auto-delete as price passes through right hand side of box")
  28.  
  29. /// ~~FUNCTIONS~~
  30. close(sess)=>
  31. var float result =na
  32. if sess
  33. result:=close
  34. result
  35.  
  36. closeTime(sess)=>
  37. var int closeTime = na
  38. if sess[1] and not sess
  39. closeTime := time[1]
  40. int result = closeTime
  41.  
  42. openTime(sess)=>
  43. var int _openTime = na
  44. if sess and not sess[1]
  45. _openTime := time
  46. int result = _openTime
  47.  
  48. DoW(_time)=>
  49. string _DoW = dayofweek(_time, userTimezone) ==1?"Sun":dayofweek(_time, userTimezone) ==2?"Mon":dayofweek(_time, userTimezone) ==3?"Tues":dayofweek(_time, userTimezone) ==4?"Weds":
  50. dayofweek(_time, userTimezone) ==5?"Thurs":dayofweek(_time, userTimezone) ==6?"Fri":dayofweek(_time, userTimezone) ==7?"Sat":na
  51. _DoW
  52.  
  53. boxPaint(lab,t1,t2,_bxArr, col)=>
  54. string dayLab = showDay?DoW(t1+1*week)+"\n":na
  55. string dateLab = showDate and not usaFormat?str.format_time(t1+1*week, "dd/MM",userTimezone)+"\n":showDate and usaFormat?str.format_time(t1+1*week, "MM/dd",userTimezone)+"\n":na
  56. string timeLab =showTime?str.format_time(t1+1*week, "HH:mm",userTimezone)+"\n":na
  57. string txtLab = lab
  58. _bx = box (na)
  59. _bx:= box.new(t1+1*week, ma +atrMult, t2+1*week+oneBartime, ma -atrMult, text = dayLab+dateLab+timeLab+txtLab, text_valign=valignChoice,text_halign=text.align_left, text_size = txtSize, xloc = xloc.bar_time,
  60. text_color = txtCol, border_color = colorNone, bgcolor = col)
  61. array.push(_bxArr,_bx)
  62. if array.size(_bxArr)>mult+1
  63. box.delete(array.shift(_bxArr))
  64. if array.size(_bxArr)> (delHistLabs? 1: mult+1 ) //mult2+1
  65. box.set_text(array.shift(_bxArr), "")
  66. _bx
  67.  
  68. boxReposition(_bxArr1)=>
  69. box _bx1 = na
  70. if array.size(_bxArr1)>0
  71. _bx1 := array.last(_bxArr1)
  72. box.set_bottom(_bx1, ma2 -atrMult)
  73. box.set_top(_bx1, ma2 +atrMult)
  74.  
  75. inSess(_sess)=> not na(time(timeframe.period, str.tostring(_sess), userTimezone))
  76.  
  77. //box arrays declared:
  78. var array<box> boxArr1 = array.new<box>(0), var array<box> boxArr2= array.new<box>(0), var array<box> boxArr3 = array.new<box>(0), var array<box> boxArr4 = array.new<box>(0)
  79. var array<box> boxArr5 = array.new<box>(0), var array<box> boxArr6= array.new<box>(0), var array<box> boxArr7 = array.new<box>(0), var array<box> boxArr8 = array.new<box>(0)
  80. var array<box> boxArr9 = array.new<box>(0), var array<box> boxArr10= array.new<box>(0), var array<box> boxArr11 = array.new<box>(0), var array<box> boxArr12 = array.new<box>(0)
  81. var array<box> boxArr13 = array.new<box>(0), var array<box> boxArr14= array.new<box>(0), var array<box> boxArr15 = array.new<box>(0), var array<box> boxArr16 = array.new<box>(0)
  82. var array<box> boxArr17 = array.new<box>(0), var array<box> boxArr18= array.new<box>(0), var array<box> boxArr19 = array.new<box>(0), var array<box> boxArr20 = array.new<box>(0)
  83. var array<box> boxArr21 = array.new<box>(0), var array<box> boxArr22= array.new<box>(0), var array<box> boxArr23 = array.new<box>(0), var array<box> boxArr24 = array.new<box>(0)
  84. var array<box> boxArr25 = array.new<box>(0), var array<box> boxArr26= array.new<box>(0), var array<box> boxArr27 = array.new<box>(0), var array<box> boxArr28 = array.new<box>(0)
  85.  
  86. //MONDAY
  87. showSess1 =input.bool(true, "", group = "Monday", inline='1')
  88. inputSession1 = input.session('0100-0500', title='', group = "Monday", inline='1')
  89. col1 = input.color(color.new(color.green, 85), title ="", group = "Monday", inline='1')
  90. str1 =input.string("'Example Text'", "| text:", group = "Monday", inline='1')
  91. showSess2 =input.bool(true, "", group = "Monday", inline='2')
  92. inputSession2 = input.session('0700-1000', title='', group = "Monday", inline='2')
  93. col2 = input.color(color.new(color.red, 85), title ="", group = "Monday", inline='2')
  94. str2 =input.string("", "| text:", group = "Monday", inline='2')
  95. showSess3 =input.bool(true, "", group = "Monday", inline='3')
  96. inputSession3 = input.session('1100-1200', title='', group = "Monday", inline='3')
  97. col3 = input.color(color.new(color.orange, 85), title ="", group = "Monday", inline='3')
  98. str3 =input.string("", "| text:", group = "Monday", inline='3')
  99. showSess4 =input.bool(true, "", group = "Monday", inline='4')
  100. inputSession4 = input.session('1330-1600', title='', group = "Monday", inline='4')
  101. col4 = input.color(color.new(color.fuchsia, 85), title ="", group = "Monday", inline='4')
  102. str4 =input.string("", "| text:", group = "Monday", inline='4')
  103.  
  104. inSession1= inSess(inputSession1)
  105. inSession2 = inSess(inputSession2)
  106. inSession3 = inSess(inputSession3)
  107. inSession4 = inSess(inputSession4)
  108.  
  109. float htfClose1 =close(inSession1)
  110. int htfCloseTime1 = ta.valuewhen(close==htfClose1 and inSession1,time,0)
  111. int htfOpenTime1 = openTime(inSession1)
  112.  
  113. float htfClose2 =close(inSession2)
  114. int htfCloseTime2 = ta.valuewhen(close==htfClose2 and inSession2,time,0)
  115. int htfOpenTime2 = openTime(inSession2)
  116.  
  117. float htfClose3 =close(inSession3)
  118. int htfCloseTime3 = ta.valuewhen(close==htfClose3 and inSession3,time,0)
  119. int htfOpenTime3 = openTime(inSession3)
  120.  
  121. float htfClose4 =close(inSession4)
  122. int htfCloseTime4 = ta.valuewhen(close==htfClose4 and inSession4,time,0)
  123. int htfOpenTime4 = openTime(inSession4)
  124.  
  125. if not inSession1 and inSession1[1] and dayofweek(htfOpenTime1,userTimezone) ==2 and showSess1
  126. boxPaint(str1,htfOpenTime1,htfCloseTime1,boxArr1,col1)
  127. if not inSession2 and inSession2[1] and dayofweek(htfOpenTime2,userTimezone) ==2 and showSess2
  128. boxPaint(str2,htfOpenTime2,htfCloseTime2,boxArr2,col2)
  129. if not inSession3 and inSession3[1] and dayofweek(htfOpenTime3,userTimezone) ==2 and showSess3
  130. boxPaint(str3,htfOpenTime3,htfCloseTime3,boxArr3,col3)
  131. if not inSession4 and inSession4[1] and dayofweek(htfOpenTime4,userTimezone) ==2 and showSess4
  132. boxPaint(str4,htfOpenTime4,htfCloseTime4,boxArr4,col4)
  133. if dayofweek(time, userTimezone) ==2 and not (dayofweek(time, userTimezone) ==2)[1]
  134. boxReposition(boxArr1)
  135. boxReposition(boxArr2)
  136. boxReposition(boxArr3)
  137. boxReposition(boxArr4)
  138.  
  139.  
  140. //TUESDAY
  141. showSess5 =input.bool(true, "", group = "Tuesday", inline='1')
  142. inputSession5 = input.session('0500-0600', title='', group = "Tuesday", inline='1')
  143. col5 = input.color(color.new(color.green, 85), title ="", group = "Tuesday", inline='1')
  144. str5 =input.string("", "| text:", group = "Tuesday", inline='1')
  145. showSess6 =input.bool(true, "", group = "Tuesday", inline='2')
  146. inputSession6 = input.session('0700-1000', title='', group = "Tuesday", inline='2')
  147. col6 = input.color(color.new(color.red, 85), title ="", group = "Tuesday", inline='2')
  148. str6 =input.string("", "| text:", group = "Tuesday", inline='2')
  149. showSess7 =input.bool(true, "", group = "Tuesday", inline='3')
  150. inputSession7 = input.session('1200-1300', title='', group = "Tuesday", inline='3')
  151. col7 = input.color(color.new(color.orange, 85), title ="", group = "Tuesday", inline='3')
  152. str7 =input.string("", "| text:", group = "Tuesday", inline='3')
  153. showSess8 =input.bool(true, "", group = "Tuesday", inline='4')
  154. inputSession8 = input.session('1300-1600', title='', group = "Tuesday", inline='4')
  155. col8 = input.color(color.new(color.fuchsia, 85), title ="", group = "Tuesday", inline='4')
  156. str8 =input.string("", "| text:", group = "Tuesday", inline='4')
  157.  
  158. inSession5 = inSess(inputSession5)
  159. inSession6 = inSess(inputSession6)
  160. inSession7 = inSess(inputSession7)
  161. inSession8 = inSess(inputSession8)
  162.  
  163. float htfClose5 =close(inSession5)
  164. int htfCloseTime5 = ta.valuewhen(close==htfClose5 and inSession5,time,0)
  165. int htfOpenTime5 = openTime(inSession5)
  166.  
  167. float htfClose6 =close(inSession6)
  168. int htfCloseTime6 = ta.valuewhen(close==htfClose6 and inSession6,time,0)
  169. int htfOpenTime6 = openTime(inSession6)
  170.  
  171. float htfClose7 =close(inSession7)
  172. int htfCloseTime7 = ta.valuewhen(close==htfClose7 and inSession7,time,0)
  173. int htfOpenTime7 = openTime(inSession7)
  174.  
  175. float htfClose8 =close(inSession8)
  176. int htfCloseTime8 = ta.valuewhen(close==htfClose8 and inSession8,time,0)
  177. int htfOpenTime8 = openTime(inSession8)
  178.  
  179. if not inSession5 and inSession5[1] and dayofweek(htfOpenTime5,userTimezone ) ==3 and showSess5
  180. boxPaint(str5,htfOpenTime5,htfCloseTime5,boxArr5,col5)
  181. if not inSession6 and inSession6[1] and dayofweek(htfOpenTime6,userTimezone ) ==3 and showSess6
  182. boxPaint(str6,htfOpenTime6,htfCloseTime6,boxArr6,col6)
  183. if not inSession7 and inSession7[1] and dayofweek(htfOpenTime7,userTimezone ) ==3 and showSess7
  184. boxPaint(str7,htfOpenTime7,htfCloseTime7,boxArr7,col7)
  185. if not inSession8 and inSession8[1] and dayofweek(htfOpenTime8,userTimezone ) ==3 and showSess8
  186. boxPaint(str8,htfOpenTime8,htfCloseTime8,boxArr8,col8)
  187. if dayofweek(time, userTimezone) ==3 and not (dayofweek(time, userTimezone) ==3)[1]
  188. boxReposition(boxArr5)
  189. boxReposition(boxArr6)
  190. boxReposition(boxArr7)
  191. boxReposition(boxArr8)
  192.  
  193. //WEDNESDAY
  194. showSess9 =input.bool(true, "", group = "Wednesday", inline='1')
  195. inputSession9 = input.session('0500-0900', title='', group = "Wednesday", inline='1')
  196. col9 = input.color(color.new(color.blue, 85), title ="", group = "Wednesday", inline='1')
  197. str9 =input.string("", "| text:", group = "Wednesday", inline='1')
  198. showSess10 =input.bool(true, "", group = "Wednesday", inline='2')
  199. inputSession10 = input.session('1100-1300', title='', group = "Wednesday", inline='2')
  200. col10 = input.color(color.new(color.red, 85), title ="", group = "Wednesday", inline='2')
  201. str10 =input.string("", "| text:", group = "Wednesday", inline='2')
  202. showSess11 =input.bool(true, "", group = "Wednesday", inline='3')
  203. inputSession11 = input.session('1300-1400', title='', group = "Wednesday", inline='3')
  204. col11 = input.color(color.new(color.gray, 85), title ="", group = "Wednesday", inline='3')
  205. str11 =input.string("", "| text:", group = "Wednesday", inline='3')
  206. showSess12 =input.bool(true, "", group = "Wednesday", inline='4')
  207. inputSession12 = input.session('1730-1800', title='', group = "Wednesday", inline='4')
  208. col12 = input.color(color.new(color.fuchsia, 85), title ="", group = "Wednesday", inline='4')
  209. str12 =input.string("", "| text:", group = "Wednesday", inline='4')
  210.  
  211. inSession9 = inSess(inputSession9)
  212. inSession10 = inSess(inputSession10)
  213. inSession11 = inSess(inputSession11)
  214. inSession12 = inSess(inputSession12)
  215.  
  216. float htfClose9 =close(inSession9)
  217. int htfCloseTime9 = ta.valuewhen(close==htfClose9 and inSession9,time,0)
  218. int htfOpenTime9 = openTime(inSession9)
  219.  
  220. float htfClose10 =close(inSession10)
  221. int htfCloseTime10 = ta.valuewhen(close==htfClose10 and inSession10,time,0)
  222. int htfOpenTime10 = openTime(inSession10)
  223.  
  224. float htfClose11 =close(inSession11)
  225. int htfCloseTime11 = ta.valuewhen(close==htfClose11 and inSession11,time,0)
  226. int htfOpenTime11 = openTime(inSession11)
  227.  
  228. float htfClose12 =close(inSession12)
  229. int htfCloseTime12 = ta.valuewhen(close==htfClose12 and inSession12,time,0)
  230. int htfOpenTime12 = openTime(inSession12)
  231.  
  232.  
  233. if not inSession9 and inSession9[1] and dayofweek(htfOpenTime9,userTimezone ) ==4 and showSess9
  234. boxPaint(str9,htfOpenTime9,htfCloseTime9,boxArr9,col9)
  235. if not inSession10 and inSession10[1] and dayofweek(htfOpenTime10,userTimezone ) ==4 and showSess10
  236. boxPaint(str10,htfOpenTime10,htfCloseTime10,boxArr10,col10)
  237. if not inSession11 and inSession11[1] and dayofweek(htfOpenTime11,userTimezone ) ==4 and showSess11
  238. boxPaint(str11,htfOpenTime11,htfCloseTime11,boxArr11,col11)
  239. if not inSession12 and inSession12[1] and dayofweek(htfOpenTime12,userTimezone ) ==4 and showSess12
  240. boxPaint(str12,htfOpenTime12,htfCloseTime12,boxArr12,col12)
  241. if dayofweek(time, userTimezone) ==4 and not (dayofweek(time, userTimezone) ==4)[1]
  242. boxReposition(boxArr9)
  243. boxReposition(boxArr10)
  244. boxReposition(boxArr11)
  245. boxReposition(boxArr12)
  246.  
  247. //THURSDAY
  248. showSess13 =input.bool(true, "", group = "Thursday", inline='1')
  249. inputSession13 = input.session('0100-0900', title='', group = "Thursday", inline='1')
  250. col13 = input.color(color.new(color.orange, 85), title ="", group = "Thursday", inline='1')
  251. str13 =input.string("", "| text:", group = "Thursday", inline='1')
  252. showSess14 =input.bool(true, "", group = "Thursday", inline='2')
  253. inputSession14 = input.session('0900-1300', title='', group = "Thursday", inline='2')
  254. col14 = input.color(color.new(color.lime, 85), title ="", group = "Thursday", inline='2')
  255. str14 =input.string("", "| text:", group = "Thursday", inline='2')
  256. showSess15 =input.bool(true, "", group = "Thursday", inline='3')
  257. inputSession15 = input.session('1300-1400', title='', group = "Thursday", inline='3')
  258. col15 = input.color(color.new(color.fuchsia, 85), title ="", group = "Thursday", inline='3')
  259. str15 =input.string("", "| text:", group = "Thursday", inline='3')
  260. showSess16 =input.bool(true, "", group = "Thursday", inline='4')
  261. inputSession16 = input.session('1500-1800', title='', group = "Thursday", inline='4')
  262. col16 = input.color(color.new(color.red, 85), title ="", group = "Thursday", inline='4')
  263. str16 =input.string("", "| text:", group = "Thursday", inline='4')
  264. inSession13 = inSess(inputSession13)
  265. inSession14 = inSess(inputSession14)
  266. inSession15 = inSess(inputSession15)
  267. inSession16 = inSess(inputSession16)
  268.  
  269. float htfClose13=close(inSession13)
  270. int htfCloseTime13 = ta.valuewhen(close==htfClose13 and inSession13,time,0)
  271. int htfOpenTime13 = openTime(inSession13)
  272.  
  273. float htfClose14 =close(inSession14)
  274. int htfCloseTime14 = ta.valuewhen(close==htfClose14 and inSession14,time,0)
  275. int htfOpenTime14 = openTime(inSession14)
  276.  
  277. float htfClose15 =close(inSession15)
  278. int htfCloseTime15 = ta.valuewhen(close==htfClose15 and inSession15,time,0)
  279. int htfOpenTime15 = openTime(inSession15)
  280.  
  281. float htfClose16 =close(inSession16)
  282. int htfCloseTime16 = ta.valuewhen(close==htfClose16 and inSession16,time,0)
  283. int htfOpenTime16 = openTime(inSession16)
  284.  
  285.  
  286. if not inSession13 and inSession13[1] and dayofweek(htfOpenTime13,userTimezone ) ==5 and showSess13
  287. boxPaint(str13,htfOpenTime13,htfCloseTime13,boxArr13,col13)
  288. if not inSession14 and inSession14[1] and dayofweek(htfOpenTime14,userTimezone ) ==5 and showSess14
  289. boxPaint(str14,htfOpenTime14,htfCloseTime14,boxArr14,col14)
  290. if not inSession15 and inSession15[1] and dayofweek(htfOpenTime15,userTimezone ) ==5 and showSess15
  291. boxPaint(str15,htfOpenTime15,htfCloseTime15,boxArr15,col15)
  292. if not inSession16 and inSession16[1] and dayofweek(htfOpenTime16,userTimezone ) ==5 and showSess16
  293. boxPaint(str16,htfOpenTime16,htfCloseTime16,boxArr16,col16)
  294. if dayofweek(time, userTimezone) ==5 and not (dayofweek(time, userTimezone) ==5)[1]
  295. boxReposition(boxArr13)
  296. boxReposition(boxArr14)
  297. boxReposition(boxArr15)
  298. boxReposition(boxArr16)
  299.  
  300. //FRIDAY
  301. showSess17 =input.bool(true, "", group = "Friday", inline='1')
  302. inputSession17 = input.session('0600-0800', title='', group = "Friday", inline='1')
  303. col17 = input.color(color.new(color.gray, 85), title ="", group = "Friday", inline='1')
  304. str17 =input.string("", "| text:", group = "Friday", inline='1')
  305. showSess18 =input.bool(true, "", group = "Friday", inline='2')
  306. inputSession18 = input.session('0900-1400', title='', group = "Friday", inline='2')
  307. col18 = input.color(color.new(color.blue, 85), title ="", group = "Friday", inline='2')
  308. str18 =input.string("", "| text:", group = "Friday", inline='2')
  309. showSess19 =input.bool(true, "", group = "Friday", inline='3')
  310. inputSession19 = input.session('1400-1500', title='', group = "Friday", inline='3')
  311. col19 = input.color(color.new(color.maroon, 85), title ="", group = "Friday", inline='3')
  312. str19 =input.string("", "| text:", group = "Friday", inline='3')
  313. showSess20 =input.bool(true, "", group = "Friday", inline='4')
  314. inputSession20 = input.session('1500-1600', title='', group = "Friday", inline='4')
  315. col20 = input.color(color.new(color.red, 85), title ="", group = "Friday", inline='4')
  316. str20 =input.string("", "| text:", group = "Friday", inline='4')
  317.  
  318. inSession17 = inSess(inputSession17)
  319. inSession18 = inSess(inputSession18)
  320. inSession19 = inSess(inputSession19)
  321. inSession20 = inSess(inputSession20)
  322.  
  323. float htfClose17=close(inSession17)
  324. int htfCloseTime17 = ta.valuewhen(close==htfClose17 and inSession17,time,0)
  325. int htfOpenTime17 = openTime(inSession17)
  326.  
  327. float htfClose18 =close(inSession18)
  328. int htfCloseTime18 = ta.valuewhen(close==htfClose18 and inSession18,time,0)
  329. int htfOpenTime18 = openTime(inSession18)
  330.  
  331. float htfClose19 =close(inSession19)
  332. int htfCloseTime19 = ta.valuewhen(close==htfClose19 and inSession19,time,0)
  333. int htfOpenTime19 = openTime(inSession19)
  334.  
  335. float htfClose20 =close(inSession20)
  336. int htfCloseTime20 = ta.valuewhen(close==htfClose20 and inSession20,time,0)
  337. int htfOpenTime20 = openTime(inSession20)
  338.  
  339. if not inSession17 and inSession17[1] and dayofweek(htfOpenTime17,userTimezone ) ==6 and showSess17
  340. boxPaint(str17,htfOpenTime17,htfCloseTime17,boxArr17,col17)
  341. if not inSession18 and inSession18[1] and dayofweek(htfOpenTime18,userTimezone ) ==6 and showSess18
  342. boxPaint(str18,htfOpenTime18,htfCloseTime18,boxArr18,col18)
  343. if not inSession19 and inSession19[1] and dayofweek(htfOpenTime19,userTimezone ) ==6 and showSess19
  344. boxPaint(str19,htfOpenTime19,htfCloseTime19,boxArr19,col19)
  345. if not inSession20 and inSession20[1] and dayofweek(htfOpenTime20,userTimezone ) ==6 and showSess20
  346. boxPaint(str20,htfOpenTime20,htfCloseTime20,boxArr20,col20)
  347. if dayofweek(time, userTimezone) ==6 and not (dayofweek(time, userTimezone) ==6)[1]
  348. boxReposition(boxArr17)
  349. boxReposition(boxArr18)
  350. boxReposition(boxArr19)
  351. boxReposition(boxArr20)
  352.  
  353. //SATURDAY
  354. showSess21 =input.bool(true, "", group = "Saturday", inline='1')
  355. inputSession21 = input.session('0100-0900', title='', group = "Saturday", inline='1')
  356. col21 = input.color(color.new(color.red, 85), title ="", group = "Saturday", inline='1')
  357. str21 =input.string("", "| text:", group = "Saturday", inline='1')
  358. showSess22 =input.bool(true, "", group = "Saturday", inline='2')
  359. inputSession22 = input.session('1000-1400', title='', group = "Saturday", inline='2')
  360. col22 = input.color(color.new(color.green, 85), title ="", group = "Saturday", inline='2')
  361. str22 =input.string("", "| text:", group = "Saturday", inline='2')
  362. showSess23 =input.bool(true, "", group = "Saturday", inline='3')
  363. inputSession23 = input.session('1400-1500', title='', group = "Saturday", inline='3')
  364. col23 = input.color(color.new(color.blue, 85), title ="", group = "Saturday", inline='3')
  365. str23 =input.string("", "| text:", group = "Saturday", inline='3')
  366. showSess24 =input.bool(true, "", group = "Saturday", inline='4')
  367. inputSession24 = input.session('1500-1700', title='', group = "Saturday", inline='4')
  368. col24 = input.color(color.new(color.orange, 85), title ="", group = "Saturday", inline='4')
  369. str24 =input.string("", "| text:", group = "Saturday", inline='4')
  370. inSession21 = inSess(inputSession21)
  371. inSession22 = inSess(inputSession22)
  372. inSession23 = inSess(inputSession23)
  373. inSession24 = inSess(inputSession24)
  374.  
  375. float htfClose21=close(inSession21)
  376. int htfCloseTime21 = ta.valuewhen(close==htfClose21 and inSession21,time,0)
  377. int htfOpenTime21 = openTime(inSession21)
  378.  
  379. float htfClose22 =close(inSession22)
  380. int htfCloseTime22 = ta.valuewhen(close==htfClose22 and inSession22,time,0)
  381. int htfOpenTime22 = openTime(inSession22)
  382.  
  383. float htfClose23 =close(inSession23)
  384. int htfCloseTime23 = ta.valuewhen(close==htfClose23 and inSession23,time,0)
  385. int htfOpenTime23 = openTime(inSession23)
  386.  
  387. float htfClose24 =close(inSession24)
  388. int htfCloseTime24 = ta.valuewhen(close==htfClose24 and inSession24,time,0)
  389. int htfOpenTime24 = openTime(inSession24)
  390.  
  391. if not inSession21 and inSession21[1] and dayofweek(htfOpenTime21,userTimezone ) ==7 and showSess21
  392. boxPaint(str21,htfOpenTime21,htfCloseTime21,boxArr21,col21)
  393. if not inSession22 and inSession22[1] and dayofweek(htfOpenTime22,userTimezone ) ==7 and showSess22
  394. boxPaint(str22,htfOpenTime22,htfCloseTime22,boxArr22,col22)
  395. if not inSession23 and inSession23[1] and dayofweek(htfOpenTime23,userTimezone ) ==7 and showSess23
  396. boxPaint(str23,htfOpenTime23,htfCloseTime23,boxArr23,col23)
  397. if not inSession24 and inSession24[1] and dayofweek(htfOpenTime24,userTimezone ) ==7 and showSess24
  398. boxPaint(str24,htfOpenTime24,htfCloseTime24,boxArr24,col24)
  399. if dayofweek(time, userTimezone) ==7 and not (dayofweek(time, userTimezone) ==7)[1]
  400. boxReposition(boxArr21)
  401. boxReposition(boxArr22)
  402. boxReposition(boxArr23)
  403. boxReposition(boxArr24)
  404.  
  405. //SUNDAY
  406. showSess25 =input.bool(true, "", group = "Sunday", inline='1')
  407. inputSession25 = input.session('0700-1100', title='', group = "Sunday", inline='1')
  408. col25 = input.color(color.new(color.olive, 85), title ="", group = "Sunday", inline='1')
  409. str25 =input.string("", "| text:", group = "Sunday", inline='1')
  410. showSess26 =input.bool(true, "", group = "Sunday", inline='2')
  411. inputSession26 = input.session('1200-1400', title='', group = "Sunday", inline='2')
  412. col26 = input.color(color.new(color.fuchsia, 85), title ="", group = "Sunday", inline='2')
  413. str26 =input.string("", "| text:", group = "Sunday", inline='2')
  414. showSess27 =input.bool(true, "", group = "Sunday", inline='3')
  415. inputSession27 = input.session('1400-1500', title='', group = "Sunday", inline='3')
  416. col27 = input.color(color.new(color.red, 85), title ="", group = "Sunday", inline='3')
  417. str27 =input.string("", "| text:", group = "Sunday", inline='3')
  418. showSess28 =input.bool(true, "", group = "Sunday", inline='4')
  419. inputSession28 = input.session('1700-1900', title='', group = "Sunday", inline='4')
  420. col28 = input.color(color.new(color.green, 85), title ="", group = "Sunday", inline='4')
  421. str28 =input.string("", "| text:", group = "Sunday", inline='4')
  422. inSession25 = inSess(inputSession25)
  423. inSession26 = inSess(inputSession26)
  424. inSession27 = inSess(inputSession27)
  425. inSession28 = inSess(inputSession28)
  426.  
  427. float htfClose25=close(inSession25)
  428. int htfCloseTime25 = ta.valuewhen(close==htfClose25 and inSession25,time,0)
  429. int htfOpenTime25 = openTime(inSession25)
  430.  
  431. float htfClose26 =close(inSession26)
  432. int htfCloseTime26 = ta.valuewhen(close==htfClose26 and inSession26,time,0)
  433. int htfOpenTime26 = openTime(inSession26)
  434.  
  435. float htfClose27 =close(inSession27)
  436. int htfCloseTime27 = ta.valuewhen(close==htfClose27 and inSession27,time,0)
  437. int htfOpenTime27 = openTime(inSession27)
  438.  
  439. float htfClose28 =close(inSession28)
  440. int htfCloseTime28 = ta.valuewhen(close==htfClose28 and inSession28,time,0)
  441. int htfOpenTime28 = openTime(inSession28)
  442.  
  443.  
  444. if not inSession25 and inSession25[1] and dayofweek(htfOpenTime25,userTimezone ) ==1 and showSess25
  445. boxPaint(str25,htfOpenTime25,htfCloseTime25,boxArr25,col25)
  446. if not inSession26 and inSession26[1] and dayofweek(htfOpenTime26,userTimezone ) ==1 and showSess26
  447. boxPaint(str26,htfOpenTime26,htfCloseTime26,boxArr26,col26)
  448. if not inSession27 and inSession27[1] and dayofweek(htfOpenTime27,userTimezone ) ==1 and showSess27
  449. boxPaint(str27,htfOpenTime27,htfCloseTime27,boxArr27,col27)
  450. if not inSession28 and inSession28[1] and dayofweek(htfOpenTime28,userTimezone ) ==1 and showSess28
  451. boxPaint(str28,htfOpenTime28,htfCloseTime28,boxArr28,col28)
  452. if dayofweek(time, userTimezone) ==1 and not (dayofweek(time, userTimezone) ==1)[1]
  453. boxReposition(boxArr25)
  454. boxReposition(boxArr26)
  455. boxReposition(boxArr27)
  456. boxReposition(boxArr28)
Advertisement
Add Comment
Please, Sign In to add comment