ajiim

šŸŽ

Aug 31st, 2026
1,701
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 60.29 KB | None | 0 0
  1. //@version=5
  2. indicator("Unicorn Model° [Pro+] (Juno)", shorttitle="Unicorn° [Pro+] [Juno]", overlay=true, max_boxes_count=500, max_lines_count=500, max_labels_count=500, max_bars_back=500)
  3.  
  4. type Candle
  5. float o
  6. float c
  7. float h
  8. float l
  9. box body
  10. line wick_up
  11. line wick_down
  12.  
  13. type CandleSettings
  14. string htf
  15. int max_display
  16.  
  17. type HTF_Settings
  18. color bull_body
  19. color bull_border
  20. color bull_wick
  21. color bear_body
  22. color bear_border
  23. color bear_wick
  24. int buffer
  25. int width
  26. color line_color
  27. bool show_sweeps
  28. color lbl_color
  29. string lbl_size
  30.  
  31. type CandleSet
  32. Candle[] candles
  33. CandleSettings settings
  34. line[] sweeps
  35. label tf_label
  36.  
  37. type UnicornSetup
  38. bool isBull
  39. bool isUnicorn
  40. string sweepLabel
  41. float zoneTop
  42. float zoneBot
  43. int sweepBar
  44. float invalidLevel
  45. float riskSize
  46. float mainTarget
  47. int state
  48. bool alertedTarget
  49. bool alertedInvalWarn
  50. bool alertedInvalHit
  51. box zoneBox
  52. box[] fvgBoxes
  53. line sweepLine
  54. label sweepLbl
  55. line[] targetLines
  56. label[] targetLabels
  57. line bb50Line
  58. line[] fvgCeLines
  59.  
  60. var GRP_GEN = "General"
  61. i_history = input.int (5, "History", minval=1, maxval=50, group=GRP_GEN, tooltip="Max number of setups displayed simultaneously.")
  62. i_biasMode = input.string("Neutral", "Bias", options=["Neutral","Bullish","Bearish","Auto"], group=GRP_GEN)
  63. i_modelMode = input.string("Breaker + Unicorn", "Model Mode", options=["Breaker", "Unicorn", "Breaker + Unicorn"], group=GRP_GEN)
  64. i_showPotential = input.bool (true, "Show Potential Model?", group=GRP_GEN)
  65. i_swingInval = input.bool (false, "Use Swing as Invalidation", group=GRP_GEN, tooltip="Stop loss placed at the extreme of the manipulation sweep instead of the breaker range.")
  66. i_discardInval = input.bool (true, "Discard Invalidated History", group=GRP_GEN, tooltip="Hides invalidated setups from the chart.")
  67.  
  68. var GRP_SRC = "Liquidity Sources"
  69. i_srcMode = input.string("Multiple", "Sources", options=["Single","Multiple"], group=GRP_SRC)
  70. i_srcAuto = input.string("Automatic","Mode", options=["Automatic","Manual"], group=GRP_SRC, tooltip="Automatic: pairs each chart TF with its optimal higher TF. Manual: choose sources explicitly.")
  71. i_srcAType = input.string("OHLC + Swing","Automatic Type", options=["OHLC + Swing","OHLC Only","Swing Only"], group=GRP_SRC)
  72.  
  73. i_srcAEnable = input.bool (true, "Source A", inline="srcA", group=GRP_SRC)
  74. i_srcATF = input.timeframe("60", "", inline="srcA", group=GRP_SRC)
  75. i_srcALiq = input.string("OHLC + Swing","", inline="srcA", options=["OHLC + Swing","OHLC Only","Swing Only"], group=GRP_SRC)
  76.  
  77. i_srcBEnable = input.bool (true, "Source B", inline="srcB", group=GRP_SRC)
  78. i_srcBTF = input.timeframe("240","", inline="srcB", group=GRP_SRC)
  79. i_srcBLiq = input.string("OHLC + Swing","", inline="srcB", options=["OHLC + Swing","OHLC Only","Swing Only"], group=GRP_SRC)
  80.  
  81. i_srcCEnable = input.bool (true, "Source C", inline="srcC", group=GRP_SRC)
  82. i_srcCTF = input.timeframe("D", "", inline="srcC", group=GRP_SRC)
  83. i_srcCLiq = input.string("OHLC + Swing","", inline="srcC", options=["OHLC + Swing","OHLC Only","Swing Only"], group=GRP_SRC)
  84.  
  85. var GRP_SESS_LIQ = "Session Liquidity"
  86. i_useSessLiq = input.bool(false, "Enable Session Liquidity", group=GRP_SESS_LIQ)
  87. i_sessL1Name = input.string("Asia", "Session 1 Name", group=GRP_SESS_LIQ)
  88. i_sessL1Time = input.session("2000-0000", "Session 1 Time", group=GRP_SESS_LIQ)
  89. i_sessL2Name = input.string("London", "Session 2 Name", group=GRP_SESS_LIQ)
  90. i_sessL2Time = input.session("0200-0500", "Session 2 Time", group=GRP_SESS_LIQ)
  91. i_sessL3Name = input.string("New York AM", "Session 3 Name", group=GRP_SESS_LIQ)
  92. i_sessL3Time = input.session("0930-1200", "Session 3 Time", group=GRP_SESS_LIQ)
  93. i_sessL4Name = input.string("New York PM", "Session 4 Name", group=GRP_SESS_LIQ)
  94. i_sessL4Time = input.session("1330-1600", "Session 4 Time", group=GRP_SESS_LIQ)
  95.  
  96. var GRP_HTF_CANDLES = "Floating HTF Candles"
  97. i_htf1_show = input.bool(true, "Show HTF 1", group=GRP_HTF_CANDLES, inline="h1")
  98. i_htf1_tf = input.timeframe("D", "TF 1", group=GRP_HTF_CANDLES, inline="h1")
  99. i_htf1_max = input.int(5, "Max Candles", minval=1, maxval=50, group=GRP_HTF_CANDLES, inline="h1")
  100.  
  101. i_htf2_show = input.bool(true, "Show HTF 2", group=GRP_HTF_CANDLES, inline="h2")
  102. i_htf2_tf = input.timeframe("W", "TF 2", group=GRP_HTF_CANDLES, inline="h2")
  103. i_htf2_max = input.int(3, "Max Candles", minval=1, maxval=50, group=GRP_HTF_CANDLES, inline="h2")
  104.  
  105. i_htf_bull_body = input.color(color.new(#83b785, 0), "Body Bull", inline="htf_body", group=GRP_HTF_CANDLES)
  106. i_htf_bear_body = input.color(color.new(#5f5f5f, 0), "Body Bear", inline="htf_body", group=GRP_HTF_CANDLES)
  107. i_htf_bull_bord = input.color(color.new(#5f5f5f, 0), "Borders Bull", inline="htf_bord", group=GRP_HTF_CANDLES)
  108. i_htf_bear_bord = input.color(color.new(#5f5f5f, 0), "Borders Bear", inline="htf_bord", group=GRP_HTF_CANDLES)
  109. i_htf_bull_wick = input.color(color.new(#5f5f5f, 0), "Wick Bull", inline="htf_wick", group=GRP_HTF_CANDLES)
  110. i_htf_bear_wick = input.color(color.new(#5f5f5f, 0), "Wick Bear", inline="htf_wick", group=GRP_HTF_CANDLES)
  111.  
  112. i_htf_show_sweeps = input.bool(true, "Show Sweep Lines", group=GRP_HTF_CANDLES)
  113. i_htf_line_color = input.color(#5f5f5f, "Sweep Lines Color", group=GRP_HTF_CANDLES)
  114.  
  115. i_htf_lbl_color = input.color(#5f5f5f, "TF Label Color", group=GRP_HTF_CANDLES, inline="lbl")
  116. i_htf_lbl_size = input.string("small", "Size", options=["tiny","small","normal","large","huge"], group=GRP_HTF_CANDLES, inline="lbl")
  117.  
  118. i_htf_offset = input.int(20, "Chart Padding (Offset)", minval = 1, group=GRP_HTF_CANDLES)
  119. i_htf_buffer = input.int(1, "Candle Spacing (Buffer)", minval = 1, maxval = 4, group=GRP_HTF_CANDLES)
  120. i_htf_width = input.int(1, "Candle Width", minval = 1, maxval = 4, group=GRP_HTF_CANDLES) * 2
  121.  
  122. var HTF_Settings global_htf_settings = HTF_Settings.new(i_htf_bull_body, i_htf_bull_bord, i_htf_bull_wick, i_htf_bear_body, i_htf_bear_bord, i_htf_bear_wick, i_htf_buffer, i_htf_width, i_htf_line_color, i_htf_show_sweeps, i_htf_lbl_color, i_htf_lbl_size)
  123. var CandleSet htf1 = CandleSet.new(array.new<Candle>(0), CandleSettings.new(i_htf1_tf, i_htf1_max), array.new_line(0), label(na))
  124. var CandleSet htf2 = CandleSet.new(array.new<Candle>(0), CandleSettings.new(i_htf2_tf, i_htf2_max), array.new_line(0), label(na))
  125.  
  126. var GRP_PROJ = "Target Projections"
  127. i_showRR = input.bool (true, "Show R:R Target?", group=GRP_PROJ)
  128. i_rrMain = input.float (2.0, "R:R", minval=0.1, step=0.5, group=GRP_PROJ)
  129. i_projCalc = input.string("Breaker Range", "Projection Calculation", options=["Breaker Range", "Confirmation Close"], group=GRP_PROJ)
  130. i_showExtra = input.bool (false, "Show Additional Targets?",group=GRP_PROJ)
  131. i_extraStr = input.string("1,3.5","Additional Targets", group=GRP_PROJ, tooltip="Comma-separated R multiples, e.g. 1,1.5,3")
  132.  
  133. var GRP_STY = "Styling"
  134. i_lblSize = input.string("small", "Label Size", options=["tiny","small","normal","large","huge"], group=GRP_STY)
  135.  
  136. i_bullColor = input.color(color.new(#26a69a, 89), "Bull Breaker", group=GRP_STY)
  137. i_bullRetColor = input.color(color.new(#26a69a, 85), "Bull Retested", group=GRP_STY, tooltip="Color when price has retested the zone.")
  138. i_bullFvgColor = input.color(color.new(#26a69a, 70), "Bull FVG", group=GRP_STY)
  139. i_bearColor = input.color(color.new(#e53935, 89), "Bear Breaker", group=GRP_STY)
  140. i_bearRetColor = input.color(color.new(#ef5350, 85), "Bear Retested", group=GRP_STY)
  141. i_bearFvgColor = input.color(color.new(#ef5350, 70), "Bear FVG", group=GRP_STY)
  142. i_invalColor = input.color(color.new(#b0bec5, 92), "Invalidated (Ghost)", group=GRP_STY)
  143. i_showCEBull = input.bool(false, "Show CE (Bull FVG)", group=GRP_STY)
  144. i_extendFVGBull = input.bool(false, "Extend Bull FVG", group=GRP_STY)
  145. i_showCEBear = input.bool(false, "Show CE (Bear FVG)", group=GRP_STY)
  146. i_extendFVGBear = input.bool(false, "Extend Bear FVG", group=GRP_STY)
  147. i_showBB50Bull = input.bool(false, "Show Bull Breaker 50%", group=GRP_STY)
  148. i_extendBB50Bull = input.bool(false, "Extend Bull Breaker 50%?", group=GRP_STY)
  149. i_showBB50Bear = input.bool(false, "Show Bear Breaker 50%", group=GRP_STY)
  150. i_extendBB50Bear = input.bool(false, "Extend Bear Breaker 50%?", group=GRP_STY)
  151. i_bb50Color = input.color(color.new(#000000, 30), "Breaker 50% Color", group=GRP_STY)
  152.  
  153. i_sweepLineColor = input.color(color.new(#000000, 0), "Sweep Line Color", group=GRP_STY)
  154. i_sweepLineStyle = input.string("solid","Sweep Line Style", options=["solid","dashed","dotted"], group=GRP_STY)
  155. i_sweepLineWidth = input.int (1, "Sweep Line Width", minval=1, maxval=4, group=GRP_STY)
  156.  
  157. i_sweepLblSize = input.string("tiny", "Sweep Label Size", options=["tiny","small","normal","large","huge"], group=GRP_STY)
  158. i_sweepLblColor = input.color(color.new(#000000, 20), "Sweep Label Color", group=GRP_STY)
  159.  
  160. i_projLineColor = input.color(color.new(#000000, 0), "Projection Line Color",group=GRP_STY)
  161. i_projLineStyle = input.string("dotted","Projection Style", options=["solid","dashed","dotted"], group=GRP_STY)
  162. i_projLineWidth = input.int (1, "Projection Width", minval=1, maxval=4, group=GRP_STY)
  163.  
  164. var GRP_SZF = "Breaker Size Filter"
  165. i_sizeFilter = input.string("All", "Size Filter", options=["All","Small+Med+Large","Med+Large","Large","Custom"], group=GRP_SZF)
  166. i_customSizeMode = input.string("Points", "Custom Unit", options=["Points","Pips"], group=GRP_SZF)
  167. i_customMin = input.float (0.0, "Min Size (0 = off)", minval=0, step=1, group=GRP_SZF)
  168. i_customMax = input.float (0.0, "Max Size (0 = off)", minval=0, step=1, group=GRP_SZF)
  169.  
  170. var GRP_TF = "Time Filter"
  171. i_useTimeFilter = input.bool (false, "Enable Time Filter", group=GRP_TF)
  172. i_tz = input.string("exchange", "Timezone", group=GRP_TF, tooltip="Use 'exchange' for chart timezone, or specify e.g. 'America/New_York'.")
  173. effectiveTz = i_tz == "exchange" ? syminfo.timezone : i_tz
  174.  
  175. i_sess1Enable = input.bool (true, "Session 1", inline="s1", group=GRP_TF)
  176. i_sess1 = input.session("0200-0500","", inline="s1", group=GRP_TF)
  177. i_sess1Name = input.string("London","", inline="s1", group=GRP_TF)
  178.  
  179. i_sess2Enable = input.bool (true, "Session 2", inline="s2", group=GRP_TF)
  180. i_sess2 = input.session("0930-1200","", inline="s2", group=GRP_TF)
  181. i_sess2Name = input.string("New York","", inline="s2", group=GRP_TF)
  182.  
  183. i_sess3Enable = input.bool (false, "Session 3", inline="s3", group=GRP_TF)
  184. i_sess3 = input.session("1300-1600","", inline="s3", group=GRP_TF)
  185. i_sess3Name = input.string("NY PM","", inline="s3", group=GRP_TF)
  186.  
  187. var GRP_ALT = "Alerts"
  188. i_alertEnable = input.bool (false, "Enable Alerts?", group=GRP_ALT)
  189. i_alertPotential = input.bool (true, "Potential Breaker Alert",group=GRP_ALT)
  190. i_alertActiv = input.bool (true, "Activation Alert", group=GRP_ALT)
  191. i_alertTarget = input.bool (true, "Target Reached Alert", group=GRP_ALT)
  192. i_alertWarn = input.bool (true, "Invalidation Warning", group=GRP_ALT)
  193. i_alertHit = input.bool (true, "Invalidation Hit Alert", group=GRP_ALT)
  194.  
  195. var GRP_TBL = "Info Table"
  196. i_showTable = input.bool (true, "Show Table", group=GRP_TBL)
  197. i_tableMode = input.string("Detailed","Table Mode", options=["Simple","Detailed"], group=GRP_TBL)
  198. i_tablePos = input.string("Bottom Right","Position", options=["Bottom Right","Bottom Left","Top Right","Top Left"], group=GRP_TBL)
  199.  
  200. f_tfLabel(tf) =>
  201. switch tf
  202. "1" => "1m"
  203. "3" => "3m"
  204. "5" => "5m"
  205. "15" => "15m"
  206. "30" => "30m"
  207. "60" => "1H"
  208. "120" => "2H"
  209. "180" => "3H"
  210. "240" => "4H"
  211. "D" => "1D"
  212. "W" => "1W"
  213. "M" => "1M"
  214. => tf
  215.  
  216. method Reorder(CandleSet candleSet, HTF_Settings sett, int base_offset) =>
  217. for l in candleSet.sweeps
  218. line.delete(l)
  219. array.clear(candleSet.sweeps)
  220. int size = array.size(candleSet.candles)
  221. if size > 0
  222. float max_high = na
  223. int center_x = bar_index + base_offset + math.round((((sett.width + sett.buffer) * size) - sett.buffer) / 2)
  224. for i = size - 1 to 0
  225. Candle candle = array.get(candleSet.candles, i)
  226. max_high := na(max_high) ? candle.h : math.max(max_high, candle.h)
  227. int t_buffer = base_offset + ((sett.width + sett.buffer) * (size - i - 1))
  228. int posX = bar_index + t_buffer
  229. int midX = posX + (sett.width / 2)
  230. box.set_left(candle.body, posX)
  231. box.set_right(candle.body, posX + sett.width)
  232. line.set_x1(candle.wick_up, midX)
  233. line.set_x2(candle.wick_up, midX)
  234. line.set_x1(candle.wick_down, midX)
  235. line.set_x2(candle.wick_down, midX)
  236. if i < size - 1
  237. Candle prev = array.get(candleSet.candles, i + 1)
  238. int prevPosX = base_offset + ((sett.width + sett.buffer) * (size - (i + 1) - 1))
  239. int prevMidX = bar_index + prevPosX + (sett.width / 2)
  240. if sett.show_sweeps
  241. if candle.h > prev.h and candle.c < prev.h
  242. array.push(candleSet.sweeps, line.new(prevMidX, prev.h, posX + sett.width, prev.h, color=sett.line_color))
  243. if candle.l < prev.l and candle.c > prev.l
  244. array.push(candleSet.sweeps, line.new(prevMidX, prev.l, posX + sett.width, prev.l, color=sett.line_color))
  245. string tf_str = f_tfLabel(candleSet.settings.htf)
  246. string parsed_size = sett.lbl_size == "tiny" ? size.tiny : sett.lbl_size == "small" ? size.small : sett.lbl_size == "large" ? size.large : sett.lbl_size == "huge" ? size.huge : size.normal
  247. if na(candleSet.tf_label)
  248. candleSet.tf_label := label.new(center_x, max_high, tf_str, color=color.new(color.black, 100), style=label.style_label_down, yloc=yloc.price)
  249. label.set_xy(candleSet.tf_label, center_x, max_high)
  250. label.set_text(candleSet.tf_label, tf_str)
  251. label.set_textcolor(candleSet.tf_label, sett.lbl_color)
  252. label.set_size(candleSet.tf_label, parsed_size)
  253.  
  254. method Monitor(CandleSet candleSet, HTF_Settings sett) =>
  255. bool isNew = ta.change(time(candleSet.settings.htf)) != 0
  256. if isNew
  257. Candle candle = Candle.new(open, close, high, low, box(na), line(na), line(na))
  258. bool bull = candle.c > candle.o
  259. candle.body := box.new(bar_index, math.max(candle.o, candle.c), bar_index + 2, math.min(candle.o, candle.c), border_color = bull ? sett.bull_border : sett.bear_border, border_width = 1, bgcolor = bull ? sett.bull_body : sett.bear_body)
  260. candle.wick_up := line.new(bar_index, candle.h, bar_index, math.max(candle.o, candle.c), color=bull ? sett.bull_wick : sett.bear_wick)
  261. candle.wick_down := line.new(bar_index, math.min(candle.o, candle.c), bar_index, candle.l, color=bull ? sett.bull_wick : sett.bear_wick)
  262. array.unshift(candleSet.candles, candle)
  263. if array.size(candleSet.candles) > candleSet.settings.max_display
  264. Candle del = array.pop(candleSet.candles)
  265. box.delete(del.body)
  266. line.delete(del.wick_up)
  267. line.delete(del.wick_down)
  268. candleSet
  269.  
  270. method Update(CandleSet candleSet, HTF_Settings sett, int base_offset) =>
  271. if array.size(candleSet.candles) > 0
  272. Candle candle = array.get(candleSet.candles, 0)
  273. candle.h := math.max(high, candle.h)
  274. candle.l := math.min(low, candle.l)
  275. candle.c := close
  276. bool bull = candle.c > candle.o
  277. box.set_top(candle.body, math.max(candle.o, candle.c))
  278. box.set_bottom(candle.body, math.min(candle.o, candle.c))
  279. box.set_bgcolor(candle.body, bull ? sett.bull_body : sett.bear_body)
  280. box.set_border_color(candle.body, bull ? sett.bull_border : sett.bear_border)
  281. line.set_y1(candle.wick_up, candle.h)
  282. line.set_y2(candle.wick_up, math.max(candle.o, candle.c))
  283. line.set_y1(candle.wick_down, candle.l)
  284. line.set_y2(candle.wick_down, math.min(candle.o, candle.c))
  285. if barstate.islast
  286. candleSet.Reorder(sett, base_offset)
  287. candleSet
  288.  
  289. f_lineStyle(s) =>
  290. s == "dashed" ? line.style_dashed : s == "dotted" ? line.style_dotted : line.style_solid
  291.  
  292. f_lblSize(s) =>
  293. s == "tiny" ? size.tiny : s == "small" ? size.small : s == "large" ? size.large : s == "huge" ? size.huge : size.normal
  294.  
  295. f_parseExtras(str) =>
  296. parts = str.split(str, ",")
  297. arr = array.new_float(0)
  298. for p in parts
  299. v = str.tonumber(str.trim(p))
  300. if not na(v)
  301. array.push(arr, v)
  302. arr
  303.  
  304. f_findLevelOrigin(isBull, lvl) =>
  305. int offset = 0
  306. for j = 1 to 400
  307. match = isBull ? (math.abs(low[j] - lvl) < syminfo.mintick) : (math.abs(high[j] - lvl) < syminfo.mintick)
  308. if match
  309. offset := j
  310. break
  311. offset
  312.  
  313. f_findOHLCOrigin(isBull, lvl, tf) =>
  314. htf_curr_start = ta.valuewhen(ta.change(time(tf)), bar_index, 0)
  315. htf_prev_start = ta.valuewhen(ta.change(time(tf)), bar_index, 1)
  316. htf_prev_end = htf_curr_start - 1
  317. offset = 0
  318. if not na(htf_prev_start) and not na(htf_prev_end)
  319. start_j = bar_index - htf_prev_end
  320. end_j = bar_index - htf_prev_start
  321. for j = math.max(1, start_j) to math.min(490, end_j)
  322. match = isBull ? (math.abs(low[j] - lvl) < syminfo.mintick) : (math.abs(high[j] - lvl) < syminfo.mintick)
  323. if match
  324. offset := j
  325. break
  326. offset
  327.  
  328. f_alreadySweptBeforeOrigin(isLow, lvl, offset) =>
  329. bool swept = false
  330. if not na(offset) and offset > 1
  331. for i = 1 to offset - 1
  332. if isLow ? (low[i] <= lvl) : (high[i] >= lvl)
  333. swept := true
  334. break
  335. swept
  336.  
  337. f_alreadyTouchedPair(isLowLevel, lvl1, lvl2, tf) =>
  338. int barsSinceStart = ta.barssince(ta.change(time(tf)))
  339. bool touched1 = false
  340. bool touched2 = false
  341. if not na(barsSinceStart) and barsSinceStart > 0
  342. int limit = math.min(barsSinceStart, 300)
  343. for i = 1 to limit
  344. if isLowLevel
  345. if not touched1 and low[i] <= lvl1
  346. touched1 := true
  347. if not touched2 and low[i] <= lvl2
  348. touched2 := true
  349. else
  350. if not touched1 and high[i] >= lvl1
  351. touched1 := true
  352. if not touched2 and high[i] >= lvl2
  353. touched2 := true
  354. if touched1 and touched2
  355. break
  356. [touched1, touched2]
  357.  
  358. f_autoTFPair() =>
  359. ctf = timeframe.period
  360. aTF = switch ctf
  361. "1" => "15"
  362. "2" => "15"
  363. "3" => "15"
  364. "5" => "60"
  365. "10" => "60"
  366. "15" => "240"
  367. "30" => "240"
  368. "60" => "D"
  369. "240" => "W"
  370. => "W"
  371. bTF = switch ctf
  372. "1" => "60"
  373. "3" => "60"
  374. "5" => "240"
  375. "15" => "D"
  376. "60" => "W"
  377. => "W"
  378. cTF = switch ctf
  379. "1" => "240"
  380. "5" => "D"
  381. "15" => "W"
  382. => "W"
  383. [aTF, bTF, cTF]
  384.  
  385. f_inSession() =>
  386. if not i_useTimeFilter
  387. true
  388. else
  389. inS1 = i_sess1Enable and not na(time(timeframe.period, i_sess1, effectiveTz))
  390. inS2 = i_sess2Enable and not na(time(timeframe.period, i_sess2, effectiveTz))
  391. inS3 = i_sess3Enable and not na(time(timeframe.period, i_sess3, effectiveTz))
  392. inS1 or inS2 or inS3
  393.  
  394. f_sessString() =>
  395. s = ""
  396. if i_useTimeFilter
  397. if i_sess1Enable
  398. s += i_sess1Name + ": " + i_sess1 + " "
  399. if i_sess2Enable
  400. s += i_sess2Name + ": " + i_sess2 + " "
  401. if i_sess3Enable
  402. s += i_sess3Name + ": " + i_sess3
  403. s
  404.  
  405. var float[] _bkSizeHistory = array.new_float(0)
  406.  
  407. f_sizeOk(bkSize) =>
  408. pip = syminfo.mintick * (syminfo.type == "forex" ? 10.0 : 1.0)
  409. sz = i_customSizeMode == "Pips" ? bkSize / pip : bkSize
  410. if i_sizeFilter == "All"
  411. true
  412. else if i_sizeFilter == "Custom"
  413. minOk = i_customMin == 0.0 or sz >= i_customMin
  414. maxOk = i_customMax == 0.0 or sz <= i_customMax
  415. minOk and maxOk
  416. else
  417. array.push(_bkSizeHistory, sz)
  418. if array.size(_bkSizeHistory) > 100
  419. array.shift(_bkSizeHistory)
  420. n = array.size(_bkSizeHistory)
  421. if n < 3
  422. true
  423. else
  424. sorted = array.copy(_bkSizeHistory)
  425. array.sort(sorted)
  426. p33 = array.get(sorted, math.round(n * 0.33))
  427. p66 = array.get(sorted, math.round(n * 0.66))
  428. isSmall = sz < p33
  429. isMed = sz >= p33 and sz < p66
  430. isLarge = sz >= p66
  431. i_sizeFilter == "Small+Med+Large" ? true :
  432. i_sizeFilter == "Med+Large" ? (isMed or isLarge) :
  433. i_sizeFilter == "Large" ? isLarge : true
  434.  
  435. emaFast = ta.ema(close, 50)
  436. emaSlow = ta.ema(close, 200)
  437. autoBull = emaFast > emaSlow
  438.  
  439. f_biasOk(isBull) =>
  440. if i_biasMode == "Neutral"
  441. true
  442. else if i_biasMode == "Bullish"
  443. isBull
  444. else if i_biasMode == "Bearish"
  445. not isBull
  446. else
  447. isBull == autoBull
  448.  
  449. [autoA, autoB, autoC] = f_autoTFPair()
  450. effTFA = i_srcAuto == "Automatic" ? autoA : i_srcATF
  451. effTFB = i_srcAuto == "Automatic" ? autoB : i_srcBTF
  452. effTFC = i_srcAuto == "Automatic" ? autoC : i_srcCTF
  453.  
  454. [htfA_h, htfA_l, htfA_swH, htfA_swL] = request.security(syminfo.tickerid, effTFA,
  455. [high, low, ta.pivothigh(high, 1, 1), ta.pivotlow(low, 1, 1)], lookahead=barmerge.lookahead_off)
  456.  
  457. [htfB_h, htfB_l, htfB_swH, htfB_swL] = request.security(syminfo.tickerid, effTFB,
  458. [high, low, ta.pivothigh(high, 1, 1), ta.pivotlow(low, 1, 1)], lookahead=barmerge.lookahead_off)
  459.  
  460. [htfC_h, htfC_l, htfC_swH, htfC_swL] = request.security(syminfo.tickerid, effTFC,
  461. [high, low, ta.pivothigh(high, 1, 1), ta.pivotlow(low, 1, 1)], lookahead=barmerge.lookahead_off)
  462.  
  463. var float swHigh_A = na, var int swHigh_A_age = 0
  464. var float swLow_A = na, var int swLow_A_age = 0
  465. var float swHigh_B = na, var int swHigh_B_age = 0
  466. var float swLow_B = na, var int swLow_B_age = 0
  467. var float swHigh_C = na, var int swHigh_C_age = 0
  468. var float swLow_C = na, var int swLow_C_age = 0
  469.  
  470. isNewBarA = ta.change(time(effTFA))
  471. isNewBarB = ta.change(time(effTFB))
  472. isNewBarC = ta.change(time(effTFC))
  473.  
  474. inSessL1 = not na(time(timeframe.period, i_sessL1Time, "America/New_York"))
  475. inSessL2 = not na(time(timeframe.period, i_sessL2Time, "America/New_York"))
  476. inSessL3 = not na(time(timeframe.period, i_sessL3Time, "America/New_York"))
  477. inSessL4 = not na(time(timeframe.period, i_sessL4Time, "America/New_York"))
  478.  
  479. var float sess1H = na, var float sess1L = na
  480. var float sess2H = na, var float sess2L = na
  481. var float sess3H = na, var float sess3L = na
  482. var float sess4H = na, var float sess4L = na
  483.  
  484. if inSessL1
  485. sess1H := not inSessL1[1] ? high : math.max(sess1H, high)
  486. sess1L := not inSessL1[1] ? low : math.min(sess1L, low)
  487. if inSessL2
  488. sess2H := not inSessL2[1] ? high : math.max(sess2H, high)
  489. sess2L := not inSessL2[1] ? low : math.min(sess2L, low)
  490. if inSessL3
  491. sess3H := not inSessL3[1] ? high : math.max(sess3H, high)
  492. sess3L := not inSessL3[1] ? low : math.min(sess3L, low)
  493. if inSessL4
  494. sess4H := not inSessL4[1] ? high : math.max(sess4H, high)
  495. sess4L := not inSessL4[1] ? low : math.min(sess4L, low)
  496.  
  497. sess1_sweptBull = i_useSessLiq and not inSessL1 and not na(sess1L) and low <= sess1L and low[1] > sess1L
  498. sess1_sweptBear = i_useSessLiq and not inSessL1 and not na(sess1H) and high >= sess1H and high[1] < sess1H
  499.  
  500. sess2_sweptBull = i_useSessLiq and not inSessL2 and not na(sess2L) and low <= sess2L and low[1] > sess2L
  501. sess2_sweptBear = i_useSessLiq and not inSessL2 and not na(sess2H) and high >= sess2H and high[1] < sess2H
  502.  
  503. sess3_sweptBull = i_useSessLiq and not inSessL3 and not na(sess3L) and low <= sess3L and low[1] > sess3L
  504. sess3_sweptBear = i_useSessLiq and not inSessL3 and not na(sess3H) and high >= sess3H and high[1] < sess3H
  505.  
  506. sess4_sweptBull = i_useSessLiq and not inSessL4 and not na(sess4L) and low <= sess4L and low[1] > sess4L
  507. sess4_sweptBear = i_useSessLiq and not inSessL4 and not na(sess4H) and high >= sess4H and high[1] < sess4H
  508.  
  509. sess_bull = sess1_sweptBull or sess2_sweptBull or sess3_sweptBull or sess4_sweptBull
  510. sess_bear = sess1_sweptBear or sess2_sweptBear or sess3_sweptBear or sess4_sweptBear
  511.  
  512. sess_lvl = sess1_sweptBull ? sess1L : sess1_sweptBear ? sess1H :
  513. sess2_sweptBull ? sess2L : sess2_sweptBear ? sess2H :
  514. sess3_sweptBull ? sess3L : sess3_sweptBear ? sess3H :
  515. sess4_sweptBull ? sess4L : sess4_sweptBear ? sess4H : float(na)
  516.  
  517. sess_lbl = sess1_sweptBull ? i_sessL1Name + " Low" : sess1_sweptBear ? i_sessL1Name + " High" :
  518. sess2_sweptBull ? i_sessL2Name + " Low" : sess2_sweptBear ? i_sessL2Name + " High" :
  519. sess3_sweptBull ? i_sessL3Name + " Low" : sess3_sweptBear ? i_sessL3Name + " High" :
  520. sess4_sweptBull ? i_sessL4Name + " Low" : sess4_sweptBear ? i_sessL4Name + " High" : ""
  521.  
  522. if sess1_sweptBull
  523. sess1L := na
  524. if sess1_sweptBear
  525. sess1H := na
  526.  
  527. if sess2_sweptBull
  528. sess2L := na
  529. if sess2_sweptBear
  530. sess2H := na
  531.  
  532. if sess3_sweptBull
  533. sess3L := na
  534. if sess3_sweptBear
  535. sess3H := na
  536.  
  537. if sess4_sweptBull
  538. sess4L := na
  539. if sess4_sweptBear
  540. sess4H := na
  541.  
  542. if not na(htfA_swH)
  543. swHigh_A := htfA_swH
  544. swHigh_A_age := 0
  545. else if isNewBarA and not na(swHigh_A)
  546. swHigh_A_age := swHigh_A_age + 1
  547. if swHigh_A_age > 5
  548. swHigh_A := na
  549.  
  550. if not na(htfA_swL)
  551. swLow_A := htfA_swL
  552. swLow_A_age := 0
  553. else if isNewBarA and not na(swLow_A)
  554. swLow_A_age := swLow_A_age + 1
  555. if swLow_A_age > 5
  556. swLow_A := na
  557.  
  558. if not na(htfB_swH)
  559. swHigh_B := htfB_swH
  560. swHigh_B_age := 0
  561. else if isNewBarB and not na(swHigh_B)
  562. swHigh_B_age := swHigh_B_age + 1
  563. if swHigh_B_age > 5
  564. swHigh_B := na
  565.  
  566. if not na(htfB_swL)
  567. swLow_B := htfB_swL
  568. swLow_B_age := 0
  569. else if isNewBarB and not na(swLow_B)
  570. swLow_B_age := swLow_B_age + 1
  571. if swLow_B_age > 5
  572. swLow_B := na
  573.  
  574. if not na(htfC_swH)
  575. swHigh_C := htfC_swH
  576. swHigh_C_age := 0
  577. else if isNewBarC and not na(swHigh_C)
  578. swHigh_C_age := swHigh_C_age + 1
  579. if swHigh_C_age > 5
  580. swHigh_C := na
  581.  
  582. if not na(htfC_swL)
  583. swLow_C := htfC_swL
  584. swLow_C_age := 0
  585. else if isNewBarC and not na(swLow_C)
  586. swLow_C_age := swLow_C_age + 1
  587. if swLow_C_age > 5
  588. swLow_C := na
  589.  
  590. PIVOT_LEN = 3
  591. swHi = ta.pivothigh(high, PIVOT_LEN, PIVOT_LEN)
  592. swLo = ta.pivotlow (low, PIVOT_LEN, PIVOT_LEN)
  593.  
  594. var int lastSwHiBar = na
  595. var int lastSwLoBar = na
  596. if not na(swHi)
  597. lastSwHiBar := bar_index - PIVOT_LEN
  598. if not na(swLo)
  599. lastSwLoBar := bar_index - PIVOT_LEN
  600.  
  601. var float bld_bull_sweepLevel = na
  602. var int bld_bull_sweepBar = na
  603. var int bld_bull_sweepOffset = na
  604. var float bld_bull_bbTop = na
  605. var float bld_bull_bbBot = na
  606. var int bld_bull_pivotBar = na
  607. var int bld_bull_bbLen = na
  608. var string bld_bull_liqLabel = ""
  609. var float bld_bull_manipLow = na
  610.  
  611. var float bld_bear_sweepLevel = na
  612. var int bld_bear_sweepBar = na
  613. var int bld_bear_sweepOffset = na
  614. var float bld_bear_bbTop = na
  615. var float bld_bear_bbBot = na
  616. var int bld_bear_pivotBar = na
  617. var int bld_bear_bbLen = na
  618. var string bld_bear_liqLabel = ""
  619. var float bld_bear_manipHigh = na
  620.  
  621. var UnicornSetup[] setups = array.new<UnicornSetup>(0)
  622.  
  623. srcAactive = i_srcMode == "Multiple" ? i_srcAEnable : true
  624. srcBactive = i_srcMode == "Multiple" ? i_srcBEnable : false
  625. srcCactive = i_srcMode == "Multiple" ? i_srcCEnable : false
  626.  
  627. liqTypeA = i_srcAuto == "Automatic" ? i_srcAType : i_srcALiq
  628. liqTypeB = i_srcAuto == "Automatic" ? i_srcAType : i_srcBLiq
  629. liqTypeC = i_srcAuto == "Automatic" ? i_srcAType : i_srcCLiq
  630.  
  631. f_checkSweep(srcEnable, htfPH, htfPL, swH, swL, liqType, tfLbl, tf) =>
  632. sweptBull = false
  633. sweptBear = false
  634. sweptLvl = float(na)
  635. lbl = ""
  636. if srcEnable
  637. useOhlc = liqType == "OHLC + Swing" or liqType == "OHLC Only"
  638. useSwing = liqType == "OHLC + Swing" or liqType == "Swing Only"
  639. [ohlcLowAlreadyTouched, swingLowAlreadyTouched] = f_alreadyTouchedPair(true, htfPL, swL, tf)
  640. [ohlcHighAlreadyTouched, swingHighAlreadyTouched] = f_alreadyTouchedPair(false, htfPH, swH, tf)
  641. sw_low_offset = f_findLevelOrigin(true, swL)
  642. sw_high_offset = f_findLevelOrigin(false, swH)
  643. swing_low_already_swept = f_alreadySweptBeforeOrigin(true, swL, sw_low_offset)
  644. swing_high_already_swept = f_alreadySweptBeforeOrigin(false, swH, sw_high_offset)
  645. if useOhlc and not na(htfPL) and not ohlcLowAlreadyTouched and low <= htfPL
  646. sweptBull := true
  647. sweptLvl := htfPL
  648. lbl := tfLbl + " OHLC"
  649. if useSwing and not na(swL) and not sweptBull and not swingLowAlreadyTouched and not swing_low_already_swept and low <= swL
  650. sweptBull := true
  651. sweptLvl := swL
  652. lbl := tfLbl + " Swing"
  653. if useOhlc and not na(htfPH) and not ohlcHighAlreadyTouched and high >= htfPH
  654. sweptBear := true
  655. sweptLvl := htfPH
  656. lbl := tfLbl + " OHLC"
  657. if useSwing and not na(swH) and not sweptBear and not swingHighAlreadyTouched and not swing_high_already_swept and high >= swH
  658. sweptBear := true
  659. sweptLvl := swH
  660. lbl := tfLbl + " Swing"
  661. [sweptBull, sweptBear, sweptLvl, lbl]
  662.  
  663. [swA_bull, swA_bear, swA_lvl, swA_lbl] = f_checkSweep(srcAactive, htfA_h, htfA_l, swHigh_A, swLow_A, liqTypeA, f_tfLabel(effTFA), effTFA)
  664. [swB_bull, swB_bear, swB_lvl, swB_lbl] = f_checkSweep(srcBactive, htfB_h, htfB_l, swHigh_B, swLow_B, liqTypeB, f_tfLabel(effTFB), effTFB)
  665. [swC_bull, swC_bear, swC_lvl, swC_lbl] = f_checkSweep(srcCactive, htfC_h, htfC_l, swHigh_C, swLow_C, liqTypeC, f_tfLabel(effTFC), effTFC)
  666.  
  667. f_combineLabels(l1, ok1, l2, ok2, l3, ok3, l4, ok4) =>
  668. string out = ""
  669. if ok1
  670. out := out + l1
  671. if ok2
  672. out := out + (out == "" ? "" : ", ") + l2
  673. if ok3
  674. out := out + (out == "" ? "" : ", ") + l3
  675. if ok4
  676. out := out + (out == "" ? "" : ", ") + l4
  677. out
  678.  
  679. f_pickExtreme(isLow, l1, ok1, tf1, lb1, l2, ok2, tf2, lb2, l3, ok3, tf3, lb3, l4, ok4, tf4, lb4) =>
  680. float bestLvl = na
  681. string bestTf = na
  682. string bestLbl = na
  683. if ok1 and (na(bestLvl) or (isLow ? l1 < bestLvl : l1 > bestLvl))
  684. bestLvl := l1
  685. bestTf := tf1
  686. bestLbl := lb1
  687. if ok2 and (na(bestLvl) or (isLow ? l2 < bestLvl : l2 > bestLvl))
  688. bestLvl := l2
  689. bestTf := tf2
  690. bestLbl := lb2
  691. if ok3 and (na(bestLvl) or (isLow ? l3 < bestLvl : l3 > bestLvl))
  692. bestLvl := l3
  693. bestTf := tf3
  694. bestLbl := lb3
  695. if ok4 and (na(bestLvl) or (isLow ? l4 < bestLvl : l4 > bestLvl))
  696. bestLvl := l4
  697. bestTf := tf4
  698. bestLbl := lb4
  699. [bestLvl, bestTf, bestLbl]
  700.  
  701. anyBullSweep = swA_bull or swB_bull or swC_bull or sess_bull
  702. anyBearSweep = swA_bear or swB_bear or swC_bear or sess_bear
  703.  
  704. bullSweepLabel = f_combineLabels(swA_lbl, swA_bull, swB_lbl, swB_bull, swC_lbl, swC_bull, sess_lbl, sess_bull)
  705. bearSweepLabel = f_combineLabels(swA_lbl, swA_bear, swB_lbl, swB_bear, swC_lbl, swC_bear, sess_lbl, sess_bear)
  706.  
  707. [bullSweepLevel, bullSweepTF, bullPrimaryLbl] = f_pickExtreme(true, swA_lvl, swA_bull, effTFA, swA_lbl, swB_lvl, swB_bull, effTFB, swB_lbl, swC_lvl, swC_bull, effTFC, swC_lbl, sess_lvl, sess_bull, timeframe.period, sess_lbl)
  708. [bearSweepLevel, bearSweepTF, bearPrimaryLbl] = f_pickExtreme(false, swA_lvl, swA_bear, effTFA, swA_lbl, swB_lvl, swB_bear, effTFB, swB_lbl, swC_lvl, swC_bear, effTFC, swC_lbl, sess_lvl, sess_bear, timeframe.period, sess_lbl)
  709.  
  710. f_findBB(isBull, pivotOffset) =>
  711. bbTop = float(na)
  712. bbBot = float(na)
  713. bbLen = 0
  714. baseIdx = na(pivotOffset) ? 1 : pivotOffset
  715. startIdx = baseIdx
  716. if not na(pivotOffset)
  717. for k = baseIdx - 1 to 1
  718. if isBull ? (close[k] > open[k]) : (close[k] < open[k])
  719. startIdx := k
  720. else
  721. break
  722. for i = startIdx to startIdx + 8
  723. if isBull ? (close[i] > open[i]) : (close[i] < open[i])
  724. bbTop := na(bbTop) ? high[i] : math.max(bbTop, high[i])
  725. bbBot := na(bbBot) ? low[i] : math.min(bbBot, low[i])
  726. bbLen := (i - startIdx) + 1
  727. else
  728. if not na(bbTop)
  729. break
  730. if na(bbTop) and not na(pivotOffset)
  731. bbTop := high[pivotOffset]
  732. bbBot := low[pivotOffset]
  733. bbLen := 1
  734. [bbTop, bbBot, bbLen]
  735.  
  736. f_findFvg(isBull, bbTop, bbBot, sweepBarIndex) =>
  737. tops = array.new_float(0)
  738. bots = array.new_float(0)
  739. idxs = array.new_int(0)
  740. limit = math.min(25, bar_index - sweepBarIndex)
  741. if limit >= 2
  742. for i = 0 to limit - 2
  743. cond = isBull ? (low[i] > high[i+2]) : (high[i] < low[i+2])
  744. if cond
  745. gt = isBull ? low[i] : low[i+2]
  746. gb = isBull ? high[i+2]: high[i]
  747. if gt >= bbBot and gb <= bbTop
  748. array.push(tops, gt)
  749. array.push(bots, gb)
  750. array.push(idxs, i)
  751. [array.size(tops) > 0, tops, bots, idxs]
  752.  
  753. if anyBullSweep and f_inSession() and (na(bld_bull_bbTop) or bullSweepLevel <= bld_bull_sweepLevel)
  754. pivotOffset = bar_index - lastSwHiBar
  755. [bbt, bbb, bblen] = f_findBB(true, pivotOffset)
  756. if not na(bbt) and not na(bbb)
  757. isOhlc = str.contains(bullPrimaryLbl, "OHLC")
  758. sweepOffset = isOhlc ? f_findOHLCOrigin(true, bullSweepLevel, bullSweepTF) : f_findLevelOrigin(true, bullSweepLevel)
  759. if sweepOffset > 0
  760. bld_bull_sweepLevel := bullSweepLevel
  761. bld_bull_sweepBar := bar_index
  762. bld_bull_sweepOffset := sweepOffset
  763. bld_bull_pivotBar := lastSwHiBar
  764. bld_bull_bbTop := bbt
  765. bld_bull_bbBot := bbb
  766. bld_bull_bbLen := bblen
  767. bld_bull_liqLabel := bullSweepLabel
  768. bld_bull_manipLow := low
  769.  
  770. if anyBearSweep and f_inSession() and (na(bld_bear_bbBot) or bearSweepLevel >= bld_bear_sweepLevel)
  771. pivotOffset = bar_index - lastSwLoBar
  772. [bbt, bbb, bblen] = f_findBB(false, pivotOffset)
  773. if not na(bbt) and not na(bbb)
  774. isOhlc = str.contains(bearPrimaryLbl, "OHLC")
  775. sweepOffset = isOhlc ? f_findOHLCOrigin(false, bearSweepLevel, bearSweepTF) : f_findLevelOrigin(false, bearSweepLevel)
  776. if sweepOffset > 0
  777. bld_bear_sweepLevel := bearSweepLevel
  778. bld_bear_sweepBar := bar_index
  779. bld_bear_sweepOffset := sweepOffset
  780. bld_bear_pivotBar := lastSwLoBar
  781. bld_bear_bbTop := bbt
  782. bld_bear_bbBot := bbb
  783. bld_bear_bbLen := bblen
  784. bld_bear_liqLabel := bearSweepLabel
  785. bld_bear_manipHigh := high
  786.  
  787. if not na(bld_bull_bbTop) and (bar_index - bld_bull_sweepBar) > 25
  788. bld_bull_bbTop := na
  789. if not na(bld_bear_bbBot) and (bar_index - bld_bear_sweepBar) > 25
  790. bld_bear_bbBot := na
  791.  
  792. bullActivate = not na(bld_bull_bbTop)
  793. and close > bld_bull_bbTop
  794. and close > open
  795. and bar_index > bld_bull_sweepBar
  796. and f_inSession()
  797. and f_biasOk(true)
  798. and barstate.isconfirmed
  799.  
  800. bearActivate = not na(bld_bear_bbBot)
  801. and close < bld_bear_bbBot
  802. and close < open
  803. and bar_index > bld_bear_sweepBar
  804. and f_inSession()
  805. and f_biasOk(false)
  806. and barstate.isconfirmed
  807.  
  808. var box potBullBox = na
  809. var box potBearBox = na
  810.  
  811. bullPotActive = i_showPotential
  812. and not na(bld_bull_bbTop)
  813. and (close > bld_bull_bbTop)
  814. and (low <= bld_bull_bbTop)
  815. and not bullActivate
  816. and f_biasOk(true)
  817. and f_inSession()
  818.  
  819. if bullPotActive
  820. bbLeft = na(bld_bull_pivotBar) ? bld_bull_sweepBar : (bld_bull_pivotBar - bld_bull_bbLen + 1)
  821. if na(potBullBox)
  822. potBullBox := box.new(bbLeft, bld_bull_bbTop, bar_index, bld_bull_bbBot,
  823. border_color=color.new(color.gray, 100), border_width=0,
  824. bgcolor=color.new(color.gray, 92),
  825. text="Potential +Breaker", text_color=color.gray,
  826. text_size=f_lblSize(i_lblSize), text_halign=text.align_right)
  827. else
  828. box.set_left(potBullBox, bbLeft)
  829. box.set_top(potBullBox, bld_bull_bbTop)
  830. box.set_bottom(potBullBox, bld_bull_bbBot)
  831. box.set_right(potBullBox, bar_index)
  832. else
  833. box.delete(potBullBox)
  834. potBullBox := na
  835.  
  836. bearPotActive = i_showPotential
  837. and not na(bld_bear_bbBot)
  838. and (close < bld_bear_bbBot)
  839. and (high >= bld_bear_bbBot)
  840. and not bearActivate
  841. and f_biasOk(false)
  842. and f_inSession()
  843.  
  844. if bearPotActive
  845. bbLeft = na(bld_bear_pivotBar) ? bld_bear_sweepBar : (bld_bear_pivotBar - bld_bear_bbLen + 1)
  846. if na(potBearBox)
  847. potBearBox := box.new(bbLeft, bld_bear_bbTop, bar_index, bld_bear_bbBot,
  848. border_color=color.new(color.gray, 100), border_width=0,
  849. bgcolor=color.new(color.gray, 92),
  850. text="Potential -Breaker", text_color=color.gray,
  851. text_size=f_lblSize(i_lblSize), text_halign=text.align_right)
  852. else
  853. box.set_left(potBearBox, bbLeft)
  854. box.set_top(potBearBox, bld_bear_bbTop)
  855. box.set_bottom(potBearBox, bld_bear_bbBot)
  856. box.set_right(potBearBox, bar_index)
  857. else
  858. box.delete(potBearBox)
  859. potBearBox := na
  860.  
  861. f_registerSetup(isBull, bbTop, bbBot, sweepLevel, sweepBar, sweepOffset, bbLeft, manipExtreme, hasFvg, fvgTops, fvgBots, fvgLefts, fvgRights, sweepLbl) =>
  862. isUni = hasFvg
  863. showThis = i_modelMode == "Breaker" or (i_modelMode == "Unicorn" and hasFvg) or (i_modelMode == "Breaker + Unicorn")
  864. if showThis
  865. entry = isBull ? bbTop : bbBot
  866. invalLvl = i_swingInval ? manipExtreme : (isBull ? bbBot : bbTop)
  867. riskSz = math.abs(entry - invalLvl)
  868. if f_sizeOk(riskSz) and f_biasOk(isBull)
  869. extras = f_parseExtras(i_extraStr)
  870. nExtras = array.size(extras)
  871. projEntry = i_projCalc == "Confirmation Close" ? close : (isBull ? bbTop : bbBot)
  872. risk = math.abs(projEntry - invalLvl)
  873. mainTgt = isBull ? invalLvl + (i_rrMain + 1.0) * risk : invalLvl - (i_rrMain + 1.0) * risk
  874. extraPrices = array.new_float(0)
  875. for ei = 0 to nExtras - 1
  876. mult = array.get(extras, ei)
  877. t = isBull ? invalLvl + (mult + 1.0) * risk : invalLvl - (mult + 1.0) * risk
  878. array.push(extraPrices, t)
  879. extRight = bar_index + 20
  880. zCol = isBull ? i_bullColor : i_bearColor
  881. lblTxt = isUni ? (isBull ? "+Unicorn" : "-Unicorn")
  882. : (isBull ? "+Breaker" : "-Breaker")
  883. zBox = box.new(bbLeft, bbTop, extRight, bbBot,
  884. border_color=color.new(zCol, 100),
  885. border_width=0,
  886. bgcolor=zCol,
  887. extend=extend.none,
  888. text=lblTxt,
  889. text_size=f_lblSize(i_lblSize),
  890. text_color=color.black,
  891. text_halign=text.align_right,
  892. text_valign=text.align_center)
  893. fBoxArr = array.new<box>(0)
  894. ceLines = array.new<line>(0)
  895. if hasFvg
  896. fvgCol = isBull ? i_bullFvgColor : i_bearFvgColor
  897. for i = 0 to array.size(fvgTops) - 1
  898. ft = array.get(fvgTops, i)
  899. fb = array.get(fvgBots, i)
  900. fl = array.get(fvgLefts, i)
  901. fr = array.get(fvgRights, i)
  902. extendFVG = isBull ? i_extendFVGBull : i_extendFVGBear
  903. fvgRightCol = extendFVG ? extRight : fr
  904. fBox = box.new(fl, ft, fvgRightCol, fb,
  905. border_color=color.new(fvgCol, 100),
  906. border_width=0,
  907. bgcolor=fvgCol,
  908. extend=extend.none)
  909. array.push(fBoxArr, fBox)
  910. fMid = (ft + fb) / 2.0
  911. if (isBull and i_showCEBull) or (not isBull and i_showCEBear)
  912. cel = line.new(fl, fMid, fr, fMid, color=fvgCol, width=1, style=line.style_dotted)
  913. array.push(ceLines, cel)
  914. float bbMid = (bbTop + bbBot) / 2.0
  915. line bb50L = na
  916. if (isBull and i_showBB50Bull) or (not isBull and i_showBB50Bear)
  917. extendLine = isBull ? i_extendBB50Bull : i_extendBB50Bear
  918. endX = extendLine ? (extRight - 5) : math.max(bbLeft, bar_index - 5)
  919. bb50L := line.new(bbLeft, bbMid, endX, bbMid, color=i_bb50Color, width=1, style=line.style_dotted)
  920. originBar = sweepBar - sweepOffset
  921. sweepSty = f_lineStyle(i_sweepLineStyle)
  922. sLine = line.new(originBar, sweepLevel, sweepBar, sweepLevel,
  923. color=i_sweepLineColor, width=i_sweepLineWidth,
  924. style=sweepSty, extend=extend.none)
  925. sLabel = label.new(originBar, sweepLevel, sweepLbl,
  926. style = isBull ? label.style_label_up : label.style_label_down,
  927. textcolor = i_sweepLblColor,
  928. color = color.new(color.black, 100),
  929. size = f_lblSize(i_sweepLblSize),
  930. yloc = yloc.price)
  931. tLines = array.new<line>(0)
  932. tLabels = array.new<label>(0)
  933. projSty = f_lineStyle(i_projLineStyle)
  934. if i_showRR
  935. tl = line.new(bbLeft, mainTgt, bbLeft + 10, mainTgt, color=i_projLineColor, width=i_projLineWidth, style=projSty, extend=extend.none)
  936. array.push(tLines, tl)
  937. tl2 = label.new(bbLeft + 12, mainTgt, str.tostring(i_rrMain, "#.#") + "R", style=label.style_none, textcolor=color.new(i_projLineColor, 10), size=size.tiny, yloc=yloc.price)
  938. array.push(tLabels, tl2)
  939. if i_showExtra
  940. for ei = 0 to nExtras - 1
  941. ep = array.get(extraPrices, ei)
  942. em = array.get(extras, ei)
  943. etl = line.new(bbLeft, ep, bbLeft + 10, ep, color=i_projLineColor, width=i_projLineWidth, style=projSty, extend=extend.none)
  944. array.push(tLines, etl)
  945. etl2 = label.new(bbLeft + 12, ep, str.tostring(em, "#.#") + "R", style=label.style_none, textcolor=color.new(i_projLineColor, 10), size=size.tiny, yloc=yloc.price)
  946. array.push(tLabels, etl2)
  947. newSetup = UnicornSetup.new(
  948. isBull = isBull,
  949. isUnicorn = isUni,
  950. sweepLabel = sweepLbl,
  951. zoneTop = bbTop,
  952. zoneBot = bbBot,
  953. sweepBar = sweepBar,
  954. invalidLevel = invalLvl,
  955. riskSize = riskSz,
  956. mainTarget = mainTgt,
  957. state = 1,
  958. alertedTarget = false,
  959. alertedInvalWarn = false,
  960. alertedInvalHit = false,
  961. zoneBox = zBox,
  962. fvgBoxes = fBoxArr,
  963. sweepLine = sLine,
  964. sweepLbl = sLabel,
  965. targetLines = tLines,
  966. targetLabels = tLabels,
  967. bb50Line = bb50L,
  968. fvgCeLines = ceLines)
  969. array.push(setups, newSetup)
  970.  
  971. if bullActivate
  972. [fFound, fTops, fBots, fIdxs] = f_findFvg(true, bld_bull_bbTop, bld_bull_bbBot, bld_bull_sweepBar)
  973. hasFvg = fFound
  974. fvgTopsArr = array.new_float(0)
  975. fvgBotsArr = array.new_float(0)
  976. fvgLeftsArr = array.new_int(0)
  977. fvgRightsArr = array.new_int(0)
  978. if hasFvg
  979. for i = 0 to array.size(fTops) - 1
  980. fIdx = array.get(fIdxs, i)
  981. array.push(fvgTopsArr, array.get(fTops, i))
  982. array.push(fvgBotsArr, array.get(fBots, i))
  983. array.push(fvgLeftsArr, bar_index - fIdx - 2)
  984. array.push(fvgRightsArr, bar_index - fIdx)
  985. bbLeft = na(bld_bull_pivotBar) ? bld_bull_sweepBar : (bld_bull_pivotBar - bld_bull_bbLen + 1)
  986. f_registerSetup(true, bld_bull_bbTop, bld_bull_bbBot, bld_bull_sweepLevel, bld_bull_sweepBar, bld_bull_sweepOffset, bbLeft, bld_bull_manipLow, hasFvg, fvgTopsArr, fvgBotsArr, fvgLeftsArr, fvgRightsArr, bld_bull_liqLabel)
  987. bld_bull_bbTop := na
  988.  
  989. if bearActivate
  990. [fFound, fTops, fBots, fIdxs] = f_findFvg(false, bld_bear_bbTop, bld_bear_bbBot, bld_bear_sweepBar)
  991. hasFvg = fFound
  992. fvgTopsArr = array.new_float(0)
  993. fvgBotsArr = array.new_float(0)
  994. fvgLeftsArr = array.new_int(0)
  995. fvgRightsArr = array.new_int(0)
  996. if hasFvg
  997. for i = 0 to array.size(fTops) - 1
  998. fIdx = array.get(fIdxs, i)
  999. array.push(fvgTopsArr, array.get(fTops, i))
  1000. array.push(fvgBotsArr, array.get(fBots, i))
  1001. array.push(fvgLeftsArr, bar_index - fIdx - 2)
  1002. array.push(fvgRightsArr, bar_index - fIdx)
  1003. bbLeft = na(bld_bear_pivotBar) ? bld_bear_sweepBar : (bld_bear_pivotBar - bld_bear_bbLen + 1)
  1004. f_registerSetup(false, bld_bear_bbTop, bld_bear_bbBot, bld_bear_sweepLevel, bld_bear_sweepBar, bld_bear_sweepOffset, bbLeft, bld_bear_manipHigh, hasFvg, fvgTopsArr, fvgBotsArr, fvgLeftsArr, fvgRightsArr, bld_bear_liqLabel)
  1005. bld_bear_bbBot := na
  1006.  
  1007. var string lastSweepLabel = "–"
  1008.  
  1009. f_updateSetups(prevLabel) =>
  1010. string retLabel = prevLabel
  1011. n = array.size(setups)
  1012. if n > 0
  1013. for i = n - 1 to 0
  1014. s = array.get(setups, i)
  1015. if s.state == 4 and i_discardInval
  1016. continue
  1017. if s.state >= 3
  1018. continue
  1019. isBull = s.isBull
  1020. if s.state == 1
  1021. retested = isBull ? (low <= s.zoneTop and low >= s.zoneBot) : (high >= s.zoneBot and high <= s.zoneTop)
  1022. if retested
  1023. s.state := 2
  1024. newCol = isBull ? i_bullRetColor : i_bearRetColor
  1025. box.set_bgcolor(s.zoneBox, newCol)
  1026. box.set_border_color(s.zoneBox, color.new(newCol, 100))
  1027. box.set_text_color(s.zoneBox, color.black)
  1028. if s.state == 1 or s.state == 2
  1029. box.set_right(s.zoneBox, bar_index + 20)
  1030. if not na(s.bb50Line)
  1031. extendLine = s.isBull ? i_extendBB50Bull : i_extendBB50Bear
  1032. if extendLine
  1033. boxLeft = box.get_left(s.zoneBox)
  1034. line.set_x2(s.bb50Line, math.max(boxLeft, bar_index + 20 - 5))
  1035. if array.size(s.fvgBoxes) > 0
  1036. for fi = 0 to array.size(s.fvgBoxes) - 1
  1037. curFvgBox = array.get(s.fvgBoxes, fi)
  1038. if (s.isBull and i_extendFVGBull) or (s.isBull == false and i_extendFVGBear)
  1039. box.set_right(curFvgBox, bar_index + 20)
  1040. if array.size(s.fvgCeLines) > fi
  1041. line.set_x2(array.get(s.fvgCeLines, fi), bar_index + 20)
  1042. if i_modelMode == "Breaker + Unicorn" and not s.isUnicorn
  1043. bool fFound = false
  1044. float[] fTops = na
  1045. float[] fBots = na
  1046. int[] fIdxs = na
  1047. [found, tops, bots, idxs] = f_findFvg(s.isBull, s.zoneTop, s.zoneBot, s.sweepBar)
  1048. fFound := found
  1049. fTops := tops
  1050. fBots := bots
  1051. fIdxs := idxs
  1052. if fFound
  1053. s.isUnicorn := true
  1054. box.set_text(s.zoneBox, s.isBull ? "+Unicorn" : "-Unicorn")
  1055. fvgCol = s.isBull ? i_bullFvgColor : i_bearFvgColor
  1056. for i = 0 to array.size(fTops) - 1
  1057. ft = array.get(fTops, i)
  1058. fb = array.get(fBots, i)
  1059. fBox = box.new(bar_index - array.get(fIdxs, i) - 2, ft, bar_index - array.get(fIdxs, i), fb,
  1060. border_color=color.new(fvgCol, 100), border_width=0, bgcolor=fvgCol)
  1061. array.push(s.fvgBoxes, fBox)
  1062. fMid = (ft + fb) / 2.0
  1063. if (s.isBull and i_showCEBull) or (not s.isBull and i_showCEBear)
  1064. cel = line.new(bar_index - array.get(fIdxs, i) - 2, fMid, bar_index - array.get(fIdxs, i), fMid, color=fvgCol, width=1, style=line.style_dotted)
  1065. array.push(s.fvgCeLines, cel)
  1066. if s.state == 1 or s.state == 2
  1067. hitTarget = isBull ? high >= s.mainTarget : low <= s.mainTarget
  1068. if hitTarget
  1069. s.state := 3
  1070. box.set_right(s.zoneBox, bar_index)
  1071. if not na(s.bb50Line)
  1072. extendLine = s.isBull ? i_extendBB50Bull : i_extendBB50Bear
  1073. if extendLine
  1074. boxLeft = box.get_left(s.zoneBox)
  1075. line.set_x2(s.bb50Line, math.max(boxLeft, bar_index - 5))
  1076. if array.size(s.fvgBoxes) > 0
  1077. for fi = 0 to array.size(s.fvgBoxes) - 1
  1078. curFvgBox = array.get(s.fvgBoxes, fi)
  1079. extendFVG = s.isBull ? i_extendFVGBull : i_extendFVGBear
  1080. if extendFVG
  1081. box.set_right(curFvgBox, bar_index)
  1082. if array.size(s.fvgCeLines) > fi
  1083. line.set_x2(array.get(s.fvgCeLines, fi), bar_index)
  1084. if i_alertEnable and i_alertTarget and not s.alertedTarget
  1085. alert("Unicorn Model° Target Reached | " + syminfo.ticker + " | " + (isBull ? "BULL" : "BEAR") + " | " + str.tostring(s.mainTarget, format.mintick), alert.freq_once_per_bar)
  1086. s.alertedTarget := true
  1087. if s.state == 1 or s.state == 2
  1088. invalHit = isBull ? (low <= s.invalidLevel) : (high >= s.invalidLevel)
  1089. invalWarn = not invalHit and (isBull ? (low < s.invalidLevel + s.riskSize * 0.15) : (high > s.invalidLevel - s.riskSize * 0.15))
  1090. if invalWarn and not s.alertedInvalWarn
  1091. if i_alertEnable and i_alertWarn
  1092. alert("Unicorn Model° Invalidation Warning | " + syminfo.ticker + " | " + (isBull ? "BULL" : "BEAR") + " | Level: " + str.tostring(s.invalidLevel, format.mintick), alert.freq_once_per_bar)
  1093. s.alertedInvalWarn := true
  1094. if invalHit
  1095. s.state := 4
  1096. box.set_bgcolor(s.zoneBox, i_invalColor)
  1097. box.set_border_color(s.zoneBox, color.new(#9e9e9e, 100))
  1098. box.set_right(s.zoneBox, bar_index)
  1099. box.set_text_color(s.zoneBox, color.new(#9e9e9e, 40))
  1100. box.set_text(s.zoneBox, s.isUnicorn ? (isBull ? "āœ• +Unicorn" : "āœ• -Unicorn") : (isBull ? "āœ• +Breaker" : "āœ• -Breaker"))
  1101. if not na(s.bb50Line)
  1102. extendLine = s.isBull ? i_extendBB50Bull : i_extendBB50Bear
  1103. if extendLine
  1104. boxLeft = box.get_left(s.zoneBox)
  1105. line.set_x2(s.bb50Line, math.max(boxLeft, bar_index - 5))
  1106. if array.size(s.fvgBoxes) > 0
  1107. for fi = 0 to array.size(s.fvgBoxes) - 1
  1108. curFvgBox = array.get(s.fvgBoxes, fi)
  1109. box.set_bgcolor(curFvgBox, color.new(#9e9e9e, 94))
  1110. box.set_border_color(curFvgBox, color.new(#9e9e9e, 100))
  1111. extendFVG = s.isBull ? i_extendFVGBull : i_extendFVGBear
  1112. if extendFVG
  1113. box.set_right(curFvgBox, bar_index)
  1114. if array.size(s.fvgCeLines) > fi
  1115. line.set_x2(array.get(s.fvgCeLines, fi), bar_index)
  1116. if i_alertEnable and i_alertHit and not s.alertedInvalHit
  1117. alert("āŒ Unicorn Model° Invalidation Hit | " + syminfo.ticker + " | " + (isBull ? "BULL" : "BEAR") + " | SL: " + str.tostring(s.invalidLevel, format.mintick), alert.freq_once_per_bar)
  1118. s.alertedInvalHit := true
  1119. if (s.state == 1 or s.state == 2)
  1120. retLabel := s.sweepLabel
  1121. retLabel
  1122.  
  1123. lastSweepLabel := f_updateSetups(lastSweepLabel)
  1124.  
  1125. bullPotential = bullPotActive or (not na(bld_bull_bbTop) and high >= bld_bull_bbBot and close < bld_bull_bbTop and f_inSession() and f_biasOk(true))
  1126. bearPotential = bearPotActive or (not na(bld_bear_bbBot) and low <= bld_bear_bbTop and close > bld_bear_bbBot and f_inSession() and f_biasOk(false))
  1127.  
  1128. if i_alertEnable and i_alertPotential
  1129. if bullPotential
  1130. alert("Unicorn Model° Potential Breaker | " + syminfo.ticker + " | BULL | Zone: " + str.tostring(bld_bull_bbBot, format.mintick) + " - " + str.tostring(bld_bull_bbTop, format.mintick), alert.freq_once_per_bar)
  1131. if bearPotential
  1132. alert("Unicorn Model° Potential Breaker | " + syminfo.ticker + " | BEAR | Zone: " + str.tostring(bld_bear_bbBot, format.mintick) + " - " + str.tostring(bld_bear_bbTop, format.mintick), alert.freq_once_per_bar)
  1133.  
  1134. if i_alertEnable and i_alertActiv
  1135. if bullActivate
  1136. alert("Unicorn Model° Bullish Activation | " + syminfo.ticker + " | " + bld_bull_liqLabel + " | Close: " + str.tostring(close, format.mintick), alert.freq_once_per_bar_close)
  1137. if bearActivate
  1138. alert("Unicorn Model° Bearish Activation | " + syminfo.ticker + " | " + bld_bear_liqLabel + " | Close: " + str.tostring(close, format.mintick), alert.freq_once_per_bar_close)
  1139.  
  1140. // ━━━ Alert Conditions for TradingView UI ━━━
  1141. alertcondition(bullActivate, title="Bullish Activation", message="Unicorn Model° Bullish Activation on {{ticker}}")
  1142. alertcondition(bearActivate, title="Bearish Activation", message="Unicorn Model° Bearish Activation on {{ticker}}")
  1143. alertcondition(bullPotential or bearPotential, title="Potential Setup", message="Unicorn Model° Potential Setup Detected on {{ticker}}")
  1144.  
  1145. f_gc() =>
  1146. while array.size(setups) > i_history
  1147. oldest = array.shift(setups)
  1148. box.delete(oldest.zoneBox)
  1149. for bx in oldest.fvgBoxes
  1150. box.delete(bx)
  1151. line.delete(oldest.sweepLine)
  1152. label.delete(oldest.sweepLbl)
  1153. line.delete(oldest.bb50Line)
  1154. for cel in oldest.fvgCeLines
  1155. line.delete(cel)
  1156. for tl in oldest.targetLines
  1157. line.delete(tl)
  1158. for lbl in oldest.targetLabels
  1159. label.delete(lbl)
  1160. if i_discardInval
  1161. n = array.size(setups)
  1162. if n > 0
  1163. for i = n - 1 to 0
  1164. s = array.get(setups, i)
  1165. if s.state == 4
  1166. box.delete(s.zoneBox)
  1167. for bx in s.fvgBoxes
  1168. box.delete(bx)
  1169. line.delete(s.sweepLine)
  1170. label.delete(s.sweepLbl)
  1171. line.delete(s.bb50Line)
  1172. for cel in s.fvgCeLines
  1173. line.delete(cel)
  1174. for tl in s.targetLines
  1175. line.delete(tl)
  1176. for lbl in s.targetLabels
  1177. label.delete(lbl)
  1178. array.remove(setups, i)
  1179.  
  1180. f_gc()
  1181.  
  1182. tblPos = i_tablePos == "Bottom Right" ? position.bottom_right :
  1183. i_tablePos == "Bottom Left" ? position.bottom_left :
  1184. i_tablePos == "Top Right" ? position.top_right : position.top_left
  1185.  
  1186. var table infoTbl = na
  1187.  
  1188. f_cell(r, c, txt, tc, bg) =>
  1189. table.cell(infoTbl, c, r, txt, text_color=tc, bgcolor=bg, text_size=size.small, text_halign=text.align_left, text_font_family=font.family_monospace)
  1190.  
  1191. if i_showTable and barstate.islast
  1192. isSimple = i_tableMode == "Simple"
  1193. nRows = isSimple ? 4 : 8
  1194. nCols = 2
  1195. if na(infoTbl)
  1196. infoTbl := table.new(tblPos, nCols, nRows,
  1197. bgcolor = color.new(color.black, 100),
  1198. border_color = color.new(color.black, 100),
  1199. border_width = 0,
  1200. frame_color = color.new(color.black, 100),
  1201. frame_width = 0)
  1202. modelName = i_modelMode + " Model° (" + timeframe.period + "m)"
  1203. table.cell(infoTbl, 0, 0, modelName,
  1204. text_color = chart.fg_color,
  1205. bgcolor = color.new(color.black, 100),
  1206. text_size = size.small,
  1207. text_halign = text.align_left,
  1208. text_font_family = font.family_monospace)
  1209. table.merge_cells(infoTbl, 0, 0, 1, 0)
  1210. f_cell(1, 0, "Sweep:", chart.fg_color, color.new(color.black, 100))
  1211. f_cell(1, 1, lastSweepLabel, chart.fg_color, color.new(color.black, 100))
  1212. sessTxt = i_useTimeFilter ? f_sessString() : "All Hours"
  1213. f_cell(2, 0, "Sessions:", chart.fg_color, color.new(color.black, 100))
  1214. f_cell(2, 1, sessTxt, chart.fg_color, color.new(color.black, 100))
  1215. if isSimple
  1216. f_cell(3, 0, "Ticker:", chart.fg_color, color.new(color.black, 100))
  1217. f_cell(3, 1, syminfo.ticker, chart.fg_color, color.new(color.black, 100))
  1218. else
  1219. biasStr = i_biasMode == "Auto" ? ("Auto (" + (autoBull ? "Bull" : "Bear") + ")") : i_biasMode
  1220. f_cell(3, 0, "Bias:", chart.fg_color, color.new(color.black, 100))
  1221. f_cell(3, 1, biasStr, chart.fg_color, color.new(color.black, 100))
  1222. invalStr = i_swingInval ? "Swing" : "Breaker"
  1223. f_cell(4, 0, "Invalidation:",chart.fg_color, color.new(color.black, 100))
  1224. f_cell(4, 1, invalStr, chart.fg_color, color.new(color.black, 100))
  1225. sizeStr = i_sizeFilter == "Custom" ?
  1226. (i_customMin > 0 ? "Min: " + str.tostring(i_customMin,"#") : "") +
  1227. (i_customMax > 0 ? " Max: " + str.tostring(i_customMax,"#") : "") :
  1228. i_sizeFilter
  1229. if sizeStr == ""
  1230. sizeStr := "All"
  1231. f_cell(5, 0, "Breaker Size:", chart.fg_color, color.new(color.black, 100))
  1232. f_cell(5, 1, sizeStr, chart.fg_color, color.new(color.black, 100))
  1233. srcStr = i_srcAuto == "Automatic" ? "Auto (" + i_srcAType + ")" : "Manual"
  1234. f_cell(6, 0, "Sources:", chart.fg_color, color.new(color.black, 100))
  1235. f_cell(6, 1, srcStr, chart.fg_color, color.new(color.black, 100))
  1236. f_cell(7, 0, "Ticker:", chart.fg_color, color.new(color.black, 100))
  1237. f_cell(7, 1, syminfo.ticker, chart.fg_color, color.new(color.black, 100))
  1238.  
  1239. if i_htf1_show
  1240. htf1.Monitor(global_htf_settings).Update(global_htf_settings, i_htf_offset)
  1241.  
  1242. if i_htf2_show
  1243. int offset_2 = i_htf_offset + (i_htf1_show ? (i_htf1_max * (i_htf_width + i_htf_buffer)) + 4 : 0)
  1244. htf2.Monitor(global_htf_settings).Update(global_htf_settings, offset_2)
Advertisement
Add Comment
Please, Sign In to add comment