ajiim

🎁

Oct 1st, 2026
934
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 22.55 KB | None | 0 0
  1. //@version=6
  2. indicator("London Intraday Protraction° [Pro+]", shorttitle = "London Intraday Protraction° [Pro+]", overlay = true, max_boxes_count = 500, max_lines_count = 500, max_labels_count = 500)
  3.  
  4. string G_TIME = "Time Parameters (ICT)"
  5. string G_PRICE = "Price Parameters (pips)"
  6. string G_DEV = "CBDR Standard Deviations"
  7. string G_SIG = "Protraction Signals"
  8. string G_COL = "Colors"
  9. string G_TBL = "Statistics Table"
  10. string G_DISP = "Display"
  11.  
  12. string i_tz = input.string("America/New_York", "Timezone", options = ["America/New_York", "UTC", "Europe/London", "Exchange"], group = G_TIME, tooltip = "ICT Time parameters are referenced to New York local time.")
  13. string i_cbdrSess = input.session("1400-2000", "Central Bank Dealers Range (CBDR)", group = G_TIME)
  14. string i_arSess = input.session("2000-0000", "Asian Range (AR)", group = G_TIME)
  15. string i_protSess = input.session("0000-0200", "Normal Protraction Window", group = G_TIME, tooltip = "Window of Time in which the Normal Protraction is expected. If no Protraction prints here, the Normal profile is negated (invalid Time parameter).")
  16. string i_lonSess = input.session("0200-0500", "London Session", group = G_TIME, tooltip = "London window of Time opportunity used by the Delayed and Negated profiles.")
  17.  
  18. float i_cbdrMin = input.float(0.0, "CBDR Size Min", minval = 0.0, step = 0.5, inline = "cbdr", group = G_PRICE)
  19. float i_cbdrMax = input.float(40.0, "Max", minval = 0.5, step = 0.5, inline = "cbdr", group = G_PRICE, tooltip = "ICT: an ideal CBDR is below 40 pips.")
  20. float i_arMin = input.float(20.0, "AR Size Min", minval = 0.0, step = 0.5, inline = "ar", group = G_PRICE)
  21. float i_arMax = input.float(30.0, "Max", minval = 0.5, step = 0.5, inline = "ar", group = G_PRICE, tooltip = "ICT: an ideal Asian Range is between 20 and 30 pips.")
  22. int i_confBars = input.int(2, "Protraction Confirmation (bars)", minval = 1, maxval = 10, group = G_PRICE, tooltip = "Bars the Protraction extreme must hold, with price closing back inside the range, before it is confirmed.")
  23.  
  24. bool i_showDev = input.bool(true, "Show CBDR Deviations", inline = "dev", group = G_DEV)
  25. int i_devCount = input.int(3, "", minval = 1, maxval = 3, inline = "dev", group = G_DEV, tooltip = "Number of CBDR standard deviations projected above and below the range (up to three).")
  26.  
  27. bool i_showPips = input.bool(true, "Show Range Size Labels (pips)", group = G_SIG)
  28. bool i_showMarks = input.bool(true, "Show Protraction Markers", group = G_SIG)
  29. bool i_showText = input.bool(true, "Show Signal Text", group = G_SIG)
  30. string i_lblSize = input.string("Small", "Label Size", options = ["Tiny", "Small", "Normal"], group = G_SIG)
  31. int i_extBars = input.int(8, "Protraction Level Length (bars)", minval = 1, maxval = 100, group = G_SIG)
  32.  
  33. bool i_autoCol = input.bool(true, "Auto-Adapting Colors", group = G_COL, tooltip = "Valid lines, signals, text and tables automatically adapt to the chart background (light or dark).")
  34. color i_cbdrCol = input.color(color.new(#5B8DEF, 65), "CBDR", inline = "c1", group = G_COL)
  35. color i_arValidCol = input.color(color.new(#4CAF50, 65), "AR Valid", inline = "c1", group = G_COL)
  36. color i_arInvalidCol = input.color(color.new(#F0A04B, 62), "AR Invalid", inline = "c1", group = G_COL)
  37. color i_validCol = input.color(#000000, "Valid", inline = "c2", group = G_COL)
  38. color i_invalidCol = input.color(#F23645, "Invalid", inline = "c2", group = G_COL)
  39. color i_textCol = input.color(#000000, "Text", inline = "c2", group = G_COL)
  40.  
  41. bool i_showTbl = input.bool(true, "Show Statistics", group = G_TBL)
  42. string i_tblY = input.string("Bottom", "Position", options = ["Top", "Middle", "Bottom"], inline = "tp", group = G_TBL)
  43. string i_tblX = input.string("Center", "", options = ["Left", "Center", "Right"], inline = "tp", group = G_TBL)
  44. string i_tblSize = input.string("Small", "Size", options = ["Tiny", "Small", "Normal", "Large"], group = G_TBL)
  45.  
  46. bool i_showInfo = input.bool(true, "Show Timeframe Panel", group = G_DISP)
  47. bool i_showTicker = input.bool(true, "Show Symbol in Panel", group = G_DISP)
  48. bool i_showTitle = input.bool(true, "Show Title Banner", group = G_DISP)
  49. int i_maxDays = input.int(5, "Historical Sessions to Show", minval = 1, maxval = 55, group = G_DISP, tooltip = "Number of past sessions kept on the chart. Statistics still count every session.")
  50.  
  51. int P_NONE = 0
  52. int P_NORMAL = 1
  53. int P_DELAYED = 2
  54. int P_NEGATED = 3
  55. int GAP_MS = 7200000
  56. string IND_NAME = "London Intraday Protraction° [Pro+]"
  57. color TRANSP = color.new(color.black, 100)
  58.  
  59. type DayDrawings
  60. array<box> boxes
  61. array<line> lines
  62. array<label> labels
  63.  
  64. type Cycle
  65. int startBar
  66. float cbdrH
  67. float cbdrL
  68. float cbdrPips
  69. bool cbdrOk = false
  70. bool cbdrDone = false
  71. int arBar
  72. float arH
  73. float arL
  74. float arPips
  75. bool arOk = false
  76. bool arDone = false
  77. int profile = 0
  78. float refH
  79. float refL
  80. int pwBar
  81. bool lonStarted = false
  82. bool lonDone = false
  83. bool extending = false
  84. bool winActive = false
  85. int protDir = 0
  86. int trigBar
  87. float protExt
  88. int protExtBar
  89. bool confirmed = false
  90. bool failed = false
  91. box cbdrBox
  92. box arBox
  93. box devBox
  94. box winBox
  95. label cbdrLbl
  96. label arLbl
  97. label trigMark
  98. label trigText
  99. array<line> devLines
  100. DayDrawings draw
  101.  
  102. method addBox(DayDrawings d, box b) =>
  103. d.boxes.push(b)
  104. b
  105.  
  106. method addLine(DayDrawings d, line l) =>
  107. d.lines.push(l)
  108. l
  109.  
  110. method addLabel(DayDrawings d, label lb) =>
  111. d.labels.push(lb)
  112. lb
  113.  
  114. method clearAll(DayDrawings d) =>
  115. for b in d.boxes
  116. b.delete()
  117. for l in d.lines
  118. l.delete()
  119. for lb in d.labels
  120. lb.delete()
  121. d.boxes.clear()
  122. d.lines.clear()
  123. d.labels.clear()
  124.  
  125. f_size(string s) =>
  126. switch s
  127. "Tiny" => size.tiny
  128. "Small" => size.small
  129. "Normal" => size.normal
  130. => size.large
  131.  
  132. f_tablePos(string y, string x) =>
  133. switch y
  134. "Top" => x == "Left" ? position.top_left : x == "Center" ? position.top_center : position.top_right
  135. "Middle" => x == "Left" ? position.middle_left : x == "Center" ? position.middle_center : position.middle_right
  136. => x == "Left" ? position.bottom_left : x == "Center" ? position.bottom_center : position.bottom_right
  137.  
  138. f_pipSize() =>
  139. float tick = syminfo.mintick
  140. int dec = int(math.round(-math.log10(tick)))
  141. dec % 2 == 1 ? tick * 10.0 : tick
  142.  
  143. float PIP = f_pipSize()
  144.  
  145. f_pips(float rng) =>
  146. PIP > 0 ? rng / PIP : 0.0
  147.  
  148. f_fmt(float p) =>
  149. str.tostring(math.round(p, 1), "#.#")
  150.  
  151. f_inSess(string sess, string tz) =>
  152. not na(time(timeframe.period, sess, tz))
  153.  
  154. f_devTop(Cycle c) =>
  155. c.cbdrH + i_devCount * (c.cbdrH - c.cbdrL)
  156.  
  157. f_devBot(Cycle c) =>
  158. c.cbdrL - i_devCount * (c.cbdrH - c.cbdrL)
  159.  
  160. f_buildDeviations(Cycle c, color col) =>
  161. float rng = c.cbdrH - c.cbdrL
  162. c.devBox := c.draw.addBox(box.new(c.startBar, f_devTop(c), bar_index, f_devBot(c), border_color = col, border_width = 1, border_style = line.style_dotted, bgcolor = TRANSP))
  163. if i_devCount > 1
  164. for i = 1 to i_devCount - 1
  165. float up = c.cbdrH + i * rng
  166. float dn = c.cbdrL - i * rng
  167. c.devLines.push(c.draw.addLine(line.new(c.startBar, up, bar_index, up, color = col, style = line.style_dotted, width = 1)))
  168. c.devLines.push(c.draw.addLine(line.new(c.startBar, dn, bar_index, dn, color = col, style = line.style_dotted, width = 1)))
  169.  
  170. f_paintDev(Cycle c, color col) =>
  171. if not na(c.devBox)
  172. c.devBox.set_border_color(col)
  173. for ln in c.devLines
  174. ln.set_color(col)
  175.  
  176. f_extendDev(Cycle c, int x) =>
  177. if not na(c.devBox)
  178. c.devBox.set_right(x)
  179. for ln in c.devLines
  180. ln.set_x2(x)
  181.  
  182. f_tfLabel() =>
  183. int secs = timeframe.in_seconds()
  184. string res = timeframe.period
  185. if timeframe.isseconds
  186. res := str.tostring(secs) + "s"
  187. else if timeframe.isminutes
  188. res := secs >= 3600 and secs % 3600 == 0 ? str.tostring(int(secs / 3600)) + "h" : str.tostring(int(secs / 60)) + "m"
  189. res + " TIMEFRAME"
  190.  
  191. string tzStr = i_tz == "Exchange" ? syminfo.timezone : i_tz
  192. bool isAllowed = syminfo.type == "forex" and timeframe.isintraday and timeframe.in_seconds() <= 900
  193.  
  194. color cValid = i_autoCol ? chart.fg_color : i_validCol
  195. color cText = i_autoCol ? chart.fg_color : i_textCol
  196. color cInvalid = i_invalidCol
  197. string sigSize = f_size(i_lblSize)
  198.  
  199. bool inCBDR = f_inSess(i_cbdrSess, tzStr)
  200. bool inAR = f_inSess(i_arSess, tzStr)
  201. bool inPW = f_inSess(i_protSess, tzStr)
  202. bool inLon = f_inSess(i_lonSess, tzStr)
  203.  
  204. bool sessionGap = bar_index > 0 and time - nz(time[1], time) > GAP_MS
  205. bool cbdrStart = inCBDR and bar_index > 0 and (not inCBDR[1] or sessionGap)
  206. bool arStart = inAR and not inAR[1]
  207. bool arEnd = not inAR and inAR[1]
  208. bool lonStart = inLon and not inLon[1]
  209. bool lonEnd = not inLon and inLon[1]
  210.  
  211. var Cycle cyc = na
  212. var array<DayDrawings> dayHistory = array.new<DayDrawings>()
  213.  
  214. var int statTotal = 0
  215. var int statNormal = 0
  216. var int statNormalConf = 0
  217. var int statDelayed = 0
  218. var int statDelayedConf = 0
  219.  
  220. bool evProfile = false
  221. bool evProt = false
  222. bool evConf = false
  223. bool evNoProt = false
  224.  
  225. if isAllowed and cbdrStart and not na(cyc)
  226. if cyc.profile != P_NONE
  227. bool held = cyc.confirmed and not cyc.failed
  228. statTotal += 1
  229. if cyc.profile == P_NORMAL
  230. statNormal += 1
  231. statNormalConf += held ? 1 : 0
  232. else
  233. statDelayed += 1
  234. statDelayedConf += held ? 1 : 0
  235. else
  236. cyc.draw.clearAll()
  237. if dayHistory.size() > 0
  238. dayHistory.pop()
  239.  
  240. if isAllowed and cbdrStart
  241. DayDrawings dd = DayDrawings.new(array.new<box>(), array.new<line>(), array.new<label>())
  242. dayHistory.push(dd)
  243. if dayHistory.size() > i_maxDays
  244. DayDrawings oldest = dayHistory.shift()
  245. oldest.clearAll()
  246. cyc := Cycle.new(startBar = bar_index, cbdrH = high, cbdrL = low, devLines = array.new<line>(), draw = dd)
  247. cyc.cbdrBox := dd.addBox(box.new(bar_index, high, bar_index, low, border_color = TRANSP, border_width = 1, bgcolor = i_cbdrCol))
  248. if i_showPips
  249. cyc.cbdrLbl := dd.addLabel(label.new(bar_index, high, "", style = label.style_label_down, color = TRANSP, textcolor = cText, size = sigSize))
  250.  
  251. if isAllowed and not na(cyc)
  252.  
  253. if inCBDR and not cyc.cbdrDone
  254. cyc.cbdrH := math.max(cyc.cbdrH, high)
  255. cyc.cbdrL := math.min(cyc.cbdrL, low)
  256. cyc.cbdrPips := f_pips(cyc.cbdrH - cyc.cbdrL)
  257. cyc.cbdrOk := cyc.cbdrPips >= i_cbdrMin and cyc.cbdrPips <= i_cbdrMax
  258. cyc.cbdrBox.set_top(cyc.cbdrH)
  259. cyc.cbdrBox.set_bottom(cyc.cbdrL)
  260. cyc.cbdrBox.set_right(bar_index)
  261. if not na(cyc.cbdrLbl)
  262. cyc.cbdrLbl.set_xy(math.round((cyc.startBar + bar_index) / 2), cyc.cbdrH)
  263. cyc.cbdrLbl.set_text(f_fmt(cyc.cbdrPips))
  264. cyc.cbdrLbl.set_textcolor(cyc.cbdrOk ? cText : cInvalid)
  265.  
  266. if arStart and not cyc.cbdrDone and not na(cyc.cbdrH)
  267. cyc.cbdrDone := true
  268. cyc.arBar := bar_index
  269. cyc.arH := high
  270. cyc.arL := low
  271. cyc.arBox := cyc.draw.addBox(box.new(bar_index, high, bar_index, low, border_color = TRANSP, border_width = 1, bgcolor = i_arValidCol))
  272. if i_showPips
  273. cyc.arLbl := cyc.draw.addLabel(label.new(bar_index, high, "", style = label.style_label_down, color = TRANSP, textcolor = cText, size = sigSize))
  274. if i_showDev
  275. f_buildDeviations(cyc, cyc.cbdrOk ? cValid : cInvalid)
  276. cyc.extending := true
  277.  
  278. if inAR and cyc.cbdrDone and not cyc.arDone and not na(cyc.arH)
  279. cyc.arH := math.max(cyc.arH, high)
  280. cyc.arL := math.min(cyc.arL, low)
  281. cyc.arPips := f_pips(cyc.arH - cyc.arL)
  282. bool arOver = cyc.arPips > i_arMax
  283. cyc.arBox.set_top(cyc.arH)
  284. cyc.arBox.set_bottom(cyc.arL)
  285. cyc.arBox.set_right(bar_index)
  286. cyc.arBox.set_bgcolor(arOver ? i_arInvalidCol : i_arValidCol)
  287. if not na(cyc.arLbl)
  288. cyc.arLbl.set_xy(math.round((cyc.arBar + bar_index) / 2), cyc.arH)
  289. cyc.arLbl.set_text(f_fmt(cyc.arPips))
  290. cyc.arLbl.set_textcolor(arOver ? cInvalid : cText)
  291. f_paintDev(cyc, cyc.cbdrOk and not arOver ? cValid : cInvalid)
  292.  
  293. if arEnd and cyc.cbdrDone and not cyc.arDone and not na(cyc.arH)
  294. cyc.arDone := true
  295. cyc.arPips := f_pips(cyc.arH - cyc.arL)
  296. cyc.arOk := cyc.arPips >= i_arMin and cyc.arPips <= i_arMax
  297. cyc.profile := cyc.cbdrOk and cyc.arOk ? P_NORMAL : P_DELAYED
  298. cyc.refH := cyc.arH
  299. cyc.refL := cyc.arL
  300. cyc.pwBar := bar_index
  301. cyc.arBox.set_bgcolor(cyc.arOk ? i_arValidCol : i_arInvalidCol)
  302. if not na(cyc.arLbl)
  303. cyc.arLbl.set_textcolor(cyc.arOk ? cText : cInvalid)
  304. if not na(cyc.cbdrLbl)
  305. cyc.cbdrLbl.set_textcolor(cyc.cbdrOk ? cText : cInvalid)
  306. f_paintDev(cyc, cyc.profile == P_NORMAL ? cValid : cInvalid)
  307. evProfile := true
  308.  
  309. if cyc.arDone and cyc.profile == P_DELAYED and not cyc.lonStarted and not inLon
  310. cyc.refH := math.max(cyc.refH, high)
  311. cyc.refL := math.min(cyc.refL, low)
  312.  
  313. if lonStart and cyc.arDone and not cyc.lonStarted
  314. cyc.lonStarted := true
  315. if not (cyc.profile == P_NORMAL and cyc.protDir != 0)
  316. if cyc.profile == P_NORMAL
  317. cyc.profile := P_NEGATED
  318. evNoProt := true
  319. if i_showText
  320. int midX = math.round((cyc.pwBar + bar_index) / 2)
  321. cyc.draw.addLabel(label.new(midX, cyc.arH, "No Protraction", style = label.style_label_down, color = TRANSP, textcolor = cText, size = sigSize, text_formatting = text.format_bold))
  322. cyc.draw.addLabel(label.new(midX, cyc.arH, "◷", style = label.style_label_up, color = TRANSP, textcolor = cInvalid, size = size.normal))
  323. f_extendDev(cyc, bar_index)
  324. cyc.extending := false
  325. color winCol = cyc.profile == P_DELAYED ? cValid : cInvalid
  326. cyc.winBox := cyc.draw.addBox(box.new(bar_index, math.max(f_devTop(cyc), high), bar_index, math.min(f_devBot(cyc), low), border_color = winCol, border_width = 1, border_style = line.style_dotted, bgcolor = TRANSP))
  327. cyc.winActive := true
  328.  
  329. if lonEnd and cyc.lonStarted and not cyc.lonDone
  330. cyc.lonDone := true
  331. if cyc.extending
  332. f_extendDev(cyc, bar_index)
  333. cyc.extending := false
  334. if cyc.winActive
  335. cyc.winBox.set_right(bar_index)
  336. cyc.winActive := false
  337.  
  338. if cyc.arDone and cyc.protDir == 0
  339. bool lookNormal = cyc.profile == P_NORMAL and inPW and not cyc.lonStarted
  340. bool lookLondon = (cyc.profile == P_DELAYED or cyc.profile == P_NEGATED) and inLon and cyc.lonStarted and not cyc.lonDone
  341. if lookNormal or lookLondon
  342. bool brokeUp = high > cyc.refH
  343. bool brokeDn = low < cyc.refL
  344. if brokeUp or brokeDn
  345. int dir = brokeUp and brokeDn ? (high - cyc.refH >= cyc.refL - low ? 1 : -1) : brokeUp ? 1 : -1
  346. cyc.protDir := dir
  347. cyc.trigBar := bar_index
  348. cyc.protExt := dir == 1 ? high : low
  349. cyc.protExtBar := bar_index
  350. evProt := true
  351. color mCol = lookLondon ? cInvalid : cText
  352. string yl = dir == 1 ? yloc.abovebar : yloc.belowbar
  353. if i_showMarks
  354. cyc.trigMark := cyc.draw.addLabel(label.new(bar_index, cyc.protExt, "", yloc = yl, style = dir == 1 ? label.style_triangleup : label.style_triangledown, color = mCol, size = size.tiny))
  355. if i_showText
  356. cyc.trigText := cyc.draw.addLabel(label.new(bar_index, cyc.protExt, "Protraction", yloc = yl, style = label.style_label_right, color = TRANSP, textcolor = cText, size = sigSize, text_formatting = text.format_bold))
  357. if lookLondon
  358. float lvl = dir == 1 ? cyc.refH : cyc.refL
  359. cyc.draw.addLine(line.new(bar_index, lvl, bar_index + i_extBars, lvl, color = cInvalid, width = 1))
  360.  
  361. if cyc.protDir != 0 and not cyc.confirmed and not cyc.lonDone
  362. if cyc.protDir == 1 and high > cyc.protExt
  363. cyc.protExt := high
  364. cyc.protExtBar := bar_index
  365. else if cyc.protDir == -1 and low < cyc.protExt
  366. cyc.protExt := low
  367. cyc.protExtBar := bar_index
  368. bool backInside = cyc.protDir == 1 ? close < cyc.refH : close > cyc.refL
  369. if bar_index - cyc.protExtBar >= i_confBars and backInside
  370. cyc.confirmed := true
  371. evConf := true
  372. bool london = cyc.profile != P_NORMAL
  373. string yl = cyc.protDir == 1 ? yloc.abovebar : yloc.belowbar
  374. if cyc.protExtBar == cyc.trigBar
  375. if not na(cyc.trigMark)
  376. cyc.trigMark.delete()
  377. if not na(cyc.trigText)
  378. cyc.trigText.delete()
  379. if i_showMarks
  380. if london
  381. cyc.draw.addLabel(label.new(cyc.protExtBar, cyc.protExt, "◉", yloc = yl, style = cyc.protDir == 1 ? label.style_label_down : label.style_label_up, color = TRANSP, textcolor = cInvalid, size = size.normal))
  382. else
  383. cyc.draw.addLabel(label.new(cyc.protExtBar, cyc.protExt, "", yloc = yl, style = cyc.protDir == 1 ? label.style_triangledown : label.style_triangleup, color = cText, size = size.tiny))
  384. if i_showText
  385. cyc.draw.addLabel(label.new(cyc.protExtBar, cyc.protExt, "Confirmed Protraction", yloc = yl, style = label.style_label_right, color = TRANSP, textcolor = cText, size = sigSize, text_formatting = text.format_bold))
  386. if london
  387. cyc.draw.addLine(line.new(cyc.protExtBar, cyc.protExt, bar_index + i_extBars, cyc.protExt, color = cInvalid, width = 1))
  388.  
  389. if cyc.confirmed and not cyc.failed
  390. if (cyc.protDir == 1 and high > cyc.protExt) or (cyc.protDir == -1 and low < cyc.protExt)
  391. cyc.failed := true
  392.  
  393. if isAllowed and not na(cyc)
  394. if cyc.extending
  395. f_extendDev(cyc, bar_index)
  396. if cyc.winActive and inLon and not na(cyc.winBox)
  397. cyc.winBox.set_right(bar_index)
  398. cyc.winBox.set_top(math.max(cyc.winBox.get_top(), high))
  399. cyc.winBox.set_bottom(math.min(cyc.winBox.get_bottom(), low))
  400.  
  401. var table tblStats = i_showTbl ? table.new(f_tablePos(i_tblY, i_tblX), 3, 3, frame_color = cText, frame_width = 1, border_color = cText, border_width = 1) : na
  402. var table tblInfo = i_showInfo ? table.new(position.top_right, 1, 2, frame_color = cText, frame_width = 1) : na
  403. var table tblTitle = i_showTitle ? table.new(position.top_center, 1, 1, frame_color = cText, frame_width = 1) : na
  404. var table tblWarn = table.new(position.middle_center, 1, 1, frame_color = cInvalid, frame_width = 1)
  405.  
  406. f_cell(table t, int c, int r, string txt, string sz) =>
  407. table.cell(t, c, r, txt, text_color = cText, text_size = sz, text_halign = text.align_center, text_valign = text.align_center, bgcolor = TRANSP, text_font_family = font.family_monospace)
  408.  
  409. if barstate.islast
  410. if not isAllowed
  411. table.cell(tblWarn, 0, 0, IND_NAME + "\nDesigned for Forex markets on the 15 minute timeframe or below.", text_color = cInvalid, text_size = size.normal, bgcolor = color.new(cInvalid, 90))
  412. else
  413. if not na(tblStats)
  414. string tSz = f_size(i_tblSize)
  415. string nPct = statNormal > 0 ? str.tostring(math.round(100.0 * statNormalConf / statNormal)) + "%" : "0%"
  416. string dPct = statDelayed > 0 ? str.tostring(math.round(100.0 * statDelayedConf / statDelayed)) + "%" : "0%"
  417. f_cell(tblStats, 0, 0, "Total Days\n" + str.tostring(statTotal), tSz)
  418. f_cell(tblStats, 1, 0, "Predicted Profiles", tSz)
  419. f_cell(tblStats, 2, 0, "Confirmed Profiles", tSz)
  420. f_cell(tblStats, 0, 1, "Normal", tSz)
  421. f_cell(tblStats, 1, 1, str.tostring(statNormal), tSz)
  422. f_cell(tblStats, 2, 1, nPct, tSz)
  423. f_cell(tblStats, 0, 2, "Delayed", tSz)
  424. f_cell(tblStats, 1, 2, str.tostring(statDelayed), tSz)
  425. f_cell(tblStats, 2, 2, dPct, tSz)
  426. if not na(tblInfo)
  427. if i_showTicker
  428. table.cell(tblInfo, 0, 0, syminfo.ticker, text_color = cText, text_size = size.normal, bgcolor = TRANSP)
  429. table.cell(tblInfo, 0, 1, f_tfLabel(), text_color = cText, text_size = size.tiny, bgcolor = TRANSP)
  430. else
  431. table.cell(tblInfo, 0, 0, f_tfLabel(), text_color = cText, text_size = size.tiny, bgcolor = TRANSP)
  432. if not na(tblTitle)
  433. table.cell(tblTitle, 0, 0, IND_NAME, text_color = cText, text_size = size.normal, bgcolor = TRANSP)
  434.  
  435. if evProfile and not na(cyc)
  436. alert(IND_NAME + " | " + syminfo.ticker + " | Profile: " + (cyc.profile == P_NORMAL ? "Normal Protraction" : "Delayed Protraction") + " | CBDR " + f_fmt(cyc.cbdrPips) + " pips | AR " + f_fmt(cyc.arPips) + " pips", alert.freq_once_per_bar_close)
  437. if evNoProt
  438. alert(IND_NAME + " | " + syminfo.ticker + " | No Protraction: Normal Protraction Negated, look for a Protraction in the London window of Time", alert.freq_once_per_bar_close)
  439. if evProt and not na(cyc)
  440. alert(IND_NAME + " | " + syminfo.ticker + " | Protraction " + (cyc.protDir == 1 ? "UP" : "DOWN"), alert.freq_once_per_bar_close)
  441. if evConf and not na(cyc)
  442. alert(IND_NAME + " | " + syminfo.ticker + " | Confirmed Protraction " + (cyc.protDir == 1 ? "High" : "Low"), alert.freq_once_per_bar_close)
  443.  
  444. alertcondition(evProfile, "Profile Assigned", "London Intraday Protraction° [Pro+] | {{ticker}} | Asian Range closed: London profile assigned")
  445. alertcondition(evProt, "Protraction", "London Intraday Protraction° [Pro+] | {{ticker}} | Protraction detected")
  446. alertcondition(evConf, "Confirmed Protraction", "London Intraday Protraction° [Pro+] | {{ticker}} | Confirmed Protraction")
  447. alertcondition(evNoProt, "No Protraction", "London Intraday Protraction° [Pro+] | {{ticker}} | No Protraction: Normal Protraction Negated")
Advertisement
Add Comment
Please, Sign In to add comment