ajiim

🎁

Oct 12th, 2026
880
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 42.71 KB | None | 0 0
  1. //@version=6
  2. indicator("TradeAxis DOL Pro", shorttitle = "TradeAxis DOL Pro", overlay = true, max_lines_count = 500, max_boxes_count = 500, max_labels_count = 500, max_bars_back = 1000)
  3.  
  4. const string G_ENGINE = "Engine"
  5. const string G_GATES = "Quality Gates"
  6. const string G_SESS = "Session Settings"
  7. const string G_TARGET = "Active DOL Target"
  8. const string G_HUD = "Heads-Up Display (HUD)"
  9. const string G_LADDER = "Candidate Ladder"
  10. const string G_MS = "Market Structure"
  11. const string G_IFVG = "Inverted FVGs (iFVG)"
  12. const string G_LIQ = "Liquidity Levels"
  13. const string G_COL = "Colors"
  14.  
  15. string styleIn = input.string("Day Trading", "Trading Style", options = ["Scalping", "Day Trading", "Swing"], group = G_ENGINE, tooltip = "Selects the three-timeframe engine stack, HTF background scanning and the volatility math.\nScalping: 1H · 15m · 5m\nDay Trading: 1D · 4H · 1H\nSwing: 1W · 1D · 4H")
  16.  
  17. float minProbIn = input.float(30.0, "Minimum Probability (PoT %)", minval = 0.0, maxval = 100.0, step = 1.0, group = G_GATES, tooltip = "Targets with a Probability of Touch below this value are rejected.")
  18. int minConfIn = input.int(40, "Minimum Confidence", minval = 0, maxval = 100, group = G_GATES, tooltip = "Targets with an internal Conviction score below this value are rejected. Raise it to keep the chart clean in choppy or directionless conditions.")
  19.  
  20. string tzIn = input.string("America/New_York", "Timezone", options = ["America/New_York", "America/Chicago", "America/Denver", "America/Los_Angeles", "America/Sao_Paulo", "Europe/London", "Europe/Berlin", "Europe/Moscow", "Asia/Dubai", "Asia/Kolkata", "Asia/Singapore", "Asia/Hong_Kong", "Asia/Tokyo", "Australia/Sydney", "Etc/UTC", "Exchange"], group = G_SESS, tooltip = "Timezone used to evaluate the session windows below.")
  21. string sessAsiaIn = input.session("2000-0000", "Asia Session", group = G_SESS)
  22. string sessLonIn = input.session("0200-0500", "London Session", group = G_SESS)
  23. string sessNyIn = input.session("0930-1600", "New York Session", group = G_SESS)
  24.  
  25. bool showTargetIn = input.bool(true, "Show Active DOL Target", group = G_TARGET)
  26. bool showTrajIn = input.bool(true, "Trajectory Line", group = G_TARGET, inline = "tg1")
  27. bool showBandIn = input.bool(true, "Tolerance Band", group = G_TARGET, inline = "tg1")
  28. bool showAnchorIn = input.bool(true, "Show Anchor", group = G_TARGET)
  29. int projBarsIn = input.int(24, "Projection Offset (bars)", minval = 5, maxval = 200, group = G_TARGET)
  30.  
  31. bool showHudIn = input.bool(true, "Show HUD", group = G_HUD)
  32. string hudPosIn = input.string("Top Right", "Position", options = ["Top Right", "Middle Right", "Bottom Right", "Top Left", "Middle Left", "Bottom Left", "Top Center", "Bottom Center"], group = G_HUD, inline = "hud")
  33. string hudSizeIn = input.string("Tiny", "Size", options = ["Tiny", "Small", "Normal"], group = G_HUD, inline = "hud")
  34.  
  35. bool showLadderIn = input.bool(false, "Show Candidate Ladder", group = G_LADDER)
  36. int ladderDepth = input.int(3, "Ladder Depth", minval = 1, maxval = 6, group = G_LADDER)
  37.  
  38. bool showBosIn = input.bool(false, "BOS", group = G_MS, inline = "ms")
  39. bool showMssIn = input.bool(false, "MSS", group = G_MS, inline = "ms")
  40. bool showCisdIn = input.bool(false, "CISD", group = G_MS, inline = "ms")
  41.  
  42. bool showIfvgIn = input.bool(true, "Show iFVGs aligned with the active trajectory", group = G_IFVG)
  43.  
  44. bool showLiqIn = input.bool(false, "Show Liquidity Levels", group = G_LIQ)
  45. bool showPdIn = input.bool(true, "PDH / PDL", group = G_LIQ, inline = "lq1")
  46. bool showLonIn = input.bool(true, "LON H / L", group = G_LIQ, inline = "lq1")
  47. bool showAsiaIn = input.bool(true, "ASIA H / L", group = G_LIQ, inline = "lq2")
  48. bool showNyIn = input.bool(true, "NY H / L", group = G_LIQ, inline = "lq2")
  49. bool showGapIn = input.bool(true, "NDOG / NWOG", group = G_LIQ, inline = "lq3")
  50. bool showHtfFvgIn = input.bool(true, "FVG (HTF)", group = G_LIQ, inline = "lq3")
  51. bool showEqIn = input.bool(true, "EQH / EQL", group = G_LIQ, inline = "lq4")
  52.  
  53. color colAccent = input.color(#F2A33A, "DOL / Bull", group = G_COL, inline = "c1")
  54. color colBear = input.color(#E05A4E, "Bear", group = G_COL, inline = "c1")
  55. color colNeutral = input.color(#7D7466, "Neutral", group = G_COL, inline = "c1")
  56. color colIfvg = input.color(#F2A33A, "iFVG", group = G_COL, inline = "c2")
  57. color colAnchor = input.color(#B07A3C, "Anchor", group = G_COL, inline = "c2")
  58. color colLadder = input.color(#A88148, "Ladder", group = G_COL, inline = "c2")
  59. color colPd = input.color(#E3B65E, "PDH/PDL", group = G_COL, inline = "c3")
  60. color colSess = input.color(#A68B5B, "Sessions", group = G_COL, inline = "c3")
  61. color colGap = input.color(#C77B30, "Gaps", group = G_COL, inline = "c3")
  62. color colHtfFvg = input.color(#9C7C48, "HTF FVG", group = G_COL, inline = "c4")
  63. color colEq = input.color(#D9A441, "EQH/EQL", group = G_COL, inline = "c4")
  64. color colHudBg = input.color(#0B0907, "HUD Background", group = G_COL, inline = "c5")
  65. color colHudBorder = input.color(#2C2316, "HUD Border", group = G_COL, inline = "c5")
  66. color colHudText = input.color(#9A8F7E, "HUD Text", group = G_COL, inline = "c6")
  67. color colHudValue = input.color(#F3EBDD, "HUD Price", group = G_COL, inline = "c6")
  68. color colLabelBg = input.color(#17120B, "Label Background", group = G_COL, inline = "c6")
  69.  
  70. const int POOL_MAX = 120
  71. const int ENGINE_LOOKBACK = 400
  72. const int HTF_PIVOT_LEN = 3
  73. const int ATR_LEN = 14
  74. const int CISD_LEN = 20
  75. const int MAX_GAPS = 40
  76. const int MAX_IFVG = 24
  77. const int MAX_MS_OBJ = 60
  78. const int LEVEL_LABEL_BARS = 6
  79. const int MAX_LEVEL_DRAW = 40
  80. const int MAX_IFVG_DRAW = 6
  81. const float BAND_MULT = 0.33
  82. const float MIN_DIST_ATR = 0.15
  83. const float PERSIST_BONUS = 4.0
  84. const float DRIFT_DAMP = 0.5
  85. const float IFVG_MULT = 0.25
  86.  
  87. string styleCode = styleIn == "Scalping" ? "SCALP" : styleIn == "Swing" ? "SWING" : "DAY"
  88. string tf1Raw = styleIn == "Scalping" ? "60" : styleIn == "Swing" ? "W" : "D"
  89. string tf2Raw = styleIn == "Scalping" ? "15" : styleIn == "Swing" ? "D" : "240"
  90. string tf3Raw = styleIn == "Scalping" ? "5" : styleIn == "Swing" ? "240" : "60"
  91. int potHorizon = styleIn == "Scalping" ? 48 : styleIn == "Swing" ? 120 : 96
  92. int volLen = styleIn == "Scalping" ? 34 : styleIn == "Swing" ? 89 : 55
  93. int driftLen = styleIn == "Scalping" ? 13 : styleIn == "Swing" ? 34 : 21
  94. float maxDistATR = styleIn == "Scalping" ? 6.0 : styleIn == "Swing" ? 24.0 : 12.0
  95. float proxK = styleIn == "Scalping" ? 3.0 : styleIn == "Swing" ? 8.0 : 5.0
  96. int msLen = styleIn == "Scalping" ? 3 : styleIn == "Swing" ? 8 : 5
  97. int eqLen = styleIn == "Scalping" ? 3 : styleIn == "Swing" ? 8 : 5
  98. float eqTolMult = styleIn == "Scalping" ? 0.08 : styleIn == "Swing" ? 0.12 : 0.10
  99. float mergeMult = styleIn == "Scalping" ? 0.35 : styleIn == "Swing" ? 0.60 : 0.50
  100. float htfGapMult = styleIn == "Scalping" ? 0.30 : styleIn == "Swing" ? 0.45 : 0.40
  101.  
  102. type Liq
  103. float price
  104. float top
  105. float bot
  106. string kind
  107. string tfLbl
  108. int tier
  109. int side
  110. int bornTime
  111. float depth
  112. string cat
  113. int pol
  114.  
  115. type Gap
  116. float top
  117. float bot
  118. int dir
  119. int bornTime
  120.  
  121. type Cluster
  122. float price
  123. float bot
  124. int dir
  125. string kind
  126. string tfLbl
  127. int tier
  128. float depth
  129. float domW
  130. int bornTime
  131. string key = ""
  132. float conviction = 0.0
  133. float pot = 0.0
  134. float score = 0.0
  135. float distATR = 0.0
  136. bool qualified = false
  137.  
  138. type SessTrack
  139. float hi
  140. float lo
  141. int hiT
  142. int loT
  143.  
  144. f_safeTF(string tf) =>
  145. timeframe.in_seconds(tf) < timeframe.in_seconds(timeframe.period) ? timeframe.period : tf
  146.  
  147. f_tfLabel(string tf) =>
  148. int s = timeframe.in_seconds(tf)
  149. string r = str.tostring(s) + "s"
  150. if s >= 2592000
  151. r := str.tostring(math.round(s / 2628003.0)) + "M"
  152. else if s >= 604800
  153. r := str.tostring(math.round(s / 604800.0)) + "W"
  154. else if s >= 86400
  155. r := str.tostring(math.round(s / 86400.0)) + "D"
  156. else if s >= 3600 and s % 3600 == 0
  157. r := str.tostring(math.round(s / 3600.0)) + "H"
  158. else if s >= 60
  159. r := str.tostring(math.round(s / 60.0)) + "m"
  160. r
  161.  
  162. f_tier(int sec, int s1, int s2, int s3) =>
  163. sec >= s1 ? 3 : sec >= s2 ? 2 : sec >= s3 ? 1 : 0
  164.  
  165. f_ncdf(float x) =>
  166. float ax = math.abs(x)
  167. float t = 1.0 / (1.0 + 0.2316419 * ax)
  168. float d = 0.3989422804014327 * math.exp(-0.5 * ax * ax)
  169. float p = d * t * (0.319381530 + t * (-0.356563782 + t * (1.781477937 + t * (-1.821255978 + t * 1.330274429))))
  170. x >= 0 ? 1.0 - p : p
  171.  
  172. f_pot(float dist, float mu, float sigma, int horizon) =>
  173. float res = 0.0
  174. if na(dist) or na(sigma)
  175. res := 0.0
  176. else if dist <= 0
  177. res := 1.0
  178. else if sigma > 0 and horizon > 0
  179. float m = nz(mu)
  180. float sT = sigma * math.sqrt(horizon)
  181. float a = f_ncdf((-dist + m * horizon) / sT)
  182. float ex = math.min(2.0 * m * dist / (sigma * sigma), 60.0)
  183. float b = math.exp(ex) * f_ncdf((-dist - m * horizon) / sT)
  184. res := math.max(0.0, math.min(1.0, a + b))
  185. res
  186.  
  187. f_alignW(int b, int d) =>
  188. b == d ? 1.0 : b == 0 ? 0.5 : 0.0
  189.  
  190. f_bar(float v, int n) =>
  191. int filled = math.round(math.max(0.0, math.min(100.0, nz(v))) / 100.0 * n)
  192. string s = ""
  193. for i = 1 to n
  194. s := s + (i <= filled ? "█" : "░")
  195. s
  196.  
  197. f_grade(float s) =>
  198. s >= 72.0 ? "A+" : s >= 55.0 ? "A" : s >= 42.0 ? "B" : "C"
  199.  
  200. f_biasTxt(int b) =>
  201. b == 1 ? "BULL" : b == -1 ? "BEAR" : "NEUTRAL"
  202.  
  203. f_biasCol(int b, color bull, color bear, color neu) =>
  204. b == 1 ? bull : b == -1 ? bear : neu
  205.  
  206. f_pos(string p) =>
  207. switch p
  208. "Top Left" => position.top_left
  209. "Top Center" => position.top_center
  210. "Middle Left" => position.middle_left
  211. "Middle Right" => position.middle_right
  212. "Bottom Left" => position.bottom_left
  213. "Bottom Center" => position.bottom_center
  214. "Bottom Right" => position.bottom_right
  215. => position.top_right
  216.  
  217. f_size(string s) =>
  218. switch s
  219. "Small" => size.small
  220. "Normal" => size.normal
  221. => size.tiny
  222.  
  223. f_addLevel(array<Liq> arr, float price, float top, float bot, string kind, string tfLbl, int tier, int side, int bornT, float depth, string cat, int pol) =>
  224. bool dup = false
  225. for lq in arr
  226. if lq.kind == kind and lq.tfLbl == tfLbl and math.abs(lq.price - price) < syminfo.mintick * 0.5
  227. dup := true
  228. break
  229. if not dup and not na(price)
  230. arr.push(Liq.new(price, top, bot, kind, tfLbl, tier, side, bornT, depth, cat, pol))
  231. if arr.size() > POOL_MAX
  232. arr.shift()
  233. not dup
  234.  
  235. f_removeKind(array<Liq> arr, string kind) =>
  236. int n = arr.size()
  237. if n > 0
  238. for i = n - 1 to 0
  239. if arr.get(i).kind == kind
  240. arr.remove(i)
  241. n
  242.  
  243. f_addEq(array<Liq> arr, float lvl, string kind, string tfLbl, int tier, int side, int bornT, float tolPts) =>
  244. bool merged = false
  245. for lq in arr
  246. if lq.kind == kind and lq.tfLbl == tfLbl and math.abs(lq.price - lvl) <= tolPts
  247. lq.price := side == 1 ? math.max(lq.price, lvl) : math.min(lq.price, lvl)
  248. lq.top := lq.price
  249. lq.bot := lq.price
  250. lq.depth := lq.depth + 0.4
  251. merged := true
  252. break
  253. if not merged
  254. f_addLevel(arr, lvl, lvl, lvl, kind, tfLbl, tier, side, bornT, 2.4, "EQ", 0)
  255. merged
  256.  
  257. f_sessLevels(array<Liq> arr, SessTrack s, bool ended, string nm, float dpth, int tr) =>
  258. if ended and not na(s.hi)
  259. f_removeKind(arr, nm + " H")
  260. f_removeKind(arr, nm + " L")
  261. f_addLevel(arr, s.hi, s.hi, s.hi, nm + " H", "SESS", tr, 1, s.hiT, dpth, "SESS", 0)
  262. f_addLevel(arr, s.lo, s.lo, s.lo, nm + " L", "SESS", tr, -1, s.loT, dpth, "SESS", 0)
  263. ended
  264.  
  265. f_ingestHtf(array<Liq> arr, bool isNew, bool bullG, float bTop, float bBot, bool bearG, float sTop, float sBot, int midT, float eqh, int eqhT, float eql, int eqlT, float hAtr, float fbAtr, string lbl, int tier, float eqTol) =>
  266. if isNew
  267. float a = math.max(nz(hAtr, fbAtr), syminfo.mintick)
  268. if bullG and not na(bTop) and not na(bBot)
  269. f_addLevel(arr, (bTop + bBot) / 2.0, bTop, bBot, "FVG", lbl, tier, 0, midT, 1.5 + math.min(1.0, (bTop - bBot) / a), "FVG", 1)
  270. if bearG and not na(sTop) and not na(sBot)
  271. f_addLevel(arr, (sTop + sBot) / 2.0, sTop, sBot, "FVG", lbl, tier, 0, midT, 1.5 + math.min(1.0, (sTop - sBot) / a), "FVG", -1)
  272. if not na(eqh) and not na(eqhT)
  273. f_addEq(arr, eqh, "EQH", lbl, tier, 1, eqhT, eqTol * a)
  274. if not na(eql) and not na(eqlT)
  275. f_addEq(arr, eql, "EQL", lbl, tier, -1, eqlT, eqTol * a)
  276. isNew
  277.  
  278. f_obstacles(Cluster c, array<Cluster> cl, array<Gap> ig, array<Gap> cg, float px) =>
  279. float n = 0.0
  280. float lo = math.min(px, c.price)
  281. float hi = math.max(px, c.price)
  282. for g in ig
  283. float mid = (g.top + g.bot) / 2.0
  284. if g.dir == -c.dir and mid > lo and mid < hi
  285. n := n + 1.0
  286. for g in cg
  287. float mid = (g.top + g.bot) / 2.0
  288. if g.dir == -c.dir and mid > lo and mid < hi
  289. n := n + 0.5
  290. for o in cl
  291. if o.dir == c.dir and o.tier > c.tier and o.price > lo and o.price < hi
  292. n := n + 1.0
  293. n
  294.  
  295. f_trimLines(array<line> a, int maxN) =>
  296. while a.size() > maxN
  297. line.delete(a.shift())
  298. a.size()
  299.  
  300. f_trimLabels(array<label> a, int maxN) =>
  301. while a.size() > maxN
  302. label.delete(a.shift())
  303. a.size()
  304.  
  305. method track(SessTrack s, bool inS, bool wasIn) =>
  306. if inS and not wasIn
  307. s.hi := high
  308. s.lo := low
  309. s.hiT := time
  310. s.loT := time
  311. else if inS
  312. if na(s.hi) or high > s.hi
  313. s.hi := high
  314. s.hiT := time
  315. if na(s.lo) or low < s.lo
  316. s.lo := low
  317. s.loT := time
  318. s
  319.  
  320. f_htfEngine(int pLen, float gapMult, float eqTol) =>
  321. float atrH = ta.atr(14)
  322. float ph = ta.pivothigh(high, pLen, pLen)
  323. float pl = ta.pivotlow(low, pLen, pLen)
  324. var float sH = na
  325. var float sL = na
  326. var int bias = 0
  327. if not na(ph)
  328. sH := ph
  329. if not na(pl)
  330. sL := pl
  331. if not na(sH) and close > sH
  332. bias := 1
  333. sH := na
  334. else if not na(sL) and close < sL
  335. bias := -1
  336. sL := na
  337. var float lastPH = na
  338. var int lastPHT = na
  339. var float lastPL = na
  340. var int lastPLT = na
  341. float eqh = na
  342. int eqhT = na
  343. float eql = na
  344. int eqlT = na
  345. float tolH = eqTol * nz(atrH, high - low)
  346. if not na(lastPH) and high > lastPH + tolH
  347. lastPH := na
  348. if not na(lastPL) and low < lastPL - tolH
  349. lastPL := na
  350. if not na(ph)
  351. if not na(lastPH) and math.abs(ph - lastPH) <= tolH
  352. eqh := math.max(ph, lastPH)
  353. eqhT := lastPHT
  354. lastPH := ph
  355. lastPHT := time[pLen]
  356. if not na(pl)
  357. if not na(lastPL) and math.abs(pl - lastPL) <= tolH
  358. eql := math.min(pl, lastPL)
  359. eqlT := lastPLT
  360. lastPL := pl
  361. lastPLT := time[pLen]
  362. float gapRef = nz(atrH, high - low)
  363. bool bullG = low > high[2] and (low - high[2]) >= gapMult * gapRef
  364. bool bearG = high < low[2] and (low[2] - high) >= gapMult * gapRef
  365. float bTop = low
  366. float bBot = high[2]
  367. float sTop = low[2]
  368. float sBot = high
  369. int midT = time[1]
  370. [atrH[1], bias[1], bullG[1], bTop[1], bBot[1], bearG[1], sTop[1], sBot[1], midT[1], eqh[1], eqhT[1], eql[1], eqlT[1], time[1]]
  371.  
  372. var string tf1 = f_safeTF(tf1Raw)
  373. var string tf2 = f_safeTF(tf2Raw)
  374. var string tf3 = f_safeTF(tf3Raw)
  375. var int tf1Sec = timeframe.in_seconds(tf1)
  376. var int tf2Sec = timeframe.in_seconds(tf2)
  377. var int tf3Sec = timeframe.in_seconds(tf3)
  378. var string tf1Lbl = f_tfLabel(tf1)
  379. var string tf2Lbl = f_tfLabel(tf2)
  380. var string tf3Lbl = f_tfLabel(tf3)
  381. var string chartLbl = f_tfLabel(timeframe.period)
  382. var int tier1 = f_tier(tf1Sec, tf1Sec, tf2Sec, tf3Sec)
  383. var int tier2 = f_tier(tf2Sec, tf1Sec, tf2Sec, tf3Sec)
  384. var int tier3 = f_tier(tf3Sec, tf1Sec, tf2Sec, tf3Sec)
  385. var int tierC = f_tier(timeframe.in_seconds(), tf1Sec, tf2Sec, tf3Sec)
  386. var int tierD = f_tier(86400, tf1Sec, tf2Sec, tf3Sec)
  387. var int tierW = f_tier(604800, tf1Sec, tf2Sec, tf3Sec)
  388. var int tierSess = f_tier(14400, tf1Sec, tf2Sec, tf3Sec)
  389. var string tzUse = tzIn == "Exchange" ? syminfo.timezone : tzIn
  390.  
  391. float atrRaw = ta.atr(ATR_LEN)
  392. float atrC = math.max(nz(atrRaw, high - low), syminfo.mintick)
  393. float chg = close - nz(close[1], close)
  394. float sigma = math.max(nz(ta.stdev(chg, volLen)), syminfo.mintick)
  395. float mu = nz(ta.sma(chg, driftLen)) * DRIFT_DAMP
  396. int driftSign = mu > 0 ? 1 : mu < 0 ? -1 : 0
  397.  
  398. [h1Atr, h1Bias, h1BullG, h1BTop, h1BBot, h1BearG, h1STop, h1SBot, h1MidT, h1Eqh, h1EqhT, h1Eql, h1EqlT, h1T] = request.security(syminfo.tickerid, tf1, f_htfEngine(HTF_PIVOT_LEN, htfGapMult, eqTolMult), lookahead = barmerge.lookahead_on)
  399. [h2Atr, h2Bias, h2BullG, h2BTop, h2BBot, h2BearG, h2STop, h2SBot, h2MidT, h2Eqh, h2EqhT, h2Eql, h2EqlT, h2T] = request.security(syminfo.tickerid, tf2, f_htfEngine(HTF_PIVOT_LEN, htfGapMult, eqTolMult), lookahead = barmerge.lookahead_on)
  400. [h3Atr, h3Bias, h3BullG, h3BTop, h3BBot, h3BearG, h3STop, h3SBot, h3MidT, h3Eqh, h3EqhT, h3Eql, h3EqlT, h3T] = request.security(syminfo.tickerid, tf3, f_htfEngine(HTF_PIVOT_LEN, htfGapMult, eqTolMult), lookahead = barmerge.lookahead_on)
  401.  
  402. bool h1New = not na(h1T) and (na(h1T[1]) or h1T != h1T[1])
  403. bool h2New = not na(h2T) and (na(h2T[1]) or h2T != h2T[1])
  404. bool h3New = not na(h3T) and (na(h3T[1]) or h3T != h3T[1])
  405.  
  406. bool isIntra = timeframe.isintraday
  407. bool inAsia = isIntra and not na(time(timeframe.period, sessAsiaIn, tzUse))
  408. bool inLon = isIntra and not na(time(timeframe.period, sessLonIn, tzUse))
  409. bool inNy = isIntra and not na(time(timeframe.period, sessNyIn, tzUse))
  410. bool wasAsia = inAsia[1]
  411. bool wasLon = inLon[1]
  412. bool wasNy = inNy[1]
  413.  
  414. var SessTrack stAsia = SessTrack.new()
  415. var SessTrack stLon = SessTrack.new()
  416. var SessTrack stNy = SessTrack.new()
  417. stAsia.track(inAsia, wasAsia)
  418. stLon.track(inLon, wasLon)
  419. stNy.track(inNy, wasNy)
  420. bool asiaEnd = wasAsia and not inAsia
  421. bool lonEnd = wasLon and not inLon
  422. bool nyEnd = wasNy and not inNy
  423.  
  424. bool newDay = timeframe.change("D")
  425. bool newWeek = timeframe.change("W")
  426.  
  427. float cPH = ta.pivothigh(high, eqLen, eqLen)
  428. float cPL = ta.pivotlow(low, eqLen, eqLen)
  429. float msPH = ta.pivothigh(high, msLen, msLen)
  430. float msPL = ta.pivotlow(low, msLen, msLen)
  431.  
  432. bool cBullGap = low > high[2] and (low - high[2]) >= IFVG_MULT * atrC
  433. bool cBearGap = high < low[2] and (low[2] - high) >= IFVG_MULT * atrC
  434.  
  435. bool candleBull = close > open
  436. bool candleBear = close < open
  437. bool prevBull = close[1] > open[1]
  438. bool prevBear = close[1] < open[1]
  439. float hhN = ta.highest(high, CISD_LEN)
  440. float llN = ta.lowest(low, CISD_LEN)
  441. bool newHighN = high >= nz(hhN[1], high)
  442. bool newLowN = low <= nz(llN[1], low)
  443.  
  444. var array<Liq> pool = array.new<Liq>()
  445. var array<Gap> cGaps = array.new<Gap>()
  446. var array<Gap> iGaps = array.new<Gap>()
  447. var array<line> msLines = array.new<line>()
  448. var array<label> msLabels = array.new<label>()
  449. var array<line> dynLines = array.new<line>()
  450. var array<box> dynBoxes = array.new<box>()
  451. var array<label> dynLabels = array.new<label>()
  452. var array<Cluster> ladder = array.new<Cluster>()
  453. var Cluster activeC = na
  454.  
  455. var string tgtKey = ""
  456. var int tgtSinceBar = na
  457. var int tgtSinceTime = na
  458. var float tgtPrice = na
  459. var string tgtKind = ""
  460. var string lastSweepName = ""
  461. var int lastSweepDir = 0
  462.  
  463. var float dHi = na
  464. var int dHiT = na
  465. var float dLo = na
  466. var int dLoT = na
  467.  
  468. var float cLastPH = na
  469. var int cLastPHT = na
  470. var float cLastPL = na
  471. var int cLastPLT = na
  472.  
  473. var float swH = na
  474. var int swHT = na
  475. var float swL = na
  476. var int swLT = na
  477. var int msTrend = 0
  478.  
  479. var float curBullOpen = na
  480. var int curBullT = na
  481. var float curBearOpen = na
  482. var int curBearT = na
  483. var float bullRunOpen = na
  484. var int bullRunT = na
  485. var float bearRunOpen = na
  486. var int bearRunT = na
  487. var int deliveryState = 0
  488.  
  489. bool bosBullEvt = false
  490. bool bosBearEvt = false
  491. bool mssBullEvt = false
  492. bool mssBearEvt = false
  493. bool cisdBullEvt = false
  494. bool cisdBearEvt = false
  495. bool newTgtEvt = false
  496. bool tgtHitEvt = false
  497. string hitMsg = ""
  498.  
  499. if barstate.isconfirmed
  500. float tolEq = eqTolMult * atrC
  501.  
  502. if newDay
  503. if not na(dHi) and bar_index > 0
  504. f_removeKind(pool, "PDH")
  505. f_removeKind(pool, "PDL")
  506. f_addLevel(pool, dHi, dHi, dHi, "PDH", "1D", tierD, 1, dHiT, 3.0, "PD", 0)
  507. f_addLevel(pool, dLo, dLo, dLo, "PDL", "1D", tierD, -1, dLoT, 3.0, "PD", 0)
  508. dHi := high
  509. dHiT := time
  510. dLo := low
  511. dLoT := time
  512. else
  513. if na(dHi) or high > dHi
  514. dHi := high
  515. dHiT := time
  516. if na(dLo) or low < dLo
  517. dLo := low
  518. dLoT := time
  519.  
  520. if newWeek and not na(close[1]) and timeframe.in_seconds() < 604800
  521. float gTop = math.max(open, close[1])
  522. float gBot = math.min(open, close[1])
  523. if gTop - gBot >= syminfo.mintick
  524. f_removeKind(pool, "NWOG")
  525. f_addLevel(pool, (gTop + gBot) / 2.0, gTop, gBot, "NWOG", "1W", tierW, 0, time, 2.6, "GAP", 0)
  526. else if newDay and isIntra and not na(close[1])
  527. float gTop = math.max(open, close[1])
  528. float gBot = math.min(open, close[1])
  529. if gTop - gBot >= syminfo.mintick
  530. f_removeKind(pool, "NDOG")
  531. f_addLevel(pool, (gTop + gBot) / 2.0, gTop, gBot, "NDOG", "1D", tierD, 0, time, 1.8, "GAP", 0)
  532.  
  533. f_sessLevels(pool, stAsia, asiaEnd, "ASIA", 1.8, tierSess)
  534. f_sessLevels(pool, stLon, lonEnd, "LON", 2.2, tierSess)
  535. f_sessLevels(pool, stNy, nyEnd, "NY", 2.0, tierSess)
  536.  
  537. if not na(cLastPH) and high > cLastPH + tolEq
  538. cLastPH := na
  539. if not na(cLastPL) and low < cLastPL - tolEq
  540. cLastPL := na
  541. if not na(cPH)
  542. if not na(cLastPH) and math.abs(cPH - cLastPH) <= tolEq
  543. f_addEq(pool, math.max(cPH, cLastPH), "EQH", chartLbl, tierC, 1, cLastPHT, tolEq)
  544. cLastPH := cPH
  545. cLastPHT := time[eqLen]
  546. if not na(cPL)
  547. if not na(cLastPL) and math.abs(cPL - cLastPL) <= tolEq
  548. f_addEq(pool, math.min(cPL, cLastPL), "EQL", chartLbl, tierC, -1, cLastPLT, tolEq)
  549. cLastPL := cPL
  550. cLastPLT := time[eqLen]
  551.  
  552. f_ingestHtf(pool, h1New, h1BullG, h1BTop, h1BBot, h1BearG, h1STop, h1SBot, h1MidT, h1Eqh, h1EqhT, h1Eql, h1EqlT, h1Atr, atrC, tf1Lbl, tier1, eqTolMult)
  553. f_ingestHtf(pool, h2New, h2BullG, h2BTop, h2BBot, h2BearG, h2STop, h2SBot, h2MidT, h2Eqh, h2EqhT, h2Eql, h2EqlT, h2Atr, atrC, tf2Lbl, tier2, eqTolMult)
  554. f_ingestHtf(pool, h3New, h3BullG, h3BTop, h3BBot, h3BearG, h3STop, h3SBot, h3MidT, h3Eqh, h3EqhT, h3Eql, h3EqlT, h3Atr, atrC, tf3Lbl, tier3, eqTolMult)
  555.  
  556. float hiRef = math.max(high, nz(close[1], high))
  557. float loRef = math.min(low, nz(close[1], low))
  558. int nPool = pool.size()
  559. if nPool > 0
  560. for i = nPool - 1 to 0
  561. Liq lq = pool.get(i)
  562. bool fresh = lq.bornTime >= time
  563. float hR = fresh ? high : hiRef
  564. float lR = fresh ? low : loRef
  565. bool hit = lq.side == 1 ? high >= lq.price : lq.side == -1 ? low <= lq.price : (hR >= lq.price and lR <= lq.price)
  566. if hit
  567. if lq.cat == "SESS"
  568. lastSweepName := str.replace_all(lq.kind, " ", "-")
  569. lastSweepDir := lq.side
  570. pool.remove(i)
  571.  
  572. if cBullGap
  573. cGaps.push(Gap.new(low, high[2], 1, time[1]))
  574. if cBearGap
  575. cGaps.push(Gap.new(low[2], high, -1, time[1]))
  576. int nG = cGaps.size()
  577. if nG > 0
  578. for i = nG - 1 to 0
  579. Gap g = cGaps.get(i)
  580. if g.dir == 1 and close < g.bot
  581. g.dir := -1
  582. iGaps.push(g)
  583. cGaps.remove(i)
  584. else if g.dir == -1 and close > g.top
  585. g.dir := 1
  586. iGaps.push(g)
  587. cGaps.remove(i)
  588. while cGaps.size() > MAX_GAPS
  589. cGaps.shift()
  590. int nI = iGaps.size()
  591. if nI > 0
  592. for i = nI - 1 to 0
  593. Gap g = iGaps.get(i)
  594. if (g.dir == 1 and close < g.bot) or (g.dir == -1 and close > g.top)
  595. iGaps.remove(i)
  596. while iGaps.size() > MAX_IFVG
  597. iGaps.shift()
  598.  
  599. if not na(msPH)
  600. swH := msPH
  601. swHT := time[msLen]
  602. if not na(msPL)
  603. swL := msPL
  604. swLT := time[msLen]
  605. if not na(swH) and close > swH and candleBull
  606. bool isMss = msTrend == -1
  607. if isMss
  608. mssBullEvt := true
  609. else
  610. bosBullEvt := true
  611. if (isMss and showMssIn) or (not isMss and showBosIn)
  612. msLines.push(line.new(swHT, swH, time, swH, xloc.bar_time, extend.none, colAccent, isMss ? line.style_solid : line.style_dashed, 1))
  613. msLabels.push(label.new(math.round((swHT + time) / 2), swH, isMss ? "MSS" : "BOS", xloc.bar_time, yloc.price, color.new(color.black, 100), label.style_label_down, colAccent, size.tiny))
  614. msTrend := 1
  615. swH := na
  616. if not na(swL) and close < swL and candleBear
  617. bool isMss = msTrend == 1
  618. if isMss
  619. mssBearEvt := true
  620. else
  621. bosBearEvt := true
  622. if (isMss and showMssIn) or (not isMss and showBosIn)
  623. msLines.push(line.new(swLT, swL, time, swL, xloc.bar_time, extend.none, colBear, isMss ? line.style_solid : line.style_dashed, 1))
  624. msLabels.push(label.new(math.round((swLT + time) / 2), swL, isMss ? "MSS" : "BOS", xloc.bar_time, yloc.price, color.new(color.black, 100), label.style_label_up, colBear, size.tiny))
  625. msTrend := -1
  626. swL := na
  627.  
  628. if deliveryState <= 0 and candleBull and not na(bearRunOpen) and close > bearRunOpen
  629. cisdBullEvt := true
  630. deliveryState := 1
  631. if showCisdIn
  632. msLines.push(line.new(bearRunT, bearRunOpen, time, bearRunOpen, xloc.bar_time, extend.none, colAccent, line.style_dotted, 1))
  633. msLabels.push(label.new(time, bearRunOpen, "CISD", xloc.bar_time, yloc.price, color.new(color.black, 100), label.style_label_left, colAccent, size.tiny))
  634. bearRunOpen := na
  635. if deliveryState >= 0 and candleBear and not na(bullRunOpen) and close < bullRunOpen
  636. cisdBearEvt := true
  637. deliveryState := -1
  638. if showCisdIn
  639. msLines.push(line.new(bullRunT, bullRunOpen, time, bullRunOpen, xloc.bar_time, extend.none, colBear, line.style_dotted, 1))
  640. msLabels.push(label.new(time, bullRunOpen, "CISD", xloc.bar_time, yloc.price, color.new(color.black, 100), label.style_label_left, colBear, size.tiny))
  641. bullRunOpen := na
  642. if candleBear
  643. if not prevBear
  644. curBearOpen := open
  645. curBearT := time
  646. if newLowN
  647. bearRunOpen := curBearOpen
  648. bearRunT := curBearT
  649. if candleBull
  650. if not prevBull
  651. curBullOpen := open
  652. curBullT := time
  653. if newHighN
  654. bullRunOpen := curBullOpen
  655. bullRunT := curBullT
  656. f_trimLines(msLines, MAX_MS_OBJ)
  657. f_trimLabels(msLabels, MAX_MS_OBJ)
  658.  
  659. if not na(tgtPrice)
  660. if hiRef >= tgtPrice and loRef <= tgtPrice
  661. tgtHitEvt := true
  662. hitMsg := "TradeAxis DOL Pro | DOL reached: " + tgtKind + " @ " + str.tostring(tgtPrice, format.mintick) + " on " + syminfo.ticker
  663.  
  664. bool runEngine = bar_index > ATR_LEN and (barstate.islast or (barstate.isconfirmed and bar_index >= last_bar_index - ENGINE_LOOKBACK))
  665. if runEngine
  666. array<Cluster> clusters = array.new<Cluster>()
  667. array<float> candPx = array.new<float>()
  668. array<int> candId = array.new<int>()
  669. float mergeTol = mergeMult * atrC
  670. array<float> scores = array.new<float>()
  671.  
  672. for [i, lq] in pool
  673. float dA = math.abs(lq.price - close) / atrC
  674. if dA >= MIN_DIST_ATR and dA <= maxDistATR
  675. candPx.push(lq.price)
  676. candId.push(i)
  677.  
  678. if candPx.size() > 0
  679. array<int> sortIdx = array.sort_indices(candPx, order.ascending)
  680. Cluster cur = na
  681. for k = 0 to sortIdx.size() - 1
  682. Liq lq = pool.get(candId.get(sortIdx.get(k)))
  683. int d = lq.price > close ? 1 : -1
  684. float w = lq.depth * (1.0 + 0.25 * lq.tier)
  685. bool join = false
  686. if not na(cur)
  687. join := cur.dir == d and (lq.price - cur.bot) <= mergeTol
  688. if join
  689. cur.depth := cur.depth + w
  690. cur.tier := math.max(cur.tier, lq.tier)
  691. cur.bornTime := math.min(cur.bornTime, lq.bornTime)
  692. if w > cur.domW
  693. cur.price := lq.price
  694. cur.kind := lq.kind
  695. cur.tfLbl := lq.tfLbl
  696. cur.domW := w
  697. else
  698. cur := Cluster.new(price = lq.price, bot = lq.price, dir = d, kind = lq.kind, tfLbl = lq.tfLbl, tier = lq.tier, depth = w, domW = w, bornTime = lq.bornTime)
  699. clusters.push(cur)
  700.  
  701. int nCl = clusters.size()
  702. if nCl > 0
  703. for c in clusters
  704. c.key := c.kind + "|" + c.tfLbl + "|" + str.tostring(c.price)
  705. float dist = math.abs(c.price - close)
  706. c.distATR := dist / atrC
  707. float sDepth = 25.0 * (1.0 - math.exp(-c.depth / 4.0))
  708. float sAlign = 25.0 * (0.45 * f_alignW(nz(h1Bias), c.dir) + 0.35 * f_alignW(nz(h2Bias), c.dir) + 0.20 * f_alignW(nz(h3Bias), c.dir))
  709. float sFlow = 20.0 * (0.40 * f_alignW(msTrend, c.dir) + 0.30 * f_alignW(deliveryState, c.dir) + 0.30 * f_alignW(driftSign, c.dir))
  710. float sProx = 15.0 * math.exp(-c.distATR / proxK)
  711. float sPath = 15.0 / (1.0 + f_obstacles(c, clusters, iGaps, cGaps, close))
  712. c.conviction := math.min(100.0, math.round(sDepth + sAlign + sFlow + sProx + sPath))
  713. c.pot := 100.0 * f_pot(dist, mu * c.dir, sigma, potHorizon)
  714. c.score := 0.55 * c.conviction + 0.45 * c.pot + (c.key == tgtKey ? PERSIST_BONUS : 0.0)
  715. c.qualified := c.pot >= minProbIn and c.conviction >= minConfIn
  716. scores.push(c.score)
  717.  
  718. activeC := na
  719. ladder.clear()
  720. if nCl > 0
  721. array<int> rankIdx = array.sort_indices(scores, order.descending)
  722. for k = 0 to rankIdx.size() - 1
  723. Cluster rc = clusters.get(rankIdx.get(k))
  724. if rc.qualified
  725. if na(activeC)
  726. activeC := rc
  727. else if ladder.size() < ladderDepth
  728. ladder.push(rc)
  729.  
  730. if not na(activeC)
  731. if activeC.key != tgtKey
  732. tgtKey := activeC.key
  733. tgtSinceBar := bar_index
  734. tgtSinceTime := time
  735. newTgtEvt := barstate.isconfirmed
  736. tgtPrice := activeC.price
  737. tgtKind := activeC.kind
  738. else
  739. tgtKey := ""
  740. tgtPrice := na
  741. tgtKind := ""
  742.  
  743. bool hasT = not na(activeC)
  744. string hKind = ""
  745. string hTf = ""
  746. float hPx = na
  747. float hPot = na
  748. float hConv = na
  749. float hDistA = na
  750. float hScore = na
  751. int hDir = 0
  752. if hasT
  753. hKind := activeC.kind
  754. hTf := activeC.tfLbl
  755. hPx := activeC.price
  756. hPot := activeC.pot
  757. hConv := activeC.conviction
  758. hDistA := activeC.distATR
  759. hScore := activeC.score
  760. hDir := activeC.dir
  761.  
  762. if barstate.islast
  763. for l in dynLines
  764. line.delete(l)
  765. dynLines.clear()
  766. for b in dynBoxes
  767. box.delete(b)
  768. dynBoxes.clear()
  769. for lb in dynLabels
  770. label.delete(lb)
  771. dynLabels.clear()
  772.  
  773. int barMs = timeframe.in_seconds() * 1000
  774. int futT = time + projBarsIn * barMs
  775. int lvlT = time + LEVEL_LABEL_BARS * barMs
  776. float tol = atrC * BAND_MULT
  777.  
  778. if showLiqIn
  779. int drawn = 0
  780. for lq in pool
  781. if drawn >= MAX_LEVEL_DRAW
  782. break
  783. bool want = lq.cat == "PD" ? showPdIn : lq.cat == "GAP" ? showGapIn : lq.cat == "FVG" ? showHtfFvgIn : lq.cat == "EQ" ? showEqIn : lq.cat == "SESS" ? (str.startswith(lq.kind, "LON") ? showLonIn : str.startswith(lq.kind, "ASIA") ? showAsiaIn : showNyIn) : false
  784. float dA = math.abs(lq.price - close) / atrC
  785. bool clash = hasT and showTargetIn and math.abs(lq.price - nz(hPx)) <= tol
  786. if want and dA <= maxDistATR * 1.5 and not clash
  787. drawn += 1
  788. color lc = lq.cat == "PD" ? colPd : lq.cat == "GAP" ? colGap : lq.cat == "FVG" ? colHtfFvg : lq.cat == "EQ" ? colEq : colSess
  789. string txt = lq.cat == "FVG" ? "FVG " + lq.tfLbl : lq.cat == "EQ" ? lq.kind + " " + lq.tfLbl : lq.kind
  790. if lq.cat == "FVG" or lq.cat == "GAP"
  791. dynBoxes.push(box.new(lq.bornTime, lq.top, lvlT, lq.bot, border_color = color.new(lc, 45), border_width = 1, border_style = line.style_dashed, xloc = xloc.bar_time, bgcolor = color.new(lc, 90), text = txt, text_size = size.tiny, text_color = color.new(lc, 10), text_halign = text.align_right, text_valign = text.align_center))
  792. else
  793. string st = lq.cat == "PD" ? line.style_solid : lq.cat == "SESS" ? line.style_dashed : line.style_dotted
  794. dynLines.push(line.new(lq.bornTime, lq.price, lvlT, lq.price, xloc.bar_time, extend.none, color.new(lc, 25), st, 1))
  795. dynLabels.push(label.new(lvlT, lq.price, txt, xloc.bar_time, yloc.price, color.new(color.black, 100), label.style_label_left, lc, size.tiny))
  796.  
  797. if showIfvgIn and hasT
  798. int shown = 0
  799. int nI2 = iGaps.size()
  800. if nI2 > 0
  801. for i = nI2 - 1 to 0
  802. Gap g = iGaps.get(i)
  803. bool aligned = g.dir == hDir and (g.dir == 1 ? g.bot < close : g.top > close)
  804. if aligned and shown < MAX_IFVG_DRAW
  805. shown += 1
  806. dynBoxes.push(box.new(g.bornTime, g.top, futT, g.bot, border_color = color.new(colIfvg, 25), border_width = 1, xloc = xloc.bar_time, bgcolor = color.new(colIfvg, 86)))
  807.  
  808. if showLadderIn and ladder.size() > 0
  809. for [i, lc2] in ladder
  810. int leftT = math.max(lc2.bornTime, time - 150 * barMs)
  811. string ltxt = str.tostring(i + 2) + ". " + lc2.kind + " · " + lc2.tfLbl + " · " + str.tostring(lc2.pot, "0.0") + "%"
  812. dynBoxes.push(box.new(leftT, lc2.price + tol * 0.5, futT, lc2.price - tol * 0.5, border_color = color.new(colLadder, 40), border_width = 1, border_style = line.style_dotted, xloc = xloc.bar_time, bgcolor = color.new(colLadder, 93), text = ltxt, text_size = size.tiny, text_color = color.new(colLadder, 15), text_halign = text.align_center, text_valign = text.align_center))
  813.  
  814. if showAnchorIn and hasT
  815. Liq anc = na
  816. float bestD = na
  817. for lq in pool
  818. bool okSide = hDir == 1 ? lq.price < close : lq.price > close
  819. if lq.cat == "FVG" and lq.pol == hDir and okSide
  820. float dd = math.abs(close - lq.price)
  821. if na(bestD) or dd < bestD
  822. bestD := dd
  823. anc := lq
  824. if not na(anc)
  825. int aEnd = time + math.round(projBarsIn * 0.6) * barMs
  826. dynLines.push(line.new(time - 30 * barMs, anc.price, aEnd, anc.price, xloc.bar_time, extend.none, color.new(colAnchor, 20), line.style_dotted, 1))
  827. dynLabels.push(label.new(aEnd, anc.price, "+ ANCHOR " + (anc.pol == 1 ? "BFVG" : "SFVG"), xloc.bar_time, yloc.price, colLabelBg, label.style_label_left, colAnchor, size.tiny))
  828.  
  829. if showTargetIn and hasT
  830. int leftT = na(tgtSinceTime) ? time : tgtSinceTime
  831. int age = na(tgtSinceBar) ? 0 : bar_index - tgtSinceBar
  832. string bTxt = "1. " + hKind + " · " + str.tostring(age) + " bars"
  833. dynBoxes.push(box.new(leftT, hPx + tol, futT, hPx - tol, border_color = showBandIn ? color.new(colAccent, 35) : color.new(colAccent, 100), border_width = 1, border_style = line.style_dashed, xloc = xloc.bar_time, bgcolor = showBandIn ? color.new(colAccent, 85) : color.new(colAccent, 100), text = bTxt, text_size = size.tiny, text_color = color.new(colAccent, 25), text_halign = text.align_center, text_valign = text.align_center))
  834. dynLines.push(line.new(leftT, hPx, futT, hPx, xloc.bar_time, extend.none, color.new(colAccent, 10), line.style_solid, 2))
  835. if showTrajIn
  836. dynLines.push(line.new(time, close, futT, hPx, xloc.bar_time, extend.none, color.new(colAccent, 30), line.style_dashed, 1))
  837. string glyph = age > 0 ? "↻" : "✦"
  838. string lTxt = "◆ " + f_grade(hScore) + " " + hKind + " " + glyph + "\n" + hTf + " " + str.tostring(hPot, "0.0") + "%"
  839. dynLabels.push(label.new(futT, hPx, lTxt, xloc.bar_time, yloc.price, colLabelBg, label.style_label_left, colAccent, size.normal, text.align_left))
  840.  
  841. var table hud = table.new(f_pos(hudPosIn), 3, 11, bgcolor = colHudBg, frame_color = colHudBorder, frame_width = 1, border_color = colHudBorder, border_width = 1)
  842. varip bool hudMerged = false
  843.  
  844. if barstate.islast and showHudIn
  845. string sz = f_size(hudSizeIn)
  846. color hdBg = color.new(colAccent, 93)
  847. string tgtTxt = hasT ? "◆ " + f_grade(hScore) + " " + hKind : "◇ — NO DOL"
  848. string pxTxt = hasT ? str.tostring(hPx, format.mintick) : "—"
  849. string distTxt = hasT ? str.tostring(hDistA, "0.00") + " × " + chartLbl + " ATR " + (hDir == 1 ? "↑" : "↓") : "—"
  850. string sesTxt = lastSweepDir == 0 ? "—" : (lastSweepDir == -1 ? "▼ DOWN" : "▲ UP") + " → " + lastSweepName
  851.  
  852. table.cell(hud, 0, 0, "TRADEAXIS DOL PRO", text_color = colAccent, text_halign = text.align_left, text_size = sz, bgcolor = hdBg, text_formatting = text.format_bold)
  853. table.cell(hud, 2, 0, styleCode, text_color = colNeutral, text_halign = text.align_right, text_size = sz, bgcolor = hdBg)
  854. table.cell(hud, 0, 1, tgtTxt, text_color = colAccent, text_halign = text.align_left, text_size = sz)
  855. table.cell(hud, 2, 1, pxTxt, text_color = colHudValue, text_halign = text.align_right, text_size = sz, text_formatting = text.format_bold)
  856. table.cell(hud, 0, 2, "PoT " + str.tostring(potHorizon) + "b", text_color = colHudText, text_halign = text.align_left, text_size = sz)
  857. table.cell(hud, 1, 2, f_bar(nz(hPot), 10), text_color = colAccent, text_halign = text.align_right, text_size = sz)
  858. table.cell(hud, 2, 2, hasT ? str.tostring(hPot, "0.0") + "%" : "—", text_color = colAccent, text_halign = text.align_right, text_size = sz)
  859. table.cell(hud, 0, 3, "Conviction", text_color = colHudText, text_halign = text.align_left, text_size = sz)
  860. table.cell(hud, 1, 3, f_bar(nz(hConv), 10), text_color = colAccent, text_halign = text.align_right, text_size = sz)
  861. table.cell(hud, 2, 3, hasT ? str.tostring(hConv, "0") : "—", text_color = colAccent, text_halign = text.align_right, text_size = sz)
  862. table.cell(hud, 0, 4, "Distance", text_color = colHudText, text_halign = text.align_left, text_size = sz)
  863. table.cell(hud, 1, 4, distTxt, text_color = colAccent, text_halign = text.align_right, text_size = sz)
  864. table.cell(hud, 0, 5, "Engines", text_color = colHudText, text_halign = text.align_left, text_size = sz)
  865. table.cell(hud, 1, 5, tf1Lbl + " · " + tf2Lbl + " · " + tf3Lbl, text_color = colHudValue, text_halign = text.align_right, text_size = sz)
  866. table.cell(hud, 0, 6, "Session", text_color = colHudText, text_halign = text.align_left, text_size = sz)
  867. table.cell(hud, 1, 6, sesTxt, text_color = lastSweepDir == -1 ? colBear : lastSweepDir == 1 ? colAccent : colNeutral, text_halign = text.align_right, text_size = sz)
  868. table.cell(hud, 0, 7, "TIMEFRAME BIAS", text_color = colHudText, text_halign = text.align_left, text_size = sz, bgcolor = hdBg)
  869. table.cell(hud, 0, 8, tf3Lbl, text_color = colHudValue, text_halign = text.align_left, text_size = sz)
  870. table.cell(hud, 1, 8, "", text_size = sz)
  871. table.cell(hud, 2, 8, f_biasTxt(nz(h3Bias)), text_color = f_biasCol(nz(h3Bias), colAccent, colBear, colNeutral), text_halign = text.align_right, text_size = sz)
  872. table.cell(hud, 0, 9, tf2Lbl, text_color = colHudValue, text_halign = text.align_left, text_size = sz)
  873. table.cell(hud, 1, 9, "", text_size = sz)
  874. table.cell(hud, 2, 9, f_biasTxt(nz(h2Bias)), text_color = f_biasCol(nz(h2Bias), colAccent, colBear, colNeutral), text_halign = text.align_right, text_size = sz)
  875. table.cell(hud, 0, 10, tf1Lbl, text_color = colHudValue, text_halign = text.align_left, text_size = sz)
  876. table.cell(hud, 1, 10, "", text_size = sz)
  877. table.cell(hud, 2, 10, f_biasTxt(nz(h1Bias)), text_color = f_biasCol(nz(h1Bias), colAccent, colBear, colNeutral), text_halign = text.align_right, text_size = sz)
  878.  
  879. if not hudMerged
  880. table.merge_cells(hud, 0, 0, 1, 0)
  881. table.merge_cells(hud, 0, 1, 1, 1)
  882. table.merge_cells(hud, 1, 4, 2, 4)
  883. table.merge_cells(hud, 1, 5, 2, 5)
  884. table.merge_cells(hud, 1, 6, 2, 6)
  885. table.merge_cells(hud, 0, 7, 2, 7)
  886. hudMerged := true
  887.  
  888. if newTgtEvt and hasT
  889. alert("TradeAxis DOL Pro | New DOL target: " + hKind + " " + hTf + " @ " + str.tostring(hPx, format.mintick) + " | PoT " + str.tostring(hPot, "0.0") + "% | Conviction " + str.tostring(hConv, "0") + " | " + syminfo.ticker, alert.freq_once_per_bar_close)
  890. if tgtHitEvt
  891. alert(hitMsg, alert.freq_once_per_bar_close)
  892.  
  893. alertcondition(newTgtEvt, "TradeAxis DOL Pro — New DOL Target", "TradeAxis DOL Pro: new Draw on Liquidity target on {{ticker}} ({{interval}})")
  894. alertcondition(tgtHitEvt, "TradeAxis DOL Pro — DOL Target Reached", "TradeAxis DOL Pro: active DOL target reached on {{ticker}} ({{interval}})")
  895. alertcondition(bosBullEvt or bosBearEvt, "TradeAxis DOL Pro — BOS", "TradeAxis DOL Pro: validated Break of Structure on {{ticker}} ({{interval}})")
  896. alertcondition(mssBullEvt or mssBearEvt, "TradeAxis DOL Pro — MSS", "TradeAxis DOL Pro: Market Structure Shift on {{ticker}} ({{interval}})")
  897. alertcondition(cisdBullEvt or cisdBearEvt, "TradeAxis DOL Pro — CISD", "TradeAxis DOL Pro: Change in State of Delivery on {{ticker}} ({{interval}})")
Advertisement
Comments
  • User was banned
Add Comment
Please, Sign In to add comment