xmd79

Gann Square of 144

Aug 25th, 2022
273
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 48.28 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. // © ThiagoSchmitz
  3.  
  4. //@version=5
  5. indicator("Gann Square of 144", overlay=true, max_lines_count=500, max_labels_count=500)
  6.  
  7. // *****************************************************************************
  8. // ********************************* Inputs ************************************
  9. // *****************************************************************************
  10. startDate = input.time(timestamp("2022-03-28"), "Starting Date")
  11. maxPrice = input.float(69198.0, "Manual Max Price")
  12. minPrice = input.float(17595.0, "Manual Min Price")
  13. autoPricesAndBar = input.bool(true, "Set Upper/Lower Prices and Start Bar Automatically")
  14. updateNewBar = input.bool(true, "Update at new bar")
  15. candlesPerDivision = input.int(1, "Candles per division", minval=1)
  16. showTopXAxis = input.bool(false, "Top X-Axis", inline="Show Axis", group="X-Axis and Y-Axis Labels")
  17. showBottomXAxis = input.bool(true, "Bottom X-Axis", inline="Show Axis", group="X-Axis and Y-Axis Labels")
  18. showLeftYAxis = input.bool(false, "Left Y-Axis", inline="Show Axis", group="X-Axis and Y-Axis Labels")
  19. showRightYAxis = input.bool(true, "Right Y-Axis", inline="Show Axis", group="X-Axis and Y-Axis Labels")
  20. showPrices = input.bool(true, "Show Prices on the Right Y-Axis", inline="Show Axis", group="X-Axis and Y-Axis Labels")
  21. showDivisions = input.bool(true, "Show Vertical Divisions", inline="extras", group="Extra Lines")
  22. showExtraLines = input.bool(true, "Show Extra Lines", inline="extras", group="Extra Lines")
  23. showGrid = input.bool(true, "Show Grid", inline="extras", group="Extra Lines")
  24. patterns = input.string("None", "Line Patterns", options=["None", "Arrow", "Star", "36, 72, and 108", "Arrow Cross", "Corners and Cross", "Master"], inline="patterns", group="patterns")
  25. labelColor = input.color(color.green, "Numbers Color", inline="colors", group="colors")
  26. divisionsColor = input.color(color.blue, "Vertical Lines Color", inline="colors", group="colors")
  27. gridColor = input.color(color.gray, "Grid Color", inline="colors", group="colors")
  28.  
  29. // *****************************************************************************
  30. // *************************** One-Time Variables ******************************
  31. // *****************************************************************************
  32. var box squareLines = box.new(bar_index, high, bar_index, low, color.new(color.white, 50), 2, bgcolor=na)
  33. var int dateBarIndex = 0
  34. var int squares = 144
  35. var bool buildSquareDone = false
  36. var bool buildInputsDone = false
  37. var bool[] dashedLineStyles = array.new_bool()
  38. var bool[] extendLines = array.new_bool()
  39. var bool[] showGroup = array.new_bool()
  40. var color[] lineColors = array.new_color()
  41. var label[] bottomXAxisArray = array.new_label()
  42. var label[] leftYAxisArray = array.new_label()
  43. var label[] rightYAxisArray = array.new_label()
  44. var label[] topXAxisArray = array.new_label()
  45. var line[] BLRArray = array.new_line()
  46. var line[] BLTArray = array.new_line()
  47. var line[] BRLArray = array.new_line()
  48. var line[] BRTArray = array.new_line()
  49. var line[] TLBArray = array.new_line()
  50. var line[] TLRArray = array.new_line()
  51. var line[] TRBArray = array.new_line()
  52. var line[] TRLArray = array.new_line()
  53. var line[] divisionsArray = array.new_line()
  54. var line[] extraArray = array.new_line()
  55. var line[] gridArray = array.new_line()
  56.  
  57. // *****************************************************************************
  58. // ******************************** Variables **********************************
  59. // *****************************************************************************
  60. int startBarIndex = autoPricesAndBar ? bar_index - math.floor(squares * candlesPerDivision / 2) : dateBarIndex
  61. int endBarIndex = startBarIndex + squares * candlesPerDivision
  62. int middleBarIndex = startBarIndex + squares * candlesPerDivision / 2
  63. int onethirdPriceBar = (endBarIndex - startBarIndex) / 3
  64. int barDiff = squares - math.abs(endBarIndex - bar_index)
  65. int barIndexDiff = barDiff <= 0 ? 1 : barDiff
  66. float atr = ta.atr(5)
  67. float highest = ta.highest(math.floor(squares * candlesPerDivision / 2) + 1)
  68. float lowest = ta.lowest(math.floor(squares * candlesPerDivision/ 2) + 1)
  69. float lowerPrice = autoPricesAndBar ? lowest : minPrice
  70. float upperPrice = autoPricesAndBar ? highest : maxPrice
  71. float middlePrice = lowerPrice + (upperPrice - lowerPrice) / 2
  72. float onethirdPrice = (upperPrice - lowerPrice) / 3
  73.  
  74. // *****************************************************************************
  75. // ******************************** Fucntions **********************************
  76. // *****************************************************************************
  77.  
  78. // =============================================================================
  79. // * This function will update the box that goes on the edge of the Gann's
  80. // * square
  81. // =============================================================================
  82. updateBox() =>
  83. box.set_left(squareLines, startBarIndex)
  84. box.set_top(squareLines, upperPrice)
  85. box.set_right(squareLines, endBarIndex)
  86. box.set_bottom(squareLines, lowerPrice)
  87.  
  88. // =============================================================================
  89. // * Build both X-Axis and y-Axis labels
  90. // * It will use the topXAxisArray, bottomXAxisArray, rightYAxisArray, and
  91. // * leftYAxisArray arrays to store each label, if they are enabled to be shown
  92. // =============================================================================
  93. buildAxis() =>
  94. for int j = 0 to squares by 6
  95. if showTopXAxis
  96. array.push(topXAxisArray, label.new(startBarIndex + j * candlesPerDivision, upperPrice + atr / 4, str.tostring(j), style=label.style_none, textcolor=labelColor))
  97. if showBottomXAxis
  98. array.push(bottomXAxisArray, label.new(startBarIndex + j * candlesPerDivision, lowerPrice - atr / 2, str.tostring(j), style=label.style_none, textcolor=labelColor))
  99. if showRightYAxis
  100. price = upperPrice - (upperPrice - lowerPrice) / squares * j
  101. t = str.tostring(j) + (showPrices ? " (" + str.tostring(math.round_to_mintick(price)) + ")" : "")
  102. array.push(rightYAxisArray, label.new(endBarIndex + 8 * candlesPerDivision, price, t, style=label.style_none, textcolor=labelColor))
  103. if showLeftYAxis
  104. array.push(leftYAxisArray, label.new(startBarIndex - 3, upperPrice - (upperPrice - lowerPrice) / squares * j, str.tostring(j), style=label.style_none, textcolor=labelColor))
  105.  
  106. // =============================================================================
  107. // * Update both X-Axis and y-Axis labels
  108. // =============================================================================
  109. updateAxis() =>
  110. for int j = 0 to squares - 1 by 6
  111. if showTopXAxis
  112. label.set_x(array.get(topXAxisArray, j / 6), startBarIndex + j * candlesPerDivision)
  113. label.set_y(array.get(topXAxisArray, j / 6), upperPrice + atr / 4)
  114. if showBottomXAxis
  115. label.set_x(array.get(bottomXAxisArray, j / 6), startBarIndex + j * candlesPerDivision)
  116. label.set_y(array.get(bottomXAxisArray, j / 6), lowerPrice - atr / 2)
  117. if showRightYAxis
  118. label.set_x(array.get(rightYAxisArray, j / 6), endBarIndex + 8 * candlesPerDivision)
  119. label.set_y(array.get(rightYAxisArray, j / 6), upperPrice - (upperPrice - lowerPrice) / squares * j)
  120. if showLeftYAxis
  121. label.set_x(array.get(rightYAxisArray, j / 6), startBarIndex - 3)
  122. label.set_y(array.get(rightYAxisArray, j / 6), upperPrice - (upperPrice - lowerPrice) / squares * j)
  123.  
  124. // =============================================================================
  125. // * Build the vertical divisions to divide the square in 9 smaller squares
  126. // =============================================================================
  127. buildDivisions() =>
  128. array.push(divisionsArray, line.new(startBarIndex, lowerPrice + onethirdPrice, endBarIndex, lowerPrice + onethirdPrice, color=divisionsColor, style=line.style_dashed))
  129. array.push(divisionsArray, line.new(startBarIndex, lowerPrice + onethirdPrice * 2, endBarIndex, lowerPrice + onethirdPrice * 2, color=divisionsColor, style=line.style_dashed))
  130. array.push(divisionsArray, line.new(startBarIndex + onethirdPriceBar, upperPrice, startBarIndex + onethirdPriceBar, lowerPrice, color=divisionsColor, style=line.style_dashed))
  131. array.push(divisionsArray, line.new(startBarIndex + onethirdPriceBar * 2, upperPrice, startBarIndex + onethirdPriceBar * 2, lowerPrice, color=divisionsColor, style=line.style_dashed))
  132.  
  133. // =============================================================================
  134. // * Update the vertical divisions
  135. // =============================================================================
  136. updateDivisions() =>
  137. line.set_xy1(array.get(divisionsArray, 0), startBarIndex, lowerPrice + onethirdPrice)
  138. line.set_xy2(array.get(divisionsArray, 0), endBarIndex, lowerPrice + onethirdPrice)
  139. line.set_xy1(array.get(divisionsArray, 1), startBarIndex, lowerPrice + onethirdPrice * 2)
  140. line.set_xy2(array.get(divisionsArray, 1), endBarIndex, lowerPrice + onethirdPrice * 2)
  141. line.set_xy1(array.get(divisionsArray, 2), startBarIndex + onethirdPriceBar, upperPrice)
  142. line.set_xy2(array.get(divisionsArray, 2), startBarIndex + onethirdPriceBar, lowerPrice)
  143. line.set_xy1(array.get(divisionsArray, 3), startBarIndex + onethirdPriceBar * 2, upperPrice)
  144. line.set_xy2(array.get(divisionsArray, 3), startBarIndex + onethirdPriceBar * 2, lowerPrice)
  145.  
  146. // =============================================================================
  147. // * Build the Gann's square. It will create lines based on the inputs and store
  148. // * them in some arrays. It will use the showGroup array to check if the line
  149. // * needs to be created or not. If showExtraLines is enabled, it will create
  150. // * specific lines to provide the original Gann's Square format
  151. // =============================================================================
  152. buildSquare() =>
  153. for i = 0 to (squares / 6) - 1
  154. int endIndex = startBarIndex + 6 * (i + 1) * candlesPerDivision
  155. float endPrice = upperPrice - ((upperPrice - lowerPrice) / squares) * 6 * (i + 1)
  156. string style = array.get(dashedLineStyles, i) ? line.style_dashed : line.style_solid
  157. string extend = array.get(extendLines, i) ? extend.both : extend.none
  158. if array.get(showGroup, i * 8)
  159. // Top Left Bottom
  160. array.push(TLBArray, line.new(startBarIndex, upperPrice, endIndex, lowerPrice, color=array.get(lineColors, i), style=style, extend=extend))
  161. if array.get(showGroup, i * 8 + 1)
  162. // Top Left Right
  163. array.push(TLRArray, line.new(startBarIndex, upperPrice, endBarIndex, endPrice, color=array.get(lineColors, i), style=style, extend=extend))
  164. if array.get(showGroup, i * 8 + 2)
  165. // Bottom Left Top
  166. array.push(BLTArray, line.new(startBarIndex, lowerPrice, endIndex, upperPrice, color=array.get(lineColors, i), style=style, extend=extend))
  167. if array.get(showGroup, i * 8 + 3)
  168. // Bottom Left Right
  169. array.push(BLRArray, line.new(startBarIndex, lowerPrice, endBarIndex, endPrice, color=array.get(lineColors, i), style=style, extend=extend))
  170. if array.get(showGroup, i * 8 + 4)
  171. // Top Right Bottom
  172. array.push(TRBArray, line.new(endBarIndex, upperPrice, endIndex, lowerPrice, color=array.get(lineColors, i), style=style, extend=extend))
  173. if array.get(showGroup, i * 8 + 5)
  174. // Top Right Left
  175. array.push(TRLArray, line.new(endBarIndex, upperPrice, startBarIndex, endPrice, color=array.get(lineColors, i), style=style, extend=extend))
  176. if array.get(showGroup, i * 8 + 6)
  177. // Bottom Right Top
  178. array.push(BRTArray, line.new(endBarIndex, lowerPrice, endIndex, upperPrice, color=array.get(lineColors, i), style=style, extend=extend))
  179. if array.get(showGroup, i * 8 + 7)
  180. // Bottom Right Left
  181. array.push(BRLArray, line.new(endBarIndex, lowerPrice, startBarIndex, endPrice, color=array.get(lineColors, i), style=style, extend=extend))
  182. if showExtraLines
  183. array.push(extraArray, line.new(middleBarIndex, upperPrice, startBarIndex, upperPrice - ((upperPrice - lowerPrice) / squares) * 36, color=color.red, style= line.style_dashed))
  184. array.push(extraArray, line.new(middleBarIndex, upperPrice, endBarIndex, upperPrice - ((upperPrice - lowerPrice) / squares) * 36, color=color.red, style= line.style_dashed))
  185. array.push(extraArray, line.new(middleBarIndex, lowerPrice, startBarIndex, upperPrice - ((upperPrice - lowerPrice) / squares) * 108, color=color.red, style= line.style_dashed))
  186. array.push(extraArray, line.new(middleBarIndex, lowerPrice, endBarIndex, upperPrice - ((upperPrice - lowerPrice) / squares) * 108, color=color.red, style= line.style_dashed))
  187.  
  188. // =============================================================================
  189. // * Update each line created for the Gann's square
  190. // =============================================================================
  191. updateSquare() =>
  192. if array.size(TLBArray) == (squares / 6) - 1 and
  193. array.size(TLRArray) == (squares / 6) - 1 and
  194. array.size(BLTArray) == (squares / 6) - 1
  195.  
  196. for i = 0 to (squares / 6) - 1
  197. int endIndex = startBarIndex + 6 * i * candlesPerDivision
  198. float endPrice = upperPrice - ((upperPrice - lowerPrice) / squares) * 6 * i
  199. if array.get(showGroup, i * 8)
  200. // Top Left Bottom
  201. line.set_xy1(array.get(TLBArray, i), startBarIndex, upperPrice)
  202. line.set_xy2(array.get(TLBArray, i), endIndex, lowerPrice)
  203. if array.get(showGroup, i * 8 + 1)
  204. // Top Left Right
  205. line.set_xy1(array.get(TLRArray, i), startBarIndex, upperPrice)
  206. line.set_xy2(array.get(TLRArray, i), endBarIndex, endPrice)
  207. if array.get(showGroup, i * 8 + 2)
  208. // Bottom Left Top
  209. line.set_xy1(array.get(BLTArray, i), startBarIndex, lowerPrice)
  210. line.set_xy2(array.get(BLTArray, i), endIndex, upperPrice)
  211. if array.get(showGroup, i * 8 + 3)
  212. // Bottom Left Right
  213. line.set_xy1(array.get(BLRArray, i), startBarIndex, lowerPrice)
  214. line.set_xy2(array.get(BLRArray, i), endBarIndex, endPrice)
  215. if array.get(showGroup, i * 8 + 4)
  216. // Top Right Bottom
  217. line.set_xy1(array.get(TRBArray, i), endBarIndex, upperPrice)
  218. line.set_xy2(array.get(TRBArray, i), endIndex, lowerPrice)
  219. if array.get(showGroup, i * 8 + 5)
  220. // Top Right Left
  221. line.set_xy1(array.get(TRLArray, i), endBarIndex, upperPrice)
  222. line.set_xy2(array.get(TRLArray, i), startBarIndex, endPrice)
  223. if array.get(showGroup, i * 8 + 6)
  224. // Bottom Right Top
  225. line.set_xy1(array.get(BRTArray, i), endBarIndex, lowerPrice)
  226. line.set_xy2(array.get(BRTArray, i), endIndex, upperPrice)
  227. if array.get(showGroup, i * 8 + 7)
  228. // Bottom Right Left
  229. line.set_xy1(array.get(BRLArray, i), endBarIndex, lowerPrice)
  230. line.set_xy2(array.get(BRLArray, i), startBarIndex, endPrice)
  231.  
  232. // =============================================================================
  233. // * Create the grid lines for reference
  234. // =============================================================================
  235. buildGrid() =>
  236. for i = 0 to 23
  237. index = startBarIndex + 6 * (i + 1) * candlesPerDivision
  238. price = upperPrice - ((upperPrice - lowerPrice) / squares) * 6 * (i + 1)
  239. array.push(gridArray, line.new(index, upperPrice, index, lowerPrice, color=gridColor, style=line.style_dotted))
  240. array.push(gridArray, line.new(startBarIndex, price, endBarIndex, price, color=gridColor, style=line.style_dotted))
  241.  
  242. // =============================================================================
  243. // * Update the grid lines
  244. // =============================================================================
  245. updateGrid() =>
  246. for i = 0 to 23
  247. index = startBarIndex + 6 * (i + 1) * candlesPerDivision
  248. price = upperPrice - ((upperPrice - lowerPrice) / squares) * 6 * (i + 1)
  249. line.set_xy1(array.get(gridArray, i * 2), index, upperPrice)
  250. line.set_xy2(array.get(gridArray, i * 2), index, lowerPrice)
  251. line.set_xy1(array.get(gridArray, i * 2 + 1), startBarIndex, price)
  252. line.set_xy2(array.get(gridArray, i * 2 + 1), endBarIndex, price)
  253.  
  254. // =============================================================================
  255. // * Set lines pattern to override the parameters input of each division. When an
  256. // * option besides None is selected, it will ignore the selections of each line
  257. // =============================================================================
  258. setPattern() =>
  259. if patterns != "None"
  260. for i = 0 to array.size(showGroup) - 1
  261. array.set(showGroup, i, false)
  262. if patterns == "Arrow"
  263. array.set(showGroup, 88, true) // Top Left to Bottom 72
  264. array.set(showGroup, 89, true) // Top Left to Right 72
  265. array.set(showGroup, 90, true) // Bottom Left to Top 72
  266. array.set(showGroup, 91, true) // Bottom Left to Right 72
  267. else if patterns == "Star"
  268. array.set(showGroup, 88, true) // Top Left to Bottom 72
  269. array.set(showGroup, 89, true) // Top Left to Right 72
  270. array.set(showGroup, 90, true) // Bottom Left to Top 72
  271. array.set(showGroup, 91, true) // Bottom Left to Right 72
  272. array.set(showGroup, 92, true) // Top Right to Bottom 72
  273. array.set(showGroup, 93, true) // Top Right to Left 72
  274. array.set(showGroup, 94, true) // Bottom Right to Top 72
  275. array.set(showGroup, 95, true) // Bottom Right to Left 72
  276. else if patterns == "36, 72, and 108"
  277. array.set(showGroup, 40, true) // Top Left to Bottom 36
  278. array.set(showGroup, 41, true) // Top Left to Right 36
  279. array.set(showGroup, 42, true) // Bottom Left to Top 36
  280. array.set(showGroup, 45, true) // Top Right to Left 36
  281. array.set(showGroup, 88, true) // Top Left to Bottom 72
  282. array.set(showGroup, 89, true) // Top Left to Right 72
  283. array.set(showGroup, 90, true) // Bottom Left to Top 72
  284. array.set(showGroup, 91, true) // Bottom Left to Right 72
  285. array.set(showGroup, 92, true) // Top Right to Bottom 72
  286. array.set(showGroup, 93, true) // Top Right to Left 72
  287. array.set(showGroup, 94, true) // Bottom Right to Top 72
  288. array.set(showGroup, 95, true) // Bottom Right to Left 72
  289. array.set(showGroup, 139, true) // Bottom Left to Right 108
  290. array.set(showGroup, 140, true) // Top Right to Bottom 108
  291. array.set(showGroup, 142, true) // Bottom Right to Top 108
  292. array.set(showGroup, 143, true) // Bottom Right to Left 108
  293. array.set(showGroup, 184, true) // Top Left to Corner 144
  294. array.set(showGroup, 186, true) // Top Right to Corner 144
  295. else if patterns == "Arrow Cross"
  296. array.set(showGroup, 88, true) // Top Left to Bottom 72
  297. array.set(showGroup, 89, true) // Top Left to Right 72
  298. array.set(showGroup, 90, true) // Bottom Left to Top 72
  299. array.set(showGroup, 91, true) // Bottom Left to Right 72
  300. array.set(showGroup, 184, true) // Top Left to Corner 144
  301. array.set(showGroup, 186, true) // Top Right to Corner 144
  302. else if patterns == "Corners and Cross"
  303. array.set(showGroup, 88, true) // Top Left to Bottom 72
  304. array.set(showGroup, 89, true) // Top Left to Right 72
  305. array.set(showGroup, 90, true) // Bottom Left to Top 72
  306. array.set(showGroup, 91, true) // Bottom Left to Right 72
  307. array.set(showGroup, 92, true) // Top Right to Bottom 72
  308. array.set(showGroup, 93, true) // Top Right to Left 72
  309. array.set(showGroup, 94, true) // Bottom Right to Top 72
  310. array.set(showGroup, 95, true) // Bottom Right to Left 72
  311. array.set(showGroup, 184, true) // Top Left to Corner 144
  312. array.set(showGroup, 186, true) // Top Right to Corner 144
  313. else if patterns == "Master"
  314. array.set(showGroup, 42, true) // Bottom Left to Top 36
  315. array.set(showGroup, 43, true) // Bottom Left to Right 36
  316. array.set(showGroup, 88, true) // Top Left to Bottom 72
  317. array.set(showGroup, 89, true) // Top Left to Right 72
  318. array.set(showGroup, 90, true) // Bottom Left to Top 72
  319. array.set(showGroup, 91, true) // Bottom Left to Right 72
  320. array.set(showGroup, 138, true) // Bottom Left to Top 108
  321. array.set(showGroup, 139, true) // Bottom Left to Right 108
  322. array.set(showGroup, 184, true) // Top Left to Corner 144
  323. array.set(showGroup, 186, true) // Top Right to Corner 144
  324.  
  325. // *****************************************************************************
  326. // ************************** Run On Every Tick ********************************
  327. // *****************************************************************************
  328. if updateNewBar and buildSquareDone and barstate.isnew and autoPricesAndBar
  329. updateSquare()
  330. updateAxis()
  331. updateBox()
  332. if showDivisions
  333. updateDivisions()
  334. if showGrid
  335. updateGrid()
  336.  
  337. // *****************************************************************************
  338. // ****************************** Run Once *************************************
  339. // *****************************************************************************
  340. if buildInputsDone
  341. if time == startDate
  342. dateBarIndex := bar_index
  343. if barstate.islast and not buildSquareDone
  344. setPattern()
  345. updateBox()
  346. buildSquare()
  347. buildAxis()
  348. if showDivisions
  349. buildDivisions()
  350. if showGrid
  351. buildGrid()
  352. buildSquareDone := true
  353.  
  354. // =============================================================================
  355. // * Create all the lines inputs, together with the color of each one, line style and
  356. // * extend type. The default values are those originally found in W.D. Gann's book.
  357. // * The order of each line matters for the comparison inside the functions
  358. // =============================================================================
  359. if not buildInputsDone
  360. buildInputsDone := true
  361. lineColors := array.concat(lineColors, array.from(
  362. input.color(color.green, "Line Color", inline="line", group="Connections from corners to 6"),
  363. input.color(color.green, "Line Color", inline="line", group="Connections from corners to 12"),
  364. input.color(color.red, "Line Color", inline="line", group="Connections from corners to 18"),
  365. input.color(color.green, "Line Color", inline="line", group="Connections from corners to 24"),
  366. input.color(color.green, "Line Color", inline="line", group="Connections from corners to 30"),
  367. input.color(color.red, "Line Color", inline="line", group="Connections from corners to 36"),
  368. input.color(color.green, "Line Color", inline="line", group="Connections from corners to 42"),
  369. input.color(color.red, "Line Color", inline="line", group="Connections from corners to 48"),
  370. input.color(color.green, "Line Color", inline="line", group="Connections from corners to 54"),
  371. input.color(color.green, "Line Color", inline="line", group="Connections from corners to 60"),
  372. input.color(color.green, "Line Color", inline="line", group="Connections from corners to 66"),
  373. input.color(color.green, "Line Color", inline="line", group="Connections from corners to 72"),
  374. input.color(color.green, "Line Color", inline="line", group="Connections from corners to 78"),
  375. input.color(color.green, "Line Color", inline="line", group="Connections from corners to 84"),
  376. input.color(color.green, "Line Color", inline="line", group="Connections from corners to 90"),
  377. input.color(color.red, "Line Color", inline="line", group="Connections from corners to 96"),
  378. input.color(color.green, "Line Color", inline="line", group="Connections from corners to 102"),
  379. input.color(color.red, "Line Color", inline="line", group="Connections from corners to 108"),
  380. input.color(color.green, "Line Color", inline="line", group="Connections from corners to 114"),
  381. input.color(color.green, "Line Color", inline="line", group="Connections from corners to 120"),
  382. input.color(color.red, "Line Color", inline="line", group="Connections from corners to 126"),
  383. input.color(color.green, "Line Color", inline="line", group="Connections from corners to 132"),
  384. input.color(color.green, "Line Color", inline="line", group="Connections from corners to 138"),
  385. input.color(color.green, "Line Color", inline="line", group="Connections from corners to 144")))
  386.  
  387. extendLines := array.concat(extendLines, array.from(
  388. input.bool(false, "Extend Line", inline="line", group="Connections from corners to 6"),
  389. input.bool(false, "Extend Line", inline="line", group="Connections from corners to 12"),
  390. input.bool(false, "Extend Line", inline="line", group="Connections from corners to 18"),
  391. input.bool(false, "Extend Line", inline="line", group="Connections from corners to 24"),
  392. input.bool(false, "Extend Line", inline="line", group="Connections from corners to 30"),
  393. input.bool(false, "Extend Line", inline="line", group="Connections from corners to 36"),
  394. input.bool(false, "Extend Line", inline="line", group="Connections from corners to 42"),
  395. input.bool(false, "Extend Line", inline="line", group="Connections from corners to 48"),
  396. input.bool(false, "Extend Line", inline="line", group="Connections from corners to 54"),
  397. input.bool(false, "Extend Line", inline="line", group="Connections from corners to 60"),
  398. input.bool(false, "Extend Line", inline="line", group="Connections from corners to 66"),
  399. input.bool(false, "Extend Line", inline="line", group="Connections from corners to 72"),
  400. input.bool(false, "Extend Line", inline="line", group="Connections from corners to 78"),
  401. input.bool(false, "Extend Line", inline="line", group="Connections from corners to 84"),
  402. input.bool(false, "Extend Line", inline="line", group="Connections from corners to 90"),
  403. input.bool(false, "Extend Line", inline="line", group="Connections from corners to 96"),
  404. input.bool(false, "Extend Line", inline="line", group="Connections from corners to 102"),
  405. input.bool(false, "Extend Line", inline="line", group="Connections from corners to 108"),
  406. input.bool(false, "Extend Line", inline="line", group="Connections from corners to 114"),
  407. input.bool(false, "Extend Line", inline="line", group="Connections from corners to 120"),
  408. input.bool(false, "Extend Line", inline="line", group="Connections from corners to 126"),
  409. input.bool(false, "Extend Line", inline="line", group="Connections from corners to 132"),
  410. input.bool(false, "Extend Line", inline="line", group="Connections from corners to 138"),
  411. input.bool(false, "Extend Line", inline="line", group="Connections from corners to 144")))
  412.  
  413. dashedLineStyles := array.concat(dashedLineStyles, array.from(
  414. input.bool(false, "Dashed Line", inline="line", group="Connections from corners to 6"),
  415. input.bool(false, "Dashed Line", inline="line", group="Connections from corners to 12"),
  416. input.bool(true, "Dashed Line", inline="line", group="Connections from corners to 18"),
  417. input.bool(false, "Dashed Line", inline="line", group="Connections from corners to 24"),
  418. input.bool(false, "Dashed Line", inline="line", group="Connections from corners to 30"),
  419. input.bool(true, "Dashed Line", inline="line", group="Connections from corners to 36"),
  420. input.bool(false, "Dashed Line", inline="line", group="Connections from corners to 42"),
  421. input.bool(true, "Dashed Line", inline="line", group="Connections from corners to 48"),
  422. input.bool(false, "Dashed Line", inline="line", group="Connections from corners to 54"),
  423. input.bool(false, "Dashed Line", inline="line", group="Connections from corners to 60"),
  424. input.bool(false, "Dashed Line", inline="line", group="Connections from corners to 66"),
  425. input.bool(false, "Dashed Line", inline="line", group="Connections from corners to 72"),
  426. input.bool(false, "Dashed Line", inline="line", group="Connections from corners to 78"),
  427. input.bool(false, "Dashed Line", inline="line", group="Connections from corners to 84"),
  428. input.bool(false, "Dashed Line", inline="line", group="Connections from corners to 90"),
  429. input.bool(true, "Dashed Line", inline="line", group="Connections from corners to 96"),
  430. input.bool(false, "Dashed Line", inline="line", group="Connections from corners to 102"),
  431. input.bool(true, "Dashed Line", inline="line", group="Connections from corners to 108"),
  432. input.bool(false, "Dashed Line", inline="line", group="Connections from corners to 114"),
  433. input.bool(false, "Dashed Line", inline="line", group="Connections from corners to 120"),
  434. input.bool(true, "Dashed Line", inline="line", group="Connections from corners to 126"),
  435. input.bool(false, "Dashed Line", inline="line", group="Connections from corners to 132"),
  436. input.bool(false, "Dashed Line", inline="line", group="Connections from corners to 138"),
  437. input.bool(false, "Dashed Line", inline="line", group="Connections from corners to 144")))
  438.  
  439. showGroup := array.concat(showGroup, array.from(
  440. input.bool(false, "┏ ↓", inline="6", group="Connections from corners to 6"),
  441. input.bool(false, "┏ →", inline="6", group="Connections from corners to 6"),
  442. input.bool(false, "┗ ↑", inline="6", group="Connections from corners to 6"),
  443. input.bool(false, "┗ →", inline="6", group="Connections from corners to 6"),
  444. input.bool(false, "┓ ←", inline="6", group="Connections from corners to 6"),
  445. input.bool(false, "┓ ↓", inline="6", group="Connections from corners to 6"),
  446. input.bool(false, "┛ ←", inline="6", group="Connections from corners to 6"),
  447. input.bool(false, "┛ ↑", inline="6", group="Connections from corners to 6"),
  448. input.bool(false, "┏ ↓", inline="12", group="Connections from corners to 12"),
  449. input.bool(false, "┏ →", inline="12", group="Connections from corners to 12"),
  450. input.bool(false, "┗ ↑", inline="12", group="Connections from corners to 12"),
  451. input.bool(false, "┗ →", inline="12", group="Connections from corners to 12"),
  452. input.bool(false, "┓ ←", inline="12", group="Connections from corners to 12"),
  453. input.bool(false, "┓ ↓", inline="12", group="Connections from corners to 12"),
  454. input.bool(false, "┛ ←", inline="12", group="Connections from corners to 12"),
  455. input.bool(false, "┛ ↑", inline="12", group="Connections from corners to 12"),
  456. input.bool(true, "┏ ↓", inline="18", group="Connections from corners to 18"),
  457. input.bool(true, "┏ →", inline="18", group="Connections from corners to 18"),
  458. input.bool(true, "┗ ↑", inline="18", group="Connections from corners to 18"),
  459. input.bool(false, "┗ →", inline="18", group="Connections from corners to 18"),
  460. input.bool(false, "┓ ←", inline="18", group="Connections from corners to 18"),
  461. input.bool(false, "┓ ↓", inline="18", group="Connections from corners to 18"),
  462. input.bool(false, "┛ ←", inline="18", group="Connections from corners to 18"),
  463. input.bool(false, "┛ ↑", inline="18", group="Connections from corners to 18"),
  464. input.bool(false, "┏ ↓", inline="24", group="Connections from corners to 24"),
  465. input.bool(false, "┏ →", inline="24", group="Connections from corners to 24"),
  466. input.bool(false, "┗ ↑", inline="24", group="Connections from corners to 24"),
  467. input.bool(false, "┗ →", inline="24", group="Connections from corners to 24"),
  468. input.bool(false, "┓ ←", inline="24", group="Connections from corners to 24"),
  469. input.bool(false, "┓ ↓", inline="24", group="Connections from corners to 24"),
  470. input.bool(false, "┛ ←", inline="24", group="Connections from corners to 24"),
  471. input.bool(false, "┛ ↑", inline="24", group="Connections from corners to 24"),
  472. input.bool(false, "┏ ↓", inline="30", group="Connections from corners to 30"),
  473. input.bool(false, "┏ →", inline="30", group="Connections from corners to 30"),
  474. input.bool(false, "┗ ↑", inline="30", group="Connections from corners to 30"),
  475. input.bool(false, "┗ →", inline="30", group="Connections from corners to 30"),
  476. input.bool(false, "┓ ←", inline="30", group="Connections from corners to 30"),
  477. input.bool(false, "┓ ↓", inline="30", group="Connections from corners to 30"),
  478. input.bool(false, "┛ ←", inline="30", group="Connections from corners to 30"),
  479. input.bool(false, "┛ ↑", inline="30", group="Connections from corners to 30"),
  480. input.bool(true, "┏ ↓", inline="36", group="Connections from corners to 36"),
  481. input.bool(true, "┏ →", inline="36", group="Connections from corners to 36"),
  482. input.bool(true, "┗ ↑", inline="36", group="Connections from corners to 36"),
  483. input.bool(false, "┗ →", inline="36", group="Connections from corners to 36"),
  484. input.bool(false, "┓ ←", inline="36", group="Connections from corners to 36"),
  485. input.bool(false, "┓ ↓", inline="36", group="Connections from corners to 36"),
  486. input.bool(false, "┛ ←", inline="36", group="Connections from corners to 36"),
  487. input.bool(false, "┛ ↑", inline="36", group="Connections from corners to 36"),
  488. input.bool(false, "┏ ↓", inline="42", group="Connections from corners to 42"),
  489. input.bool(false, "┏ →", inline="42", group="Connections from corners to 42"),
  490. input.bool(false, "┗ ↑", inline="42", group="Connections from corners to 42"),
  491. input.bool(false, "┗ →", inline="42", group="Connections from corners to 42"),
  492. input.bool(false, "┓ ←", inline="42", group="Connections from corners to 42"),
  493. input.bool(false, "┓ ↓", inline="42", group="Connections from corners to 42"),
  494. input.bool(false, "┛ ←", inline="42", group="Connections from corners to 42"),
  495. input.bool(false, "┛ ↑", inline="42", group="Connections from corners to 42"),
  496. input.bool(true, "┏ ↓", inline="48", group="Connections from corners to 48"),
  497. input.bool(true, "┏ →", inline="48", group="Connections from corners to 48"),
  498. input.bool(true, "┗ ↑", inline="48", group="Connections from corners to 48"),
  499. input.bool(false, "┗ →", inline="48", group="Connections from corners to 48"),
  500. input.bool(false, "┓ ←", inline="48", group="Connections from corners to 48"),
  501. input.bool(false, "┓ ↓", inline="48", group="Connections from corners to 48"),
  502. input.bool(false, "┛ ←", inline="48", group="Connections from corners to 48"),
  503. input.bool(false, "┛ ↑", inline="48", group="Connections from corners to 48"),
  504. input.bool(false, "┏ ↓", inline="54", group="Connections from corners to 54"),
  505. input.bool(false, "┏ →", inline="54", group="Connections from corners to 54"),
  506. input.bool(false, "┗ ↑", inline="54", group="Connections from corners to 54"),
  507. input.bool(false, "┗ →", inline="54", group="Connections from corners to 54"),
  508. input.bool(false, "┓ ←", inline="54", group="Connections from corners to 54"),
  509. input.bool(false, "┓ ↓", inline="54", group="Connections from corners to 54"),
  510. input.bool(false, "┛ ←", inline="54", group="Connections from corners to 54"),
  511. input.bool(false, "┛ ↑", inline="54", group="Connections from corners to 54"),
  512. input.bool(false, "┏ ↓", inline="60", group="Connections from corners to 60"),
  513. input.bool(false, "┏ →", inline="60", group="Connections from corners to 60"),
  514. input.bool(false, "┗ ↑", inline="60", group="Connections from corners to 60"),
  515. input.bool(false, "┗ →", inline="60", group="Connections from corners to 60"),
  516. input.bool(false, "┓ ←", inline="60", group="Connections from corners to 60"),
  517. input.bool(false, "┓ ↓", inline="60", group="Connections from corners to 60"),
  518. input.bool(false, "┛ ←", inline="60", group="Connections from corners to 60"),
  519. input.bool(false, "┛ ↑", inline="60", group="Connections from corners to 60"),
  520. input.bool(false, "┏ ↓", inline="66", group="Connections from corners to 66"),
  521. input.bool(false, "┏ →", inline="66", group="Connections from corners to 66"),
  522. input.bool(false, "┗ ↑", inline="66", group="Connections from corners to 66"),
  523. input.bool(false, "┗ →", inline="66", group="Connections from corners to 66"),
  524. input.bool(false, "┓ ←", inline="66", group="Connections from corners to 66"),
  525. input.bool(false, "┓ ↓", inline="66", group="Connections from corners to 66"),
  526. input.bool(false, "┛ ←", inline="66", group="Connections from corners to 66"),
  527. input.bool(false, "┛ ↑", inline="66", group="Connections from corners to 66"),
  528. input.bool(true, "┏ ↓", inline="72", group="Connections from corners to 72"),
  529. input.bool(true, "┏ →", inline="72", group="Connections from corners to 72"),
  530. input.bool(true, "┗ ↑", inline="72", group="Connections from corners to 72"),
  531. input.bool(true, "┗ →", inline="72", group="Connections from corners to 72"),
  532. input.bool(true, "┓ ←", inline="72", group="Connections from corners to 72"),
  533. input.bool(true, "┓ ↓", inline="72", group="Connections from corners to 72"),
  534. input.bool(true, "┛ ←", inline="72", group="Connections from corners to 72"),
  535. input.bool(true, "┛ ↑", inline="72", group="Connections from corners to 72"),
  536. input.bool(false, "┏ ↓", inline="78", group="Connections from corners to 78"),
  537. input.bool(false, "┏ →", inline="78", group="Connections from corners to 78"),
  538. input.bool(false, "┗ ↑", inline="78", group="Connections from corners to 78"),
  539. input.bool(false, "┗ →", inline="78", group="Connections from corners to 78"),
  540. input.bool(false, "┓ ←", inline="78", group="Connections from corners to 78"),
  541. input.bool(false, "┓ ↓", inline="78", group="Connections from corners to 78"),
  542. input.bool(false, "┛ ←", inline="78", group="Connections from corners to 78"),
  543. input.bool(false, "┛ ↑", inline="78", group="Connections from corners to 78"),
  544. input.bool(false, "┏ ↓", inline="84", group="Connections from corners to 84"),
  545. input.bool(false, "┏ →", inline="84", group="Connections from corners to 84"),
  546. input.bool(false, "┗ ↑", inline="84", group="Connections from corners to 84"),
  547. input.bool(false, "┗ →", inline="84", group="Connections from corners to 84"),
  548. input.bool(false, "┓ ←", inline="84", group="Connections from corners to 84"),
  549. input.bool(false, "┓ ↓", inline="84", group="Connections from corners to 84"),
  550. input.bool(false, "┛ ←", inline="84", group="Connections from corners to 84"),
  551. input.bool(false, "┛ ↑", inline="84", group="Connections from corners to 84"),
  552. input.bool(false, "┏ ↓", inline="90", group="Connections from corners to 90"),
  553. input.bool(false, "┏ →", inline="90", group="Connections from corners to 90"),
  554. input.bool(false, "┗ ↑", inline="90", group="Connections from corners to 90"),
  555. input.bool(false, "┗ →", inline="90", group="Connections from corners to 90"),
  556. input.bool(false, "┓ ←", inline="90", group="Connections from corners to 90"),
  557. input.bool(false, "┓ ↓", inline="90", group="Connections from corners to 90"),
  558. input.bool(false, "┛ ←", inline="90", group="Connections from corners to 90"),
  559. input.bool(false, "┛ ↑", inline="90", group="Connections from corners to 90"),
  560. input.bool(false, "┏ ↓", inline="96", group="Connections from corners to 96"),
  561. input.bool(false, "┏ →", inline="96", group="Connections from corners to 96"),
  562. input.bool(false, "┗ ↑", inline="96", group="Connections from corners to 96"),
  563. input.bool(true, "┗ →", inline="96", group="Connections from corners to 96"),
  564. input.bool(false, "┓ ←", inline="96", group="Connections from corners to 96"),
  565. input.bool(false, "┓ ↓", inline="96", group="Connections from corners to 96"),
  566. input.bool(false, "┛ ←", inline="96", group="Connections from corners to 96"),
  567. input.bool(false, "┛ ↑", inline="96", group="Connections from corners to 96"),
  568. input.bool(false, "┏ ↓", inline="102", group="Connections from corners to 102"),
  569. input.bool(false, "┏ →", inline="102", group="Connections from corners to 102"),
  570. input.bool(false, "┗ ↑", inline="102", group="Connections from corners to 102"),
  571. input.bool(false, "┗ →", inline="102", group="Connections from corners to 102"),
  572. input.bool(false, "┓ ←", inline="102", group="Connections from corners to 102"),
  573. input.bool(false, "┓ ↓", inline="102", group="Connections from corners to 102"),
  574. input.bool(false, "┛ ←", inline="102", group="Connections from corners to 102"),
  575. input.bool(false, "┛ ↑", inline="102", group="Connections from corners to 102"),
  576. input.bool(false, "┏ ↓", inline="108", group="Connections from corners to 108"),
  577. input.bool(false, "┏ →", inline="108", group="Connections from corners to 108"),
  578. input.bool(false, "┗ ↑", inline="108", group="Connections from corners to 108"),
  579. input.bool(true, "┗ →", inline="108", group="Connections from corners to 108"),
  580. input.bool(false, "┓ ←", inline="108", group="Connections from corners to 108"),
  581. input.bool(false, "┓ ↓", inline="108", group="Connections from corners to 108"),
  582. input.bool(false, "┛ ←", inline="108", group="Connections from corners to 108"),
  583. input.bool(false, "┛ ↑", inline="108", group="Connections from corners to 108"),
  584. input.bool(false, "┏ ↓", inline="114", group="Connections from corners to 114"),
  585. input.bool(false, "┏ →", inline="114", group="Connections from corners to 114"),
  586. input.bool(false, "┗ ↑", inline="114", group="Connections from corners to 114"),
  587. input.bool(false, "┗ →", inline="114", group="Connections from corners to 114"),
  588. input.bool(false, "┓ ←", inline="114", group="Connections from corners to 114"),
  589. input.bool(false, "┓ ↓", inline="114", group="Connections from corners to 114"),
  590. input.bool(false, "┛ ←", inline="114", group="Connections from corners to 114"),
  591. input.bool(false, "┛ ↑", inline="114", group="Connections from corners to 114"),
  592. input.bool(false, "┏ ↓", inline="120", group="Connections from corners to 120"),
  593. input.bool(false, "┏ →", inline="120", group="Connections from corners to 120"),
  594. input.bool(false, "┗ ↑", inline="120", group="Connections from corners to 120"),
  595. input.bool(false, "┗ →", inline="120", group="Connections from corners to 120"),
  596. input.bool(false, "┓ ←", inline="120", group="Connections from corners to 120"),
  597. input.bool(false, "┓ ↓", inline="120", group="Connections from corners to 120"),
  598. input.bool(false, "┛ ←", inline="120", group="Connections from corners to 120"),
  599. input.bool(false, "┛ ↑", inline="120", group="Connections from corners to 120"),
  600. input.bool(false, "┏ ↓", inline="126", group="Connections from corners to 126"),
  601. input.bool(false, "┏ →", inline="126", group="Connections from corners to 126"),
  602. input.bool(false, "┗ ↑", inline="126", group="Connections from corners to 126"),
  603. input.bool(true, "┗ →", inline="126", group="Connections from corners to 126"),
  604. input.bool(false, "┓ ←", inline="126", group="Connections from corners to 126"),
  605. input.bool(false, "┓ ↓", inline="126", group="Connections from corners to 126"),
  606. input.bool(false, "┛ ←", inline="126", group="Connections from corners to 126"),
  607. input.bool(false, "┛ ↑", inline="126", group="Connections from corners to 126"),
  608. input.bool(false, "┏ ↓", inline="132", group="Connections from corners to 132"),
  609. input.bool(false, "┏ →", inline="132", group="Connections from corners to 132"),
  610. input.bool(false, "┗ ↑", inline="132", group="Connections from corners to 132"),
  611. input.bool(false, "┗ →", inline="132", group="Connections from corners to 132"),
  612. input.bool(false, "┓ ←", inline="132", group="Connections from corners to 132"),
  613. input.bool(false, "┓ ↓", inline="132", group="Connections from corners to 132"),
  614. input.bool(false, "┛ ←", inline="132", group="Connections from corners to 132"),
  615. input.bool(false, "┛ ↑", inline="132", group="Connections from corners to 132"),
  616. input.bool(false, "┏ ↓", inline="138", group="Connections from corners to 138"),
  617. input.bool(false, "┏ →", inline="138", group="Connections from corners to 138"),
  618. input.bool(false, "┗ ↑", inline="138", group="Connections from corners to 138"),
  619. input.bool(false, "┗ →", inline="138", group="Connections from corners to 138"),
  620. input.bool(false, "┓ ←", inline="138", group="Connections from corners to 138"),
  621. input.bool(false, "┓ ↓", inline="138", group="Connections from corners to 138"),
  622. input.bool(false, "┛ ←", inline="138", group="Connections from corners to 138"),
  623. input.bool(false, "┛ ↑", inline="138", group="Connections from corners to 138"),
  624. input.bool(true, "┏ ↓", inline="144", group="Connections from corners to 144"),
  625. input.bool(true, "┏ →", inline="144", group="Connections from corners to 144"),
  626. input.bool(true, "┗ ↑", inline="144", group="Connections from corners to 144"),
  627. input.bool(true, "┗ →", inline="144", group="Connections from corners to 144"),
  628. input.bool(false, "┓ ←", inline="144", group="Connections from corners to 144"),
  629. input.bool(false, "┓ ↓", inline="144", group="Connections from corners to 144"),
  630. input.bool(false, "┛ ←", inline="144", group="Connections from corners to 144"),
  631. input.bool(false, "┛ ↑", inline="144", group="Connections from corners to 144")))
Advertisement
Add Comment
Please, Sign In to add comment