xmd79

SuTrading Gann Levels By Naresh from nareshksuruvu" & "Gann Square of 9 By pequet

Feb 12th, 2023
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 25.52 KB | None | 0 0
  1. // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
  2. // © Arun_K_Bhaskar
  3.  
  4. //Formula based on "SuTrading Gann Levels By Naresh from nareshksuruvu" & "Gann Square of 9 By pequet"
  5. //https://www.tradingview.com/script/Gn6BexU7-SuTrading-Gann-Levels-By-Naresh/
  6. //https://www.tradingview.com/script/i10gxonX-Gann-Square-of-9/
  7.  
  8.  
  9. //@version=5
  10.  
  11.  
  12. indicator(title='GANN Square Of 9 Pivots', shorttitle='GANN 9 Pivots', overlay=true)
  13.  
  14. show_gann = input.string('Basic', title='Gann Levels', options=['Basic', 'Extended'])
  15. timeframe = input.string(defval='D', title='Timeframe', options=['1', '3', '5', '15', '30', '45', '60', '120', '180', '240', 'D', '5D', 'W', '2W', '3W', 'M', '3M', '6M', '12M'])
  16. source = input.string('VWAP Day Open', title='Source', options=['Custom', 'LTP', 'Day Open', 'PD Close', 'PD HL2', 'PD HLC3', 'VWAP', 'VWAP Day Open', 'VWAP PD Close', 'TWAP', 'TWAP Day Open', 'TWAP PD Close'])
  17. custom = input.float(defval=0, title='Enter Price (If Source is Custom)', minval=0)
  18.  
  19.  
  20. ////////////////////////////////////////////////////// OHLC
  21.  
  22. day_open = request.security(syminfo.tickerid, timeframe, open, lookahead=barmerge.lookahead_on)
  23. pd_high = request.security(syminfo.tickerid, timeframe, high[1], lookahead=barmerge.lookahead_on)
  24. pd_low = request.security(syminfo.tickerid, timeframe, low[1], lookahead=barmerge.lookahead_on)
  25. pd_close = request.security(syminfo.tickerid, timeframe, close[1], lookahead=barmerge.lookahead_on)
  26.  
  27.  
  28. ////////////////////////////////////////////////////// VWAP
  29.  
  30. t = time(timeframe)
  31. debut = na(t[1]) or t > t[1]
  32.  
  33. addsource = hl2 * volume
  34. addvol = volume
  35. addsource := debut ? addsource : addsource + addsource[1]
  36. addvol := debut ? addvol : addvol + addvol[1]
  37. vwap_level = addsource / addvol
  38.  
  39. //Previous Day VWAP Close
  40. pd_vwap_close = 0.0
  41. pd_vwap_close := debut ? vwap_level[1] : pd_vwap_close[1]
  42.  
  43. //Day VWAP Open
  44. d_vwap_open = 0.0
  45. d_vwap_open := debut ? vwap_level[0] : d_vwap_open[1]
  46.  
  47.  
  48. ////////////////////////////////////////////////////// TWAP
  49.  
  50. addsource_twap = hl2 * time
  51. addtime_twap = time
  52. addsource_twap := debut ? addsource_twap : addsource_twap + addsource_twap[1]
  53. addtime_twap := debut ? addtime_twap : addtime_twap + addtime_twap[1]
  54. twap_level = addsource_twap / addtime_twap
  55.  
  56. //Previous Day TWAP Close
  57. pd_twap_close = 0.0
  58. pd_twap_close := debut ? twap_level[1] : pd_twap_close[1]
  59.  
  60. //Day TWAP Open
  61. d_twap_open = 0.0
  62. d_twap_open := debut ? twap_level[0] : d_twap_open[1]
  63.  
  64.  
  65. price_input = source == 'LTP' ? close : source == 'Day Open' ? day_open : source == 'PD Close' ? pd_close : source == 'PD HL2' ? math.avg(pd_high, pd_low) : source == 'PD HLC3' ? math.avg(pd_high, pd_low, pd_close) : source == 'VWAP' ? vwap_level : source == 'VWAP Day Open' ? d_vwap_open : source == 'VWAP PD Close' ? pd_vwap_close : source == 'TWAP' ? twap_level : source == 'TWAP Day Open' ? d_twap_open : source == 'TWAP PD Close' ? pd_twap_close : na
  66.  
  67. price_option = source == 'Custom' ? custom : price_input
  68.  
  69. gpL = 'Basic Levels'
  70.  
  71. r_color = input.color(color.rgb(38, 166, 154), title='', group=gpL, inline='01')
  72. show_r1 = input.bool(defval=true, title='R1', group=gpL, inline='01')
  73. show_r2 = input.bool(defval=true, title='R2', group=gpL, inline='01')
  74. show_r3 = input.bool(defval=false, title='R3', group=gpL, inline='01')
  75.  
  76. s_color = input.color(color.rgb(240, 83, 80), title='', group=gpL, inline='02')
  77. show_s1 = input.bool(defval=true, title='S1', group=gpL, inline='02')
  78. show_s2 = input.bool(defval=true, title='S2', group=gpL, inline='02')
  79. show_s3 = input.bool(defval=false, title='S3', group=gpL, inline='02')
  80.  
  81. _extend = input.string(defval='Left', title='Extend', options=['None', 'Left', 'Right', 'Both'], group=gpL, inline='04')
  82. _ln_extend = _extend == 'None' ? extend.none : _extend == 'Left' ? extend.left : _extend == 'Right' ? extend.right : _extend == 'Both' ? extend.both : na
  83.  
  84.  
  85. ////////////////////////////////////////////////////// GANN Square Of 9 Calculation (Basic Levels)
  86.  
  87. sq_root = math.sqrt(price_option)
  88. round_number = math.floor(sq_root)
  89. //intarr = [round_number-1,round_number,round_number+1,round_number+2]
  90. //inc_value = 0.125
  91.  
  92. long_above = 0.00
  93. short_below = 0.00
  94. r_1 = 0.00
  95. r_2 = 0.00
  96. r_3 = 0.00
  97. s_1 = 0.00
  98. s_2 = 0.00
  99. s_3 = 0.00
  100.  
  101. gannsq_33 = (round_number - 1) * (round_number - 1)
  102.  
  103. gannsq_32 = (round_number - 1 + 0.125 * 1) * (round_number - 1 + 0.125 * 1)
  104. gannsq_22 = (round_number - 1 + 0.125 * 2) * (round_number - 1 + 0.125 * 2)
  105. gannsq_23 = (round_number - 1 + 0.125 * 3) * (round_number - 1 + 0.125 * 3)
  106. gannsq_24 = (round_number - 1 + 0.125 * 4) * (round_number - 1 + 0.125 * 4)
  107. gannsq_34 = (round_number - 1 + 0.125 * 5) * (round_number - 1 + 0.125 * 5)
  108. gannsq_44 = (round_number - 1 + 0.125 * 6) * (round_number - 1 + 0.125 * 6)
  109. gannsq_43 = (round_number - 1 + 0.125 * 7) * (round_number - 1 + 0.125 * 7)
  110. gannsq_42 = (round_number - 1 + 0.125 * 8) * (round_number - 1 + 0.125 * 8)
  111.  
  112. gannsq_31 = (round_number + 0.125 * 1) * (round_number + 0.125 * 1)
  113. gannsq_11 = (round_number + 0.125 * 2) * (round_number + 0.125 * 2)
  114. gannsq_13 = (round_number + 0.125 * 3) * (round_number + 0.125 * 3)
  115. gannsq_15 = (round_number + 0.125 * 4) * (round_number + 0.125 * 4)
  116. gannsq_35 = (round_number + 0.125 * 5) * (round_number + 0.125 * 5)
  117. gannsq_55 = (round_number + 0.125 * 6) * (round_number + 0.125 * 6)
  118. gannsq_53 = (round_number + 0.125 * 7) * (round_number + 0.125 * 7)
  119. gannsq_51 = (round_number + 0.125 * 8) * (round_number + 0.125 * 8)
  120.  
  121. gannsq_30 = (round_number + 1 + 0.125 * 1) * (round_number + 1 + 0.125 * 1)
  122. gannsq_00 = (round_number + 1 + 0.125 * 2) * (round_number + 1 + 0.125 * 2)
  123. gannsq_03 = (round_number + 1 + 0.125 * 3) * (round_number + 1 + 0.125 * 3)
  124. gannsq_06 = (round_number + 1 + 0.125 * 4) * (round_number + 1 + 0.125 * 4)
  125. gannsq_36 = (round_number + 1 + 0.125 * 5) * (round_number + 1 + 0.125 * 5)
  126. gannsq_66 = (round_number + 1 + 0.125 * 6) * (round_number + 1 + 0.125 * 6)
  127. gannsq_63 = (round_number + 1 + 0.125 * 7) * (round_number + 1 + 0.125 * 7)
  128. gannsq_60 = (round_number + 1 + 0.125 * 8) * (round_number + 1 + 0.125 * 8)
  129.  
  130. if price_option > gannsq_31 and price_option < gannsq_11
  131. long_above := gannsq_11
  132. short_below := gannsq_31
  133. r_1 := gannsq_13 * 0.9995
  134. r_2 := gannsq_15 * 0.9995
  135. r_3 := gannsq_35 * 0.9995
  136. s_1 := gannsq_42 * 1.0005
  137. s_2 := gannsq_43 * 1.0005
  138. s_3 := gannsq_44 * 1.0005
  139. s_3
  140.  
  141. if price_option > gannsq_11 and price_option < gannsq_13
  142. long_above := gannsq_13
  143. short_below := gannsq_11
  144. r_1 := gannsq_15 * 0.9995
  145. r_2 := gannsq_35 * 0.9995
  146. r_3 := gannsq_55 * 0.9995
  147. s_1 := gannsq_31 * 1.0005
  148. s_2 := gannsq_42 * 1.0005
  149. s_3 := gannsq_43 * 1.0005
  150. s_3
  151.  
  152. if price_option > gannsq_13 and price_option < gannsq_15
  153. long_above := gannsq_15
  154. short_below := gannsq_13
  155. r_1 := gannsq_35 * 0.9995
  156. r_2 := gannsq_55 * 0.9995
  157. r_3 := gannsq_53 * 0.9995
  158. s_1 := gannsq_11 * 1.0005
  159. s_2 := gannsq_31 * 1.0005
  160. s_3 := gannsq_42 * 1.0005
  161. s_3
  162.  
  163. if price_option > gannsq_15 and price_option < gannsq_35
  164. long_above := gannsq_35
  165. short_below := gannsq_15
  166. r_1 := gannsq_55 * 0.9995
  167. r_2 := gannsq_53 * 0.9995
  168. r_3 := gannsq_51 * 0.9995
  169. s_1 := gannsq_13 * 1.0005
  170. s_2 := gannsq_11 * 1.0005
  171. s_3 := gannsq_31 * 1.0005
  172. s_3
  173.  
  174. if price_option > gannsq_35 and price_option < gannsq_55
  175. long_above := gannsq_55
  176. short_below := gannsq_35
  177. r_1 := gannsq_53 * 0.9995
  178. r_2 := gannsq_51 * 0.9995
  179. r_3 := gannsq_30 * 0.9995
  180. s_1 := gannsq_15 * 1.0005
  181. s_2 := gannsq_13 * 1.0005
  182. s_3 := gannsq_11 * 1.0005
  183. s_3
  184.  
  185. if price_option > gannsq_55 and price_option < gannsq_53
  186. long_above := gannsq_53
  187. short_below := gannsq_55
  188. r_1 := gannsq_51 * 0.9995
  189. r_2 := gannsq_30 * 0.9995
  190. r_3 := gannsq_00 * 0.9995
  191. s_1 := gannsq_35 * 1.0005
  192. s_2 := gannsq_15 * 1.0005
  193. s_3 := gannsq_13 * 1.0005
  194. s_3
  195.  
  196. if price_option > gannsq_53 and price_option < gannsq_51
  197. long_above := gannsq_51
  198. short_below := gannsq_53
  199. r_1 := gannsq_30 * 0.9995
  200. r_2 := gannsq_00 * 0.9995
  201. r_3 := gannsq_03 * 0.9995
  202. s_1 := gannsq_55 * 1.0005
  203. s_2 := gannsq_35 * 1.0005
  204. s_3 := gannsq_15 * 1.0005
  205. s_3
  206.  
  207. if price_option < gannsq_51 and price_option < gannsq_31
  208. long_above := gannsq_31
  209. short_below := gannsq_42
  210. r_1 := gannsq_11 * 0.9995
  211. r_2 := gannsq_13 * 0.9995
  212. r_3 := gannsq_15 * 0.9995
  213. s_1 := gannsq_43 * 1.0005
  214. s_2 := gannsq_44 * 1.0005
  215. s_3 := gannsq_34 * 1.0005
  216. s_3
  217.  
  218. //Plot
  219.  
  220. //Position
  221. chper = time - time[1]
  222. chper := ta.change(chper) > 0 ? chper[1] : chper
  223.  
  224. //Start & End Time for Today
  225. bar_start = time[74]
  226. bar_end = time + chper * 0
  227.  
  228. if show_gann == 'Basic'
  229. price_line = line.new(x1=bar_start, y1=price_option, x2=bar_end, y2=price_option, color=color.gray, style=line.style_dashed, width=1, extend=_ln_extend, xloc=xloc.bar_time)
  230. line.delete(price_line[1])
  231. long_line = line.new(x1=bar_start, y1=long_above, x2=bar_end, y2=long_above, color=r_color, style=line.style_solid, width=2, extend=_ln_extend, xloc=xloc.bar_time)
  232. line.delete(long_line[1])
  233. short_line = line.new(x1=bar_start, y1=short_below, x2=bar_end, y2=short_below, color=s_color, style=line.style_solid, width=2, extend=_ln_extend, xloc=xloc.bar_time)
  234. line.delete(short_line[1])
  235.  
  236. if show_r1
  237. r1_line = line.new(x1=bar_start, y1=r_1, x2=bar_end, y2=r_1, color=r_color, style=line.style_dotted, width=2, extend=_ln_extend, xloc=xloc.bar_time)
  238. line.delete(r1_line[1])
  239. if show_r2
  240. r2_line = line.new(x1=bar_start, y1=r_2, x2=bar_end, y2=r_2, color=r_color, style=line.style_dotted, width=2, extend=_ln_extend, xloc=xloc.bar_time)
  241. line.delete(r2_line[1])
  242. if show_r3
  243. r3_line = line.new(x1=bar_start, y1=r_3, x2=bar_end, y2=r_3, color=r_color, style=line.style_dotted, width=2, extend=_ln_extend, xloc=xloc.bar_time)
  244. line.delete(r3_line[1])
  245.  
  246. if show_s1
  247. s1_line = line.new(x1=bar_start, y1=s_1, x2=bar_end, y2=s_1, color=s_color, style=line.style_dotted, width=2, extend=_ln_extend, xloc=xloc.bar_time)
  248. line.delete(s1_line[1])
  249. if show_s2
  250. s2_line = line.new(x1=bar_start, y1=s_2, x2=bar_end, y2=s_2, color=s_color, style=line.style_dotted, width=2, extend=_ln_extend, xloc=xloc.bar_time)
  251. line.delete(s2_line[1])
  252. if show_s3
  253. s3_line = line.new(x1=bar_start, y1=s_3, x2=bar_end, y2=s_3, color=s_color, style=line.style_dotted, width=2, extend=_ln_extend, xloc=xloc.bar_time)
  254. line.delete(s3_line[1])
  255.  
  256. // Percentage Formula
  257. price_percent = math.abs((price_option - close) / price_option * 100)
  258. long_percent = math.abs((long_above - close) / long_above * 100)
  259. short_percent = math.abs((short_below - close) / short_below * 100)
  260. r1_percent = math.abs((r_1 - close) / r_1 * 100)
  261. r2_percent = math.abs((r_2 - close) / r_2 * 100)
  262. r3_percent = math.abs((r_3 - close) / r_3 * 100)
  263. s1_percent = math.abs((s_1 - close) / s_1 * 100)
  264. s2_percent = math.abs((s_2 - close) / s_2 * 100)
  265. s3_percent = math.abs((s_3 - close) / s_3 * 100)
  266.  
  267. // Labels
  268.  
  269. var label price_label = na
  270. var label long_label = na
  271. var label short_label = na
  272. var label r1_label = na
  273. var label r2_label = na
  274. var label r3_label = na
  275. var label s1_label = na
  276. var label s2_label = na
  277. var label s3_label = na
  278. label.delete(price_label)
  279. label.delete(long_label)
  280. label.delete(short_label)
  281. label.delete(r1_label)
  282. label.delete(r2_label)
  283. label.delete(r3_label)
  284. label.delete(s1_label)
  285. label.delete(s2_label)
  286. label.delete(s3_label)
  287.  
  288. x_pos = time + chper * 0
  289. l_col = color.new(color.white, 100)
  290.  
  291. if show_gann == 'Basic'
  292. price_label := label.new(x=x_pos, y=price_option, text=str.tostring(price_option, '#.##') + ' (' + str.tostring(price_percent, '#.##') + '%)', textcolor=color.gray, textalign=text.align_left, color=l_col, style=label.style_label_left, xloc=xloc.bar_time, yloc=yloc.price)
  293. long_label := label.new(x=x_pos, y=long_above, text=str.tostring(long_above, '#.##') + ' (' + str.tostring(long_percent, '#.##') + '%)', textcolor=r_color, textalign=text.align_left, color=l_col, style=label.style_label_left, xloc=xloc.bar_time, yloc=yloc.price)
  294. if show_r1
  295. r1_label := label.new(x=x_pos, y=r_1, text=str.tostring(r_1, '#.##') + ' (' + str.tostring(r1_percent, '#.##') + '%)', textcolor=r_color, textalign=text.align_left, color=l_col, style=label.style_label_left, xloc=xloc.bar_time, yloc=yloc.price)
  296. r1_label
  297. if show_r2
  298. r2_label := label.new(x=x_pos, y=r_2, text=str.tostring(r_2, '#.##') + ' (' + str.tostring(r2_percent, '#.##') + '%)', textcolor=r_color, textalign=text.align_left, color=l_col, style=label.style_label_left, xloc=xloc.bar_time, yloc=yloc.price)
  299. r2_label
  300. if show_r3
  301. r3_label := label.new(x=x_pos, y=r_3, text=str.tostring(r_3, '#.##') + ' (' + str.tostring(r3_percent, '#.##') + '%)', textcolor=r_color, textalign=text.align_left, color=l_col, style=label.style_label_left, xloc=xloc.bar_time, yloc=yloc.price)
  302. r3_label
  303.  
  304. short_label := label.new(x=x_pos, y=short_below, text=str.tostring(short_below, '#.##') + ' (' + str.tostring(short_percent, '#.##') + '%)', textcolor=s_color, textalign=text.align_left, color=l_col, style=label.style_label_left, xloc=xloc.bar_time, yloc=yloc.price)
  305. if show_s1
  306. s1_label := label.new(x=x_pos, y=s_1, text=str.tostring(s_1, '#.##') + ' (' + str.tostring(s1_percent, '#.##') + '%)', textcolor=s_color, textalign=text.align_left, color=l_col, style=label.style_label_left, xloc=xloc.bar_time, yloc=yloc.price)
  307. s1_label
  308. if show_s2
  309. s2_label := label.new(x=x_pos, y=s_2, text=str.tostring(s_2, '#.##') + ' (' + str.tostring(s2_percent, '#.##') + '%)', textcolor=s_color, textalign=text.align_left, color=l_col, style=label.style_label_left, xloc=xloc.bar_time, yloc=yloc.price)
  310. s2_label
  311. if show_s3
  312. s3_label := label.new(x=x_pos, y=s_3, text=str.tostring(s_3, '#.##') + ' (' + str.tostring(s3_percent, '#.##') + '%)', textcolor=s_color, textalign=text.align_left, color=l_col, style=label.style_label_left, xloc=xloc.bar_time, yloc=yloc.price)
  313. s3_label
  314.  
  315.  
  316. ////////////////////////////////////////////////////// GANN Square Of 9 Calculation (Extended Levels)
  317.  
  318. gpEx = 'Extended Levels'
  319.  
  320. show_1st_l = input.bool(defval=false, title='1st', group=gpEx, inline='01')
  321. show_2nd_l = input.bool(defval=true, title='2nd', group=gpEx, inline='01')
  322. show_3rd_l = input.bool(defval=false, title='3rd', group=gpEx, inline='01')
  323. show_4th_l = input.bool(defval=false, title='4th', group=gpEx, inline='01')
  324. show_5th_l = input.bool(defval=false, title='5th', group=gpEx, inline='01')
  325.  
  326. round_no = math.floor(sq_root) - 1
  327.  
  328. level_00 = math.pow(round_no, 2) // Center
  329. level_01 = math.pow(round_no + 1 * 0.125, 2) // Rotate 45 degrees
  330. level_02 = math.pow(round_no + 2 * 0.125, 2)
  331. level_03 = math.pow(round_no + 3 * 0.125, 2)
  332. level_04 = math.pow(round_no + 4 * 0.125, 2)
  333. level_05 = math.pow(round_no + 5 * 0.125, 2)
  334. level_06 = math.pow(round_no + 6 * 0.125, 2)
  335. level_07 = math.pow(round_no + 7 * 0.125, 2)
  336. level_08 = math.pow(round_no + 8 * 0.125, 2) // First level
  337. level_09 = math.pow(round_no + 9 * 0.125, 2)
  338. level_10 = math.pow(round_no + 10 * 0.125, 2)
  339. level_11 = math.pow(round_no + 11 * 0.125, 2)
  340. level_12 = math.pow(round_no + 12 * 0.125, 2)
  341. level_13 = math.pow(round_no + 13 * 0.125, 2)
  342. level_14 = math.pow(round_no + 14 * 0.125, 2)
  343. level_15 = math.pow(round_no + 15 * 0.125, 2)
  344. level_16 = math.pow(round_no + 16 * 0.125, 2) // Second level
  345. level_17 = math.pow(round_no + 17 * 0.125, 2)
  346. level_18 = math.pow(round_no + 18 * 0.125, 2)
  347. level_19 = math.pow(round_no + 19 * 0.125, 2)
  348. level_20 = math.pow(round_no + 20 * 0.125, 2)
  349. level_21 = math.pow(round_no + 21 * 0.125, 2)
  350. level_22 = math.pow(round_no + 22 * 0.125, 2)
  351. level_23 = math.pow(round_no + 23 * 0.125, 2)
  352. level_24 = math.pow(round_no + 24 * 0.125, 2) // Third level
  353. level_25 = math.pow(round_no + 25 * 0.125, 2)
  354. level_26 = math.pow(round_no + 26 * 0.125, 2)
  355. level_27 = math.pow(round_no + 27 * 0.125, 2)
  356. level_28 = math.pow(round_no + 28 * 0.125, 2)
  357. level_29 = math.pow(round_no + 29 * 0.125, 2)
  358. level_30 = math.pow(round_no + 30 * 0.125, 2)
  359. level_31 = math.pow(round_no + 31 * 0.125, 2)
  360. level_32 = math.pow(round_no + 32 * 0.125, 2) // Fourth level
  361. level_33 = math.pow(round_no + 33 * 0.125, 2)
  362. level_34 = math.pow(round_no + 34 * 0.125, 2)
  363. level_35 = math.pow(round_no + 35 * 0.125, 2)
  364. level_36 = math.pow(round_no + 36 * 0.125, 2)
  365. level_37 = math.pow(round_no + 37 * 0.125, 2)
  366. level_38 = math.pow(round_no + 38 * 0.125, 2)
  367. level_39 = math.pow(round_no + 39 * 0.125, 2)
  368. level_40 = math.pow(round_no + 40 * 0.125, 2) // Fifth level
  369.  
  370. // Plot
  371.  
  372. col = color.rgb(38, 166, 154)
  373.  
  374. if show_gann == 'Extended'
  375. price_line = line.new(x1=bar_start, y1=price_option, x2=bar_end, y2=price_option, color=s_color, style=line.style_dashed, width=1, extend=_ln_extend, xloc=xloc.bar_time)
  376. line.delete(price_line[1])
  377. if show_1st_l
  378. level_00_line = line.new(x1=bar_start, y1=level_00, x2=bar_end, y2=level_00, color=r_color, style=line.style_solid, width=1, extend=_ln_extend, xloc=xloc.bar_time)
  379. line.delete(level_00_line[1])
  380. level_01_line = line.new(x1=bar_start, y1=level_01, x2=bar_end, y2=level_01, color=r_color, style=line.style_solid, width=1, extend=_ln_extend, xloc=xloc.bar_time)
  381. line.delete(level_01_line[1])
  382. level_02_line = line.new(x1=bar_start, y1=level_02, x2=bar_end, y2=level_02, color=r_color, style=line.style_solid, width=1, extend=_ln_extend, xloc=xloc.bar_time)
  383. line.delete(level_02_line[1])
  384. level_03_line = line.new(x1=bar_start, y1=level_03, x2=bar_end, y2=level_03, color=r_color, style=line.style_solid, width=1, extend=_ln_extend, xloc=xloc.bar_time)
  385. line.delete(level_03_line[1])
  386. level_04_line = line.new(x1=bar_start, y1=level_04, x2=bar_end, y2=level_04, color=r_color, style=line.style_solid, width=1, extend=_ln_extend, xloc=xloc.bar_time)
  387. line.delete(level_04_line[1])
  388. level_05_line = line.new(x1=bar_start, y1=level_05, x2=bar_end, y2=level_05, color=r_color, style=line.style_solid, width=1, extend=_ln_extend, xloc=xloc.bar_time)
  389. line.delete(level_05_line[1])
  390. level_06_line = line.new(x1=bar_start, y1=level_06, x2=bar_end, y2=level_06, color=r_color, style=line.style_solid, width=1, extend=_ln_extend, xloc=xloc.bar_time)
  391. line.delete(level_06_line[1])
  392. level_07_line = line.new(x1=bar_start, y1=level_07, x2=bar_end, y2=level_07, color=r_color, style=line.style_solid, width=1, extend=_ln_extend, xloc=xloc.bar_time)
  393. line.delete(level_07_line[1])
  394. level_08_line = line.new(x1=bar_start, y1=level_08, x2=bar_end, y2=level_08, color=r_color, style=line.style_solid, width=1, extend=_ln_extend, xloc=xloc.bar_time)
  395. line.delete(level_08_line[1]) // First level
  396. if show_2nd_l
  397. level_09_line = line.new(x1=bar_start, y1=level_09, x2=bar_end, y2=level_09, color=r_color, style=line.style_solid, width=1, extend=_ln_extend, xloc=xloc.bar_time)
  398. line.delete(level_09_line[1])
  399. level_10_line = line.new(x1=bar_start, y1=level_10, x2=bar_end, y2=level_10, color=r_color, style=line.style_solid, width=1, extend=_ln_extend, xloc=xloc.bar_time)
  400. line.delete(level_10_line[1])
  401. level_11_line = line.new(x1=bar_start, y1=level_11, x2=bar_end, y2=level_11, color=r_color, style=line.style_solid, width=1, extend=_ln_extend, xloc=xloc.bar_time)
  402. line.delete(level_11_line[1])
  403. level_12_line = line.new(x1=bar_start, y1=level_12, x2=bar_end, y2=level_12, color=r_color, style=line.style_solid, width=1, extend=_ln_extend, xloc=xloc.bar_time)
  404. line.delete(level_12_line[1])
  405. level_13_line = line.new(x1=bar_start, y1=level_13, x2=bar_end, y2=level_13, color=r_color, style=line.style_solid, width=1, extend=_ln_extend, xloc=xloc.bar_time)
  406. line.delete(level_13_line[1])
  407. level_14_line = line.new(x1=bar_start, y1=level_14, x2=bar_end, y2=level_14, color=r_color, style=line.style_solid, width=1, extend=_ln_extend, xloc=xloc.bar_time)
  408. line.delete(level_14_line[1])
  409. level_15_line = line.new(x1=bar_start, y1=level_15, x2=bar_end, y2=level_15, color=r_color, style=line.style_solid, width=1, extend=_ln_extend, xloc=xloc.bar_time)
  410. line.delete(level_15_line[1])
  411. level_16_line = line.new(x1=bar_start, y1=level_16, x2=bar_end, y2=level_16, color=r_color, style=line.style_solid, width=1, extend=_ln_extend, xloc=xloc.bar_time)
  412. line.delete(level_16_line[1]) // Second level
  413. if show_3rd_l
  414. level_17_line = line.new(x1=bar_start, y1=level_17, x2=bar_end, y2=level_17, color=r_color, style=line.style_solid, width=1, extend=_ln_extend, xloc=xloc.bar_time)
  415. line.delete(level_17_line[1])
  416. level_18_line = line.new(x1=bar_start, y1=level_18, x2=bar_end, y2=level_18, color=r_color, style=line.style_solid, width=1, extend=_ln_extend, xloc=xloc.bar_time)
  417. line.delete(level_18_line[1])
  418. level_19_line = line.new(x1=bar_start, y1=level_19, x2=bar_end, y2=level_19, color=r_color, style=line.style_solid, width=1, extend=_ln_extend, xloc=xloc.bar_time)
  419. line.delete(level_19_line[1])
  420. level_20_line = line.new(x1=bar_start, y1=level_20, x2=bar_end, y2=level_20, color=r_color, style=line.style_solid, width=1, extend=_ln_extend, xloc=xloc.bar_time)
  421. line.delete(level_20_line[1])
  422. level_21_line = line.new(x1=bar_start, y1=level_21, x2=bar_end, y2=level_21, color=r_color, style=line.style_solid, width=1, extend=_ln_extend, xloc=xloc.bar_time)
  423. line.delete(level_21_line[1])
  424. level_22_line = line.new(x1=bar_start, y1=level_22, x2=bar_end, y2=level_22, color=r_color, style=line.style_solid, width=1, extend=_ln_extend, xloc=xloc.bar_time)
  425. line.delete(level_22_line[1])
  426. level_23_line = line.new(x1=bar_start, y1=level_23, x2=bar_end, y2=level_23, color=r_color, style=line.style_solid, width=1, extend=_ln_extend, xloc=xloc.bar_time)
  427. line.delete(level_23_line[1])
  428. level_24_line = line.new(x1=bar_start, y1=level_24, x2=bar_end, y2=level_24, color=r_color, style=line.style_solid, width=1, extend=_ln_extend, xloc=xloc.bar_time)
  429. line.delete(level_24_line[1]) // Third level
  430. if show_4th_l
  431. level_25_line = line.new(x1=bar_start, y1=level_25, x2=bar_end, y2=level_25, color=r_color, style=line.style_solid, width=1, extend=_ln_extend, xloc=xloc.bar_time)
  432. line.delete(level_25_line[1])
  433. level_26_line = line.new(x1=bar_start, y1=level_26, x2=bar_end, y2=level_26, color=r_color, style=line.style_solid, width=1, extend=_ln_extend, xloc=xloc.bar_time)
  434. line.delete(level_26_line[1])
  435. level_27_line = line.new(x1=bar_start, y1=level_27, x2=bar_end, y2=level_27, color=r_color, style=line.style_solid, width=1, extend=_ln_extend, xloc=xloc.bar_time)
  436. line.delete(level_27_line[1])
  437. level_28_line = line.new(x1=bar_start, y1=level_28, x2=bar_end, y2=level_28, color=r_color, style=line.style_solid, width=1, extend=_ln_extend, xloc=xloc.bar_time)
  438. line.delete(level_28_line[1])
  439. level_29_line = line.new(x1=bar_start, y1=level_29, x2=bar_end, y2=level_29, color=r_color, style=line.style_solid, width=1, extend=_ln_extend, xloc=xloc.bar_time)
  440. line.delete(level_29_line[1])
  441. level_30_line = line.new(x1=bar_start, y1=level_30, x2=bar_end, y2=level_30, color=r_color, style=line.style_solid, width=1, extend=_ln_extend, xloc=xloc.bar_time)
  442. line.delete(level_30_line[1])
  443. level_31_line = line.new(x1=bar_start, y1=level_31, x2=bar_end, y2=level_31, color=r_color, style=line.style_solid, width=1, extend=_ln_extend, xloc=xloc.bar_time)
  444. line.delete(level_31_line[1])
  445. level_32_line = line.new(x1=bar_start, y1=level_32, x2=bar_end, y2=level_32, color=r_color, style=line.style_solid, width=1, extend=_ln_extend, xloc=xloc.bar_time)
  446. line.delete(level_32_line[1]) // Fourth level
  447. if show_5th_l
  448. level_33_line = line.new(x1=bar_start, y1=level_33, x2=bar_end, y2=level_33, color=r_color, style=line.style_solid, width=1, extend=_ln_extend, xloc=xloc.bar_time)
  449. line.delete(level_33_line[1])
  450. level_34_line = line.new(x1=bar_start, y1=level_34, x2=bar_end, y2=level_34, color=r_color, style=line.style_solid, width=1, extend=_ln_extend, xloc=xloc.bar_time)
  451. line.delete(level_34_line[1])
  452. level_35_line = line.new(x1=bar_start, y1=level_35, x2=bar_end, y2=level_35, color=r_color, style=line.style_solid, width=1, extend=_ln_extend, xloc=xloc.bar_time)
  453. line.delete(level_35_line[1])
  454. level_36_line = line.new(x1=bar_start, y1=level_36, x2=bar_end, y2=level_36, color=r_color, style=line.style_solid, width=1, extend=_ln_extend, xloc=xloc.bar_time)
  455. line.delete(level_36_line[1])
  456. level_37_line = line.new(x1=bar_start, y1=level_37, x2=bar_end, y2=level_37, color=r_color, style=line.style_solid, width=1, extend=_ln_extend, xloc=xloc.bar_time)
  457. line.delete(level_37_line[1])
  458. level_38_line = line.new(x1=bar_start, y1=level_38, x2=bar_end, y2=level_38, color=r_color, style=line.style_solid, width=1, extend=_ln_extend, xloc=xloc.bar_time)
  459. line.delete(level_38_line[1])
  460. level_39_line = line.new(x1=bar_start, y1=level_39, x2=bar_end, y2=level_39, color=r_color, style=line.style_solid, width=1, extend=_ln_extend, xloc=xloc.bar_time)
  461. line.delete(level_39_line[1])
  462. level_40_line = line.new(x1=bar_start, y1=level_40, x2=bar_end, y2=level_40, color=r_color, style=line.style_solid, width=1, extend=_ln_extend, xloc=xloc.bar_time)
  463. line.delete(level_40_line[1]) // Fifth level
  464.  
  465.  
Add Comment
Please, Sign In to add comment