ajiim

🎁

Oct 7th, 2026
1,242
0
Never
2
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 52.12 KB | None | 0 0
  1. //@version=6
  2. indicator("WCSMC + SP v3.0 [WinWorld]", shorttitle = "WCSMC + SP v3.0 [WinWorld]", overlay = true, max_lines_count = 500, max_boxes_count = 500, max_labels_count = 500, max_bars_back = 2000)
  3.  
  4. string G_MAIN = "WCSMC | Main Settings"
  5. string drawFromMode = input.string("Whole history", "Draw structure...", options = ["Whole history", "From date"], group = G_MAIN, tooltip = "Draw structure across the whole price history, or only from a chosen start date.")
  6. int drawFromTime = input.time(timestamp("01 Jan 2026 00:00 +0000"), "Start date", group = G_MAIN)
  7. string idmMode = input.string("ext-idm", "IDM Mode", options = ["ext-idm", "in-idm"], group = G_MAIN, tooltip = "ext-idm: external inducement, higher-quality liquidity, better reversal odds.\nin-idm: last valid pullback regardless of internal/external - more frequent IDMs.")
  8. bool showSecIdm = input.bool(false, "Show Secondary IDM", group = G_MAIN, tooltip = "Shows the other IDM definition in angle brackets, e.g. < in-IDM >, for confluence.")
  9. int swingLen = input.int(5, "External swing length", minval = 2, maxval = 50, group = G_MAIN)
  10. bool showMtfStruct = input.bool(true, "Show MTF structure", group = G_MAIN, inline = "mtf")
  11. string mtfStructTf = input.timeframe("60", "", group = G_MAIN, inline = "mtf")
  12. int mtfSwingLen = input.int(3, "MTF swing length", minval = 2, maxval = 20, group = G_MAIN)
  13. bool showInner = input.bool(false, "Show inner structure", group = G_MAIN, tooltip = "Plots the structure inside the current swing (i-IDM, i-BoS, i-ChoCh, internal OBs). Dense - off by default.")
  14. int innerLen = input.int(2, "Inner swing length", minval = 1, maxval = 20, group = G_MAIN)
  15.  
  16. string G_LEG = "Legacy Features"
  17. bool legacyInner = input.bool(false, "Legacy internal structure (v2)", group = G_LEG, tooltip = "Builds internal structure with a fixed 2-bar swing like WCSMC v2.")
  18. bool legacyInnerOb = input.bool(false, "Legacy internal OB detection (v2)", group = G_LEG, tooltip = "Internal orderblocks are taken from the inducement extreme (v2) instead of the extreme candle of the leg (v3).")
  19.  
  20. string G_VIS = "WCSMC | Visual Controls"
  21. string colourMode = input.string("Structure-related", "Colour Mode", options = ["Structure-related", "Monochrome"], group = G_VIS)
  22. color monoColor = input.color(color.new(#b2b5be, 0), "Monochrome colour", group = G_VIS)
  23. string textSizeOpt = input.string("Small", "Text Size", options = ["Tiny", "Small", "Normal", "Large"], group = G_VIS)
  24. int spTransp = input.int(70, "Structure Points Transparency", minval = 0, maxval = 100, group = G_VIS)
  25.  
  26. string G_CH = "WCSMC | Charts Controls"
  27. bool showPoints = input.bool(false, "Structure Points", group = G_CH, inline = "c1")
  28. bool showIdm = input.bool(true, "IDM", group = G_CH, inline = "c1")
  29. bool showBos = input.bool(true, "BoS", group = G_CH, inline = "c2")
  30. bool showChoch = input.bool(true, "ChoCh", group = G_CH, inline = "c2")
  31. bool showSweeps = input.bool(true, "Sweeps", group = G_CH, inline = "c2")
  32. bool showObIdm = input.bool(true, "OB-IDM", group = G_CH, inline = "c3")
  33. bool showObExt = input.bool(true, "OB-EXT", group = G_CH, inline = "c3")
  34. bool showPrevObExt = input.bool(true, "Previous OB-EXT", group = G_CH, inline = "c3")
  35. bool showSmt = input.bool(true, "SMT", group = G_CH, inline = "c4")
  36. string smtSymbolIn = input.symbol("", "SMT symbol", group = G_CH, inline = "c4", tooltip = "Correlated instrument used for Smart Money Trap detection. Leave empty for automatic pairing (BTC/ETH, XAU/XAG, EUR/GBP, AUD/NZD, USD pairs/DXY).")
  37. bool showObFvg = input.bool(true, "OB FVG", group = G_CH, inline = "c5")
  38. bool showLiveStruct = input.bool(true, "Live Structure", group = G_CH, inline = "c6")
  39. bool showLiveIdm = input.bool(true, "Live IDM", group = G_CH, inline = "c6")
  40. bool showTrendDots = input.bool(false, "Trend dots", group = G_CH, inline = "c7")
  41. bool showBgTrend = input.bool(false, "Background by structure", group = G_CH, inline = "c7")
  42. int maxZones = input.int(20, "Max OBs kept per type set", minval = 4, maxval = 80, group = G_CH)
  43.  
  44. string G_CS = "WCSMC Structure — Colours"
  45. color cBull = input.color(#089981, "Bullish", group = G_CS, inline = "s1")
  46. color cBear = input.color(#f23645, "Bearish", group = G_CS, inline = "s1")
  47. color cIdm = input.color(#787b86, "IDM", group = G_CS, inline = "s2")
  48. color cSweep = input.color(#b2b5be, "Sweep", group = G_CS, inline = "s2")
  49.  
  50. string G_CO = "WCSMC Orderblocks — Colours"
  51. color cObExtBull = input.color(color.new(#089981, 80), "OB-EXT Bull", group = G_CO, inline = "o1")
  52. color cObExtBear = input.color(color.new(#f23645, 75), "OB-EXT Bear", group = G_CO, inline = "o1")
  53. color cObIdm = input.color(color.new(#787b86, 80), "OB-IDM", group = G_CO, inline = "o2")
  54. color cSmtCol = input.color(color.new(#787b86, 80), "SMT", group = G_CO, inline = "o2")
  55. color cFvg = input.color(color.new(#ff9800, 70), "FVG", group = G_CO, inline = "o3")
  56. color cObText = input.color(color.new(#9598a1, 0), "OB text", group = G_CO, inline = "o3")
  57.  
  58. string G_CT = "WCSMC Trend — Colours"
  59. color cTrendBull = input.color(#089981, "Trend Bull", group = G_CT, inline = "t1")
  60. color cTrendBear = input.color(#f23645, "Trend Bear", group = G_CT, inline = "t1")
  61. int bgTransp = input.int(94, "Background transparency", minval = 0, maxval = 100, group = G_CT)
  62.  
  63. string G_FIB = "WCSMC | Fibo Levels"
  64. bool showFibo = input.bool(false, "Show Fibo", group = G_FIB)
  65. bool showFiboLbl = input.bool(true, "Show price labels", group = G_FIB)
  66. bool fibOn1 = input.bool(true, "", group = G_FIB, inline = "f1")
  67. float fibLv1 = input.float(0.236, "", step = 0.001, group = G_FIB, inline = "f1")
  68. color fibC1 = input.color(#787b86, "", group = G_FIB, inline = "f1")
  69. bool fibOn2 = input.bool(true, "", group = G_FIB, inline = "f2")
  70. float fibLv2 = input.float(0.382, "", step = 0.001, group = G_FIB, inline = "f2")
  71. color fibC2 = input.color(#f23645, "", group = G_FIB, inline = "f2")
  72. bool fibOn3 = input.bool(true, "", group = G_FIB, inline = "f3")
  73. float fibLv3 = input.float(0.500, "", step = 0.001, group = G_FIB, inline = "f3")
  74. color fibC3 = input.color(#ff9800, "", group = G_FIB, inline = "f3")
  75. bool fibOn4 = input.bool(true, "", group = G_FIB, inline = "f4")
  76. float fibLv4 = input.float(0.618, "", step = 0.001, group = G_FIB, inline = "f4")
  77. color fibC4 = input.color(#089981, "", group = G_FIB, inline = "f4")
  78. bool fibOn5 = input.bool(true, "", group = G_FIB, inline = "f5")
  79. float fibLv5 = input.float(0.786, "", step = 0.001, group = G_FIB, inline = "f5")
  80. color fibC5 = input.color(#2962ff, "", group = G_FIB, inline = "f5")
  81.  
  82. string G_MOD = "Smart Point | Modules"
  83. bool modVelocity = input.bool(true, "Velocity bars", group = G_MOD)
  84. bool modSmc = input.bool(true, "SMC bars", group = G_MOD)
  85. bool modOb = input.bool(true, "OB-based entry labels", group = G_MOD)
  86. int velLen = input.int(14, "Velocity length", minval = 2, group = G_MOD)
  87. int velSigLen = input.int(5, "Velocity signal length", minval = 1, group = G_MOD)
  88. int bbLen = input.int(20, "BB length (SMC)", minval = 2, group = G_MOD)
  89. float bbMult = input.float(2.0, "BB multiplier (SMC)", minval = 0.1, step = 0.1, group = G_MOD)
  90. float rangeMult = input.float(0.8, "Candle range quality (x ATR)", minval = 0.0, step = 0.1, group = G_MOD)
  91.  
  92. string G_DISP = "Smart Point | Display Mode"
  93. string dispMode = input.string("Bar Color", "Display Mode", options = ["Bar Color", "Box Border"], group = G_DISP)
  94. int borderW = input.int(2, "Box border width", minval = 1, maxval = 5, group = G_DISP)
  95. color cVelBull = input.color(#2962ff, "Velocity Bullish", group = G_DISP, inline = "v")
  96. color cVelBear = input.color(#9c27b0, "Velocity Bearish", group = G_DISP, inline = "v")
  97. color cSmcBull = input.color(#00e676, "SMC Bullish", group = G_DISP, inline = "sm")
  98. color cSmcBear = input.color(#ff1744, "SMC Bearish", group = G_DISP, inline = "sm")
  99.  
  100. string G_FIL = "Smart Point | Filters"
  101. bool lqdSweep = input.bool(false, "LQD Sweep (SMC bars only)", group = G_FIL, tooltip = "SMC bars must additionally sweep a nearby liquidity pool to qualify. Cuts frequency, raises selectivity. Recommended on higher timeframes; often better off on 1m-5m.")
  102. int lqdLen = input.int(10, "LQD lookback", minval = 2, group = G_FIL)
  103.  
  104. string G_GATE = "Smart Point | OB Gate"
  105. bool gateObIdm = input.bool(true, "OB-IDM", group = G_GATE, inline = "g1")
  106. bool gateObExt = input.bool(true, "OB-EXT", group = G_GATE, inline = "g1")
  107. bool gateSmt = input.bool(true, "SMT", group = G_GATE, inline = "g2")
  108. bool gatePrevExt = input.bool(true, "Previous OB-EXT", group = G_GATE, inline = "g2")
  109. bool gateInternal = input.bool(true, "Internal OBs", group = G_GATE, inline = "g3")
  110. bool showGateLine = input.bool(true, "Connect signal to gate OB", group = G_GATE)
  111.  
  112. string G_SB = "Smart Point | Signal Behavior"
  113. bool allowMulti = input.bool(true, "Allow multiple signals from one OB", group = G_SB, tooltip = "ON: one OB can emit several entries over consecutive bars until invalidated.\nOFF: each OB emits at most one signal, then gets removed from tracking.")
  114. color cLongLbl = input.color(#089981, "Long label", group = G_SB, inline = "l")
  115. color cShortLbl = input.color(#f23645, "Short label", group = G_SB, inline = "l")
  116.  
  117. string G_TPSL = "Smart Point | TP/SL"
  118. bool trackTpSl = input.bool(true, "Track TP/SL", group = G_TPSL)
  119. float rrRatio = input.float(2.0, "Risk/Reward Ratio", minval = 0.1, step = 0.1, group = G_TPSL)
  120. color cTp = input.color(#089981, "TP colour", group = G_TPSL, inline = "tp")
  121. color cSl = input.color(#f23645, "SL colour", group = G_TPSL, inline = "tp")
  122. int tpslTransp = input.int(80, "TP/SL Box Transparency", minval = 0, maxval = 100, group = G_TPSL)
  123.  
  124. string G_PERF = "Smart Point | Performance Dashboard"
  125. bool showPerf = input.bool(true, "Show Performance Dashboard", group = G_PERF)
  126. bool useTrackFrom = input.bool(false, "Track from", group = G_PERF, inline = "tf", tooltip = "Only trades after the specified date are counted.")
  127. int trackFromTime = input.time(timestamp("01 Jan 2026 00:00 +0000"), "", group = G_PERF, inline = "tf")
  128. string perfPosV = input.string("Middle", "Position", options = ["Top", "Middle", "Bottom"], group = G_PERF, inline = "pp")
  129. string perfPosH = input.string("Right", "", options = ["Left", "Center", "Right"], group = G_PERF, inline = "pp")
  130. string perfSizeOpt = input.string("Normal", "Table size", options = ["Tiny", "Small", "Normal", "Large"], group = G_PERF)
  131.  
  132. string G_MTF = "MTF Dashboard"
  133. bool showMtfDash = input.bool(true, "Show MTF Dashboard", group = G_MTF)
  134. int mtfDashLen = input.int(5, "MTF trend swing length", minval = 2, maxval = 20, group = G_MTF)
  135. string mtfPosV = input.string("Bottom", "Position", options = ["Top", "Middle", "Bottom"], group = G_MTF, inline = "mp")
  136. string mtfPosH = input.string("Right", "", options = ["Left", "Center", "Right"], group = G_MTF, inline = "mp")
  137.  
  138. string G_AF = "Alerts — Frequency"
  139. string alertFreqOpt = input.string("Once Per Bar Close", "Alert frequency", options = ["Once Per Bar", "Once Per Bar Close"], group = G_AF, tooltip = "Use Once Per Bar Close for webhook automation.")
  140.  
  141. string G_AE = "Alerts — External"
  142. bool aBos = input.bool(true, "BoS", group = G_AE, inline = "ae1")
  143. bool aBosSw = input.bool(false, "BoS sweep", group = G_AE, inline = "ae1")
  144. bool aChoch = input.bool(true, "ChoCh", group = G_AE, inline = "ae2")
  145. bool aChochSw = input.bool(false, "ChoCh sweep", group = G_AE, inline = "ae2")
  146. bool aIdm = input.bool(false, "IDM", group = G_AE, inline = "ae3")
  147. bool aIdmSw = input.bool(false, "IDM sweep", group = G_AE, inline = "ae3")
  148. bool aObIdm = input.bool(false, "OB-IDM reached", group = G_AE, inline = "ae4")
  149. bool aObExt = input.bool(false, "OB-EXT reached", group = G_AE, inline = "ae4")
  150. bool aPrevExt = input.bool(false, "Previous OB-EXT reached", group = G_AE, inline = "ae5")
  151. bool aSmt = input.bool(false, "SMT formed", group = G_AE, inline = "ae5")
  152.  
  153. string G_AI = "Alerts — Internal"
  154. bool aiBos = input.bool(false, "i-BoS", group = G_AI, inline = "ai1")
  155. bool aiBosSw = input.bool(false, "i-BoS sweep", group = G_AI, inline = "ai1")
  156. bool aiChoch = input.bool(false, "i-ChoCh", group = G_AI, inline = "ai2")
  157. bool aiChochSw = input.bool(false, "i-ChoCh sweep", group = G_AI, inline = "ai2")
  158. bool aiIdm = input.bool(false, "i-IDM", group = G_AI, inline = "ai3")
  159. bool aiIdmSw = input.bool(false, "i-IDM sweep", group = G_AI, inline = "ai3")
  160. bool aiObIdm = input.bool(false, "i-OB-IDM", group = G_AI, inline = "ai4")
  161. bool aiObExt = input.bool(false, "i-OB-EXT", group = G_AI, inline = "ai4")
  162. bool aiPrevExt = input.bool(false, "i-Previous OB-EXT", group = G_AI, inline = "ai5")
  163. bool aiSmt = input.bool(false, "i-SMT", group = G_AI, inline = "ai5")
  164.  
  165. string G_AO = "Alerts — Other"
  166. bool aFibo = input.bool(false, "Fibo midpoint cross", group = G_AO)
  167.  
  168. string G_AS = "Alerts — Smart Point"
  169. bool aVelBull = input.bool(false, "Velocity Bullish bar", group = G_AS, inline = "as1")
  170. bool aVelBear = input.bool(false, "Velocity Bearish bar", group = G_AS, inline = "as1")
  171. bool aSmcBull = input.bool(false, "SMC Bullish bar", group = G_AS, inline = "as2")
  172. bool aSmcBear = input.bool(false, "SMC Bearish bar", group = G_AS, inline = "as2")
  173. bool aObLong = input.bool(true, "OB Long signal", group = G_AS, inline = "as3")
  174. bool aObShort = input.bool(true, "OB Short signal", group = G_AS, inline = "as3")
  175. bool aTp = input.bool(true, "TP hit", group = G_AS, inline = "as4")
  176. bool aSl = input.bool(true, "SL hit", group = G_AS, inline = "as4")
  177.  
  178. string K_OBIDM = "OB-IDM"
  179. string K_OBEXT = "OB-EXT"
  180. string K_PREVEXT = "Previous OB-EXT"
  181. string K_SMT = "SMT"
  182.  
  183. color C_TBL_HDR = color.new(#2a2e39, 0)
  184. color C_TBL_HDR2 = color.new(#0e4a3f, 0)
  185. color C_TBL_CELL = color.new(#1e222d, 0)
  186. color C_TBL_POS = color.new(#0f3b33, 0)
  187. color C_TBL_NEG = color.new(#4a1d22, 0)
  188. color C_TBL_SINCE = color.new(#4a3214, 0)
  189. color C_TXT = color.new(#d1d4dc, 0)
  190. color C_TXT_DIM = color.new(#787b86, 0)
  191. color C_ORANGE = color.new(#ff9800, 0)
  192. color C_GOOD = color.new(#26a69a, 0)
  193. color C_BAD = color.new(#f23645, 0)
  194. color C_CLEAR = color.new(color.black, 100)
  195.  
  196. string alertFreq = alertFreqOpt == "Once Per Bar" ? alert.freq_once_per_bar : alert.freq_once_per_bar_close
  197.  
  198. type Trade
  199. int dir
  200. float entry
  201. float sl
  202. float tp
  203. int bar
  204. int t
  205. box tpBox
  206. box slBox
  207. line gateLine
  208. label sigLbl
  209. bool live = true
  210.  
  211. type Zone
  212. float top
  213. float bottom
  214. int dir
  215. string kind
  216. int left
  217. bool isInt
  218. box bx
  219. box fvg
  220. bool active = true
  221. bool gateOn = true
  222. bool reached = false
  223. int signals = 0
  224. Trade lastTrade
  225.  
  226. type Engine
  227. int len
  228. bool isInt
  229. string pre
  230. int trend = 0
  231. float hiLvl
  232. int hiBar
  233. float loLvl
  234. int loBar
  235. float runHi
  236. int runHiBar
  237. float runLo
  238. int runLoBar
  239. float pbLvl
  240. int pbBar
  241. float hlLvl
  242. int hlBar
  243. float idmIn
  244. int idmInBar
  245. float idmExt
  246. int idmExtBar
  247. bool idmTaken = false
  248. bool secTaken = false
  249. float swHiLvl
  250. float swLoLvl
  251. float prevPL
  252. float prevPLCmp
  253. float prevPH
  254. float prevPHCmp
  255. bool evBosUp = false
  256. bool evBosDn = false
  257. bool evChUp = false
  258. bool evChDn = false
  259. bool evBosSw = false
  260. bool evChSw = false
  261. bool evIdm = false
  262. bool evIdmSw = false
  263. bool evSmt = false
  264. line liveHi
  265. line liveLo
  266. line liveIdm
  267. label liveHiLbl
  268. label liveLoLbl
  269. label liveIdmLbl
  270.  
  271. var array<Zone> zones = array.new<Zone>()
  272. var array<Trade> trades = array.new<Trade>()
  273. var array<bool> obReachFlags = array.new<bool>(8, false)
  274.  
  275. f_size(string s) =>
  276. s == "Tiny" ? size.tiny : s == "Small" ? size.small : s == "Large" ? size.large : size.normal
  277.  
  278. f_pos(string v, string h) =>
  279. v == "Top" ? (h == "Left" ? position.top_left : h == "Center" ? position.top_center : position.top_right) :
  280. v == "Middle" ? (h == "Left" ? position.middle_left : h == "Center" ? position.middle_center : position.middle_right) :
  281. (h == "Left" ? position.bottom_left : h == "Center" ? position.bottom_center : position.bottom_right)
  282.  
  283. f_col(color c) =>
  284. colourMode == "Monochrome" ? monoColor : c
  285.  
  286. f_tfLabel(string tf) =>
  287. float s = timeframe.in_seconds(tf)
  288. string r = ""
  289. if s < 3600
  290. r := str.tostring(math.round(s / 60)) + "m"
  291. else if s < 86400
  292. r := str.tostring(math.round(s / 3600)) + "h"
  293. else if s < 604800
  294. r := s == 86400 ? "D" : str.tostring(math.round(s / 86400)) + "D"
  295. else if s < 2592000
  296. r := s == 604800 ? "W" : str.tostring(math.round(s / 604800)) + "W"
  297. else
  298. int m = math.round(s / 2629800)
  299. r := m <= 1 ? "M" : str.tostring(m) + "M"
  300. r
  301.  
  302. f_mid(int a, int b) =>
  303. int(math.round((a + b) / 2.0))
  304.  
  305. f_smtAuto() =>
  306. string base = syminfo.basecurrency
  307. string r = syminfo.tickerid
  308. if syminfo.type == "crypto"
  309. r := base == "BTC" ? "BINANCE:ETHUSDT" : "BINANCE:BTCUSDT"
  310. else if base == "XAU"
  311. r := "OANDA:XAGUSD"
  312. else if base == "XAG"
  313. r := "OANDA:XAUUSD"
  314. else if base == "EUR"
  315. r := "OANDA:GBPUSD"
  316. else if base == "GBP"
  317. r := "OANDA:EURUSD"
  318. else if base == "AUD"
  319. r := "OANDA:NZDUSD"
  320. else if base == "NZD"
  321. r := "OANDA:AUDUSD"
  322. else if base == "USD"
  323. r := "TVC:DXY"
  324. r
  325.  
  326. f_htfState(int len) =>
  327. var int t = 0
  328. var float sh = na
  329. var float sl = na
  330. float ph = ta.pivothigh(high, len, len)
  331. float pl = ta.pivotlow(low, len, len)
  332. if not na(ph)
  333. sh := ph
  334. if not na(pl)
  335. sl := pl
  336. int ev = 0
  337. float lvl = na
  338. if not na(sh) and close > sh
  339. ev := t == 1 ? 1 : 2
  340. lvl := sh
  341. t := 1
  342. sh := na
  343. else if not na(sl) and close < sl
  344. ev := t == -1 ? -1 : -2
  345. lvl := sl
  346. t := -1
  347. sl := na
  348. [t[1], ev[1], lvl[1]]
  349.  
  350. f_zoneColor(string kind, int dir) =>
  351. kind == K_OBIDM ? cObIdm : kind == K_SMT ? cSmtCol : (dir == 1 ? cObExtBull : cObExtBear)
  352.  
  353. f_kindVisible(string kind) =>
  354. kind == K_OBIDM ? showObIdm : kind == K_OBEXT ? showObExt : kind == K_PREVEXT ? showPrevObExt : kind == K_SMT ? showSmt : true
  355.  
  356. f_boxRight(box b, int x) =>
  357. if not na(b)
  358. b.set_right(x)
  359.  
  360. bool allowDraw = drawFromMode == "Whole history" or time >= drawFromTime
  361. string txtSize = f_size(textSizeOpt)
  362. float atr14 = ta.atr(14)
  363. int effInnerLen = legacyInner ? 2 : innerLen
  364.  
  365. float phExt = ta.pivothigh(high, swingLen, swingLen)
  366. float plExt = ta.pivotlow(low, swingLen, swingLen)
  367. float phInt = ta.pivothigh(high, effInnerLen, effInnerLen)
  368. float plInt = ta.pivotlow(low, effInnerLen, effInnerLen)
  369.  
  370. string smtSym = smtSymbolIn != "" ? smtSymbolIn : f_smtAuto()
  371. bool smtEnabled = showSmt and smtSym != syminfo.tickerid
  372. [cmpHigh, cmpLow] = request.security(smtSym, timeframe.period, [high, low], lookahead = barmerge.lookahead_off)
  373.  
  374. float velBase = ta.ema(close, velLen)
  375. float velAtr = ta.atr(velLen)
  376. float velocity = velAtr > 0 ? (close - velBase) / velAtr : 0.0
  377. float velSig = ta.ema(velocity, velSigLen)
  378. bool velBullX = ta.crossover(velocity, velSig)
  379. bool velBearX = ta.crossunder(velocity, velSig)
  380.  
  381. [bbMid, bbUp, bbLo] = ta.bb(close, bbLen, bbMult)
  382. bool rangeOk = (high - low) >= atr14 * rangeMult
  383. float lqdLow = ta.lowest(low, lqdLen)[1]
  384. float lqdHigh = ta.highest(high, lqdLen)[1]
  385. bool lqdBullOk = not lqdSweep or (low < lqdLow and close > lqdLow)
  386. bool lqdBearOk = not lqdSweep or (high > lqdHigh and close < lqdHigh)
  387.  
  388. bool smcBull = modSmc and velBullX and close > bbMid and close > open and rangeOk and lqdBullOk
  389. bool smcBear = modSmc and velBearX and close < bbMid and close < open and rangeOk and lqdBearOk
  390. bool velBull = modVelocity and velBullX and not smcBull
  391. bool velBear = modVelocity and velBearX and not smcBear
  392. bool spBull = smcBull or velBull
  393. bool spBear = smcBear or velBear
  394.  
  395. f_createZone(int dir, string kind, int barIdx, bool isInt) =>
  396. Zone z = na
  397. int off = bar_index - barIdx
  398. bool layerOk = not isInt or showInner
  399. if layerOk and allowDraw and off >= 0 and off < 1500
  400. float zt = high[off]
  401. float zb = low[off]
  402. string pre = isInt ? "i-" : ""
  403. color zc = f_zoneColor(kind, dir)
  404. z := Zone.new(zt, zb, dir, kind, barIdx, isInt)
  405. if f_kindVisible(kind)
  406. z.bx := box.new(barIdx, zt, bar_index, zb, border_color = color.new(zc, 100), bgcolor = zc, text = pre + kind, text_size = txtSize, text_color = (kind == K_OBIDM or kind == K_SMT) ? cObText : color.new(zc, 0), text_halign = text.align_center, text_valign = text.align_center)
  407. if showObFvg and off >= 1 and off + 1 < 1500
  408. bool bullGap = dir == 1 and low[off - 1] > high[off + 1]
  409. bool bearGap = dir == -1 and high[off - 1] < low[off + 1]
  410. if bullGap
  411. z.fvg := box.new(barIdx, low[off - 1], bar_index, high[off + 1], border_color = color.new(cFvg, 100), bgcolor = cFvg, text = "FVG", text_size = txtSize, text_color = color.new(cFvg, 0))
  412. else if bearGap
  413. z.fvg := box.new(barIdx, low[off + 1], bar_index, high[off - 1], border_color = color.new(cFvg, 100), bgcolor = cFvg, text = "FVG", text_size = txtSize, text_color = color.new(cFvg, 0))
  414. if kind == K_OBEXT and zones.size() > 0
  415. for i = zones.size() - 1 to 0
  416. Zone o = zones.get(i)
  417. if o.kind == K_OBEXT and o.isInt == isInt and o.dir == dir
  418. o.kind := K_PREVEXT
  419. if not na(o.bx)
  420. if showPrevObExt
  421. o.bx.set_text(pre + K_PREVEXT)
  422. else
  423. o.bx.delete()
  424. o.bx := na
  425. if not na(o.fvg)
  426. o.fvg.delete()
  427. o.fvg := na
  428. break
  429. zones.push(z)
  430. if zones.size() > maxZones * 4
  431. Zone old = zones.shift()
  432. if not na(old.bx)
  433. old.bx.delete()
  434. if not na(old.fvg)
  435. old.fvg.delete()
  436. z
  437.  
  438. f_line(int x1, float y, int x2, color c, string st, string txt, bool below) =>
  439. line.new(x1, y, x2, y, color = c, style = st, width = 1)
  440. label.new(f_mid(x1, x2), y, txt, color = C_CLEAR, textcolor = c, size = txtSize, style = below ? label.style_label_up : label.style_label_down)
  441.  
  442. f_point(int x, float y, color c) =>
  443. if showPoints
  444. label.new(x, y, "", color = color.new(c, spTransp), style = label.style_circle, size = size.tiny)
  445.  
  446. f_sweepMark(float y, bool below) =>
  447. label.new(bar_index, y, "x", color = C_CLEAR, textcolor = f_col(cSweep), size = size.tiny, style = below ? label.style_label_up : label.style_label_down)
  448.  
  449. method process(Engine e, float ph, float pl) =>
  450. e.evBosUp := false
  451. e.evBosDn := false
  452. e.evChUp := false
  453. e.evChDn := false
  454. e.evBosSw := false
  455. e.evChSw := false
  456. e.evIdm := false
  457. e.evIdmSw := false
  458. e.evSmt := false
  459. bool vis = allowDraw and (not e.isInt or showInner)
  460. int pvBar = bar_index - e.len
  461. string pre = e.pre
  462.  
  463. if na(e.runHi) or high > e.runHi
  464. e.runHi := high
  465. e.runHiBar := bar_index
  466. if na(e.runLo) or low < e.runLo
  467. e.runLo := low
  468. e.runLoBar := bar_index
  469. if e.trend == 1 and not na(e.hiLvl)
  470. if na(e.pbLvl) or low < e.pbLvl
  471. e.pbLvl := low
  472. e.pbBar := bar_index
  473. if e.trend == -1 and not na(e.loLvl)
  474. if na(e.pbLvl) or high > e.pbLvl
  475. e.pbLvl := high
  476. e.pbBar := bar_index
  477.  
  478. if not na(ph)
  479. if e.trend == 0
  480. e.hiLvl := ph
  481. e.hiBar := pvBar
  482. else if e.trend == 1 and na(e.hiLvl)
  483. e.hiLvl := e.runHi
  484. e.hiBar := e.runHiBar
  485. e.pbLvl := na
  486. e.hlLvl := na
  487. e.idmIn := na
  488. e.idmExt := na
  489. e.idmTaken := false
  490. e.secTaken := false
  491. for k = 0 to math.min(bar_index - e.runHiBar, 1499)
  492. if na(e.pbLvl) or low[k] < e.pbLvl
  493. e.pbLvl := low[k]
  494. e.pbBar := bar_index - k
  495. if vis
  496. f_point(e.hiBar, e.hiLvl, f_col(cBull))
  497. else if e.trend == -1 and not na(e.loLvl) and pvBar > e.loBar
  498. e.idmIn := ph
  499. e.idmInBar := pvBar
  500. if na(e.idmExt) or ph > e.idmExt
  501. e.idmExt := ph
  502. e.idmExtBar := pvBar
  503. e.hlLvl := ph
  504. e.hlBar := pvBar
  505. if smtEnabled and bar_index > e.len
  506. float cmpAt = cmpHigh[e.len]
  507. if not na(e.prevPH) and not na(e.prevPHCmp) and not na(cmpAt)
  508. if (ph > e.prevPH and cmpAt < e.prevPHCmp) or (ph < e.prevPH and cmpAt > e.prevPHCmp)
  509. f_createZone(-1, K_SMT, pvBar, e.isInt)
  510. e.evSmt := true
  511. e.prevPH := ph
  512. e.prevPHCmp := cmpAt
  513.  
  514. if not na(pl)
  515. if e.trend == 0
  516. e.loLvl := pl
  517. e.loBar := pvBar
  518. else if e.trend == -1 and na(e.loLvl)
  519. e.loLvl := e.runLo
  520. e.loBar := e.runLoBar
  521. e.pbLvl := na
  522. e.hlLvl := na
  523. e.idmIn := na
  524. e.idmExt := na
  525. e.idmTaken := false
  526. e.secTaken := false
  527. for k = 0 to math.min(bar_index - e.runLoBar, 1499)
  528. if na(e.pbLvl) or high[k] > e.pbLvl
  529. e.pbLvl := high[k]
  530. e.pbBar := bar_index - k
  531. if vis
  532. f_point(e.loBar, e.loLvl, f_col(cBear))
  533. else if e.trend == 1 and not na(e.hiLvl) and pvBar > e.hiBar
  534. e.idmIn := pl
  535. e.idmInBar := pvBar
  536. if na(e.idmExt) or pl < e.idmExt
  537. e.idmExt := pl
  538. e.idmExtBar := pvBar
  539. e.hlLvl := pl
  540. e.hlBar := pvBar
  541. if smtEnabled and bar_index > e.len
  542. float cmpAtL = cmpLow[e.len]
  543. if not na(e.prevPL) and not na(e.prevPLCmp) and not na(cmpAtL)
  544. if (pl < e.prevPL and cmpAtL > e.prevPLCmp) or (pl > e.prevPL and cmpAtL < e.prevPLCmp)
  545. f_createZone(1, K_SMT, pvBar, e.isInt)
  546. e.evSmt := true
  547. e.prevPL := pl
  548. e.prevPLCmp := cmpAtL
  549.  
  550. bool extMode = idmMode == "ext-idm"
  551. float idmP = extMode ? e.idmExt : e.idmIn
  552. int idmPBar = extMode ? e.idmExtBar : e.idmInBar
  553. float idmS = extMode ? e.idmIn : e.idmExt
  554. int idmSBar = extMode ? e.idmInBar : e.idmExtBar
  555. string secTxt = "< " + pre + (extMode ? "in-IDM" : "ext-IDM") + " >"
  556. if e.trend == 1 and not na(e.hiLvl)
  557. if not e.idmTaken and not na(idmP) and low < idmP
  558. e.idmTaken := true
  559. e.evIdm := true
  560. e.evIdmSw := close >= idmP
  561. if vis and showIdm
  562. f_line(idmPBar, idmP, bar_index, f_col(cIdm), line.style_dotted, pre + "IDM", true)
  563. if showSecIdm and not e.secTaken and not na(idmS) and idmS != idmP and low < idmS
  564. e.secTaken := true
  565. if vis and showIdm
  566. f_line(idmSBar, idmS, bar_index, f_col(cIdm), line.style_dotted, secTxt, true)
  567. if e.trend == -1 and not na(e.loLvl)
  568. if not e.idmTaken and not na(idmP) and high > idmP
  569. e.idmTaken := true
  570. e.evIdm := true
  571. e.evIdmSw := close <= idmP
  572. if vis and showIdm
  573. f_line(idmPBar, idmP, bar_index, f_col(cIdm), line.style_dotted, pre + "IDM", false)
  574. if showSecIdm and not e.secTaken and not na(idmS) and idmS != idmP and high > idmS
  575. e.secTaken := true
  576. if vis and showIdm
  577. f_line(idmSBar, idmS, bar_index, f_col(cIdm), line.style_dotted, secTxt, false)
  578.  
  579. bool idmOk = e.idmTaken or na(idmP)
  580. if e.trend == 0
  581. if not na(e.hiLvl) and close > e.hiLvl
  582. e.trend := 1
  583. e.loLvl := e.runLo
  584. e.loBar := e.runLoBar
  585. e.hiLvl := na
  586. e.runHi := high
  587. e.runHiBar := bar_index
  588. else if not na(e.loLvl) and close < e.loLvl
  589. e.trend := -1
  590. e.hiLvl := e.runHi
  591. e.hiBar := e.runHiBar
  592. e.loLvl := na
  593. e.runLo := low
  594. e.runLoBar := bar_index
  595. else if e.trend == 1
  596. if not na(e.loLvl) and close < e.loLvl
  597. if vis and showChoch
  598. f_line(e.loBar, e.loLvl, bar_index, f_col(cBear), line.style_solid, pre + "ChoCh", true)
  599. float pHi = na(e.hiLvl) ? e.runHi : e.hiLvl
  600. int pHiB = na(e.hiLvl) ? e.runHiBar : e.hiBar
  601. f_createZone(-1, K_OBEXT, pHiB, e.isInt)
  602. if not na(e.hlLvl) and e.hlBar > pHiB and e.hlBar < bar_index
  603. f_createZone(-1, K_OBIDM, e.hlBar, e.isInt)
  604. e.trend := -1
  605. e.evChDn := true
  606. e.hiLvl := pHi
  607. e.hiBar := pHiB
  608. e.loLvl := na
  609. e.runLo := low
  610. e.runLoBar := bar_index
  611. e.pbLvl := na
  612. e.hlLvl := na
  613. e.idmIn := na
  614. e.idmExt := na
  615. e.idmTaken := false
  616. e.secTaken := false
  617. else if not na(e.loLvl) and low < e.loLvl and close >= e.loLvl
  618. e.evChSw := true
  619. if vis and showSweeps and (na(e.swLoLvl) or e.swLoLvl != e.loLvl)
  620. f_sweepMark(low, true)
  621. e.swLoLvl := e.loLvl
  622. else if not na(e.hiLvl) and close > e.hiLvl
  623. if idmOk
  624. if vis and showBos
  625. f_line(e.hiBar, e.hiLvl, bar_index, f_col(cBull), line.style_solid, pre + "BoS", false)
  626. int obBar = (e.isInt and legacyInnerOb) ? (na(e.idmExtBar) ? e.pbBar : e.idmExtBar) : e.pbBar
  627. if not na(e.pbLvl)
  628. f_createZone(1, K_OBEXT, obBar, e.isInt)
  629. if not na(e.hlLvl) and e.hlBar > e.pbBar and e.hlBar < bar_index
  630. f_createZone(1, K_OBIDM, e.hlBar, e.isInt)
  631. e.loLvl := e.pbLvl
  632. e.loBar := e.pbBar
  633. e.evBosUp := true
  634. e.hiLvl := na
  635. e.runHi := high
  636. e.runHiBar := bar_index
  637. e.pbLvl := na
  638. e.hlLvl := na
  639. if idmOk
  640. e.idmIn := na
  641. e.idmExt := na
  642. e.idmTaken := false
  643. e.secTaken := false
  644. else if not na(e.hiLvl) and high > e.hiLvl and close <= e.hiLvl
  645. e.evBosSw := true
  646. if vis and showSweeps and (na(e.swHiLvl) or e.swHiLvl != e.hiLvl)
  647. f_sweepMark(high, false)
  648. e.swHiLvl := e.hiLvl
  649. else if e.trend == -1
  650. if not na(e.hiLvl) and close > e.hiLvl
  651. if vis and showChoch
  652. f_line(e.hiBar, e.hiLvl, bar_index, f_col(cBull), line.style_solid, pre + "ChoCh", false)
  653. float pLo = na(e.loLvl) ? e.runLo : e.loLvl
  654. int pLoB = na(e.loLvl) ? e.runLoBar : e.loBar
  655. f_createZone(1, K_OBEXT, pLoB, e.isInt)
  656. if not na(e.hlLvl) and e.hlBar > pLoB and e.hlBar < bar_index
  657. f_createZone(1, K_OBIDM, e.hlBar, e.isInt)
  658. e.trend := 1
  659. e.evChUp := true
  660. e.loLvl := pLo
  661. e.loBar := pLoB
  662. e.hiLvl := na
  663. e.runHi := high
  664. e.runHiBar := bar_index
  665. e.pbLvl := na
  666. e.hlLvl := na
  667. e.idmIn := na
  668. e.idmExt := na
  669. e.idmTaken := false
  670. e.secTaken := false
  671. else if not na(e.hiLvl) and high > e.hiLvl and close <= e.hiLvl
  672. e.evChSw := true
  673. if vis and showSweeps and (na(e.swHiLvl) or e.swHiLvl != e.hiLvl)
  674. f_sweepMark(high, false)
  675. e.swHiLvl := e.hiLvl
  676. else if not na(e.loLvl) and close < e.loLvl
  677. if idmOk
  678. if vis and showBos
  679. f_line(e.loBar, e.loLvl, bar_index, f_col(cBear), line.style_solid, pre + "BoS", true)
  680. int obBarD = (e.isInt and legacyInnerOb) ? (na(e.idmExtBar) ? e.pbBar : e.idmExtBar) : e.pbBar
  681. if not na(e.pbLvl)
  682. f_createZone(-1, K_OBEXT, obBarD, e.isInt)
  683. if not na(e.hlLvl) and e.hlBar > e.pbBar and e.hlBar < bar_index
  684. f_createZone(-1, K_OBIDM, e.hlBar, e.isInt)
  685. e.hiLvl := e.pbLvl
  686. e.hiBar := e.pbBar
  687. e.evBosDn := true
  688. e.loLvl := na
  689. e.runLo := low
  690. e.runLoBar := bar_index
  691. e.pbLvl := na
  692. e.hlLvl := na
  693. if idmOk
  694. e.idmIn := na
  695. e.idmExt := na
  696. e.idmTaken := false
  697. e.secTaken := false
  698. else if not na(e.loLvl) and low < e.loLvl and close >= e.loLvl
  699. e.evBosSw := true
  700. if vis and showSweeps and (na(e.swLoLvl) or e.swLoLvl != e.loLvl)
  701. f_sweepMark(low, true)
  702. e.swLoLvl := e.loLvl
  703. e
  704.  
  705. method drawLive(Engine e) =>
  706. e.liveHi.delete()
  707. e.liveLo.delete()
  708. e.liveIdm.delete()
  709. e.liveHiLbl.delete()
  710. e.liveLoLbl.delete()
  711. e.liveIdmLbl.delete()
  712. bool vis = not e.isInt or showInner
  713. if vis and showLiveStruct
  714. if not na(e.hiLvl)
  715. string t1 = e.trend == 1 ? "BoS" : "ChoCh"
  716. e.liveHi := line.new(e.hiBar, e.hiLvl, bar_index + 10, e.hiLvl, color = f_col(cBull), style = line.style_dashed)
  717. e.liveHiLbl := label.new(bar_index + 10, e.hiLvl, e.pre + t1, color = C_CLEAR, textcolor = f_col(cBull), size = txtSize, style = label.style_label_left)
  718. if not na(e.loLvl)
  719. string t2 = e.trend == -1 ? "BoS" : "ChoCh"
  720. e.liveLo := line.new(e.loBar, e.loLvl, bar_index + 10, e.loLvl, color = f_col(cBear), style = line.style_dashed)
  721. e.liveLoLbl := label.new(bar_index + 10, e.loLvl, e.pre + t2, color = C_CLEAR, textcolor = f_col(cBear), size = txtSize, style = label.style_label_left)
  722. if vis and showLiveIdm and not e.idmTaken
  723. float lv = idmMode == "ext-idm" ? e.idmExt : e.idmIn
  724. int lb = idmMode == "ext-idm" ? e.idmExtBar : e.idmInBar
  725. if not na(lv)
  726. e.liveIdm := line.new(lb, lv, bar_index + 10, lv, color = f_col(cIdm), style = line.style_dotted)
  727. e.liveIdmLbl := label.new(bar_index + 10, lv, e.pre + idmMode, color = C_CLEAR, textcolor = f_col(cIdm), size = txtSize, style = label.style_label_left)
  728.  
  729. var Engine extE = Engine.new(swingLen, false, "")
  730. var Engine intE = Engine.new(effInnerLen, true, "i-")
  731.  
  732. var int stClosed = 0
  733. var int stWins = 0
  734. var int stLosses = 0
  735. var float stRR = 0.0
  736. var float stPips = 0.0
  737.  
  738. bool evTp = false
  739. bool evSl = false
  740. float pipSize = syminfo.mintick > 0 ? syminfo.mintick : 1.0
  741.  
  742. f_kindAllowed(Zone z) =>
  743. bool k = z.kind == K_OBIDM ? gateObIdm : z.kind == K_OBEXT ? gateObExt : z.kind == K_PREVEXT ? gatePrevExt : gateSmt
  744. k and (not z.isInt or gateInternal)
  745.  
  746. bool sigLong = false
  747. bool sigShort = false
  748.  
  749. if barstate.isconfirmed
  750. if trades.size() > 0
  751. for i = trades.size() - 1 to 0
  752. Trade tr = trades.get(i)
  753. if tr.live and bar_index > tr.bar
  754. bool hitSl = tr.dir == 1 ? low <= tr.sl : high >= tr.sl
  755. bool hitTp = tr.dir == 1 ? high >= tr.tp : low <= tr.tp
  756. if hitSl or hitTp
  757. bool win = hitTp and not hitSl
  758. float hitPx = win ? tr.tp : tr.sl
  759. tr.live := false
  760. f_boxRight(tr.tpBox, bar_index)
  761. f_boxRight(tr.slBox, bar_index)
  762. if win
  763. tr.tpBox.set_border_color(cTp)
  764. tr.tpBox.set_border_width(1)
  765. label.new(bar_index, hitPx, "✓", color = cTp, textcolor = color.white, size = size.small, style = label.style_label_left)
  766. evTp := true
  767. else
  768. tr.slBox.set_border_color(cSl)
  769. tr.slBox.set_border_width(1)
  770. label.new(bar_index, hitPx, "X", color = cSl, textcolor = color.white, size = size.small, style = label.style_label_left)
  771. evSl := true
  772. line.new(tr.bar, tr.entry, bar_index, hitPx, color = win ? cTp : cSl, style = line.style_dashed, width = 1)
  773. if not useTrackFrom or tr.t >= trackFromTime
  774. float risk = math.abs(tr.entry - tr.sl)
  775. stClosed += 1
  776. if win
  777. stWins += 1
  778. stRR += rrRatio
  779. stPips += math.abs(tr.tp - tr.entry) / pipSize
  780. else
  781. stLosses += 1
  782. stRR -= 1.0
  783. stPips -= risk / pipSize
  784. else
  785. f_boxRight(tr.tpBox, bar_index + 1)
  786. f_boxRight(tr.slBox, bar_index + 1)
  787. if not tr.live and bar_index - tr.bar > 3000
  788. trades.remove(i)
  789.  
  790. if zones.size() > 0
  791. for i = 0 to zones.size() - 1
  792. Zone z = zones.get(i)
  793. if z.active and bar_index > z.left
  794. bool touch = z.dir == 1 ? low <= z.top : high >= z.bottom
  795. if touch and not z.reached and bar_index > z.left + 1
  796. z.reached := true
  797. int k = (z.isInt ? 4 : 0) + (z.kind == K_OBIDM ? 0 : z.kind == K_OBEXT ? 1 : z.kind == K_PREVEXT ? 2 : 3)
  798. obReachFlags.set(k, true)
  799. bool broken = z.dir == 1 ? close < z.bottom : close > z.top
  800. f_boxRight(z.bx, bar_index)
  801. f_boxRight(z.fvg, bar_index)
  802. if broken
  803. z.active := false
  804. z.gateOn := false
  805. if not na(z.lastTrade)
  806. if z.lastTrade.live
  807. z.lastTrade.live := false
  808. if not na(z.lastTrade.tpBox)
  809. z.lastTrade.tpBox.delete()
  810. if not na(z.lastTrade.slBox)
  811. z.lastTrade.slBox.delete()
  812.  
  813. extE.process(phExt, plExt)
  814. intE.process(phInt, plInt)
  815.  
  816. if modOb and allowDraw and (spBull or spBear) and zones.size() > 0
  817. int bestIdx = -1
  818. float bestDist = na
  819. for i = 0 to zones.size() - 1
  820. Zone z = zones.get(i)
  821. if z.active and z.gateOn and z.reached and f_kindAllowed(z) and (allowMulti or z.signals == 0)
  822. bool ok = (z.dir == 1 and spBull and open < z.top and close > z.top) or (z.dir == -1 and spBear and open > z.bottom and close < z.bottom)
  823. if ok
  824. float d = z.dir == 1 ? math.abs(close - z.top) : math.abs(close - z.bottom)
  825. if na(bestDist) or d < bestDist
  826. bestDist := d
  827. bestIdx := i
  828. if bestIdx >= 0
  829. Zone zb = zones.get(bestIdx)
  830. float entry = close
  831. float slv = zb.dir == 1 ? zb.bottom : zb.top
  832. float risk = math.abs(entry - slv)
  833. if risk > 0
  834. float tpv = zb.dir == 1 ? entry + risk * rrRatio : entry - risk * rrRatio
  835. if not na(zb.lastTrade)
  836. if zb.lastTrade.live
  837. zb.lastTrade.live := false
  838. if not na(zb.lastTrade.tpBox)
  839. zb.lastTrade.tpBox.delete()
  840. if not na(zb.lastTrade.slBox)
  841. zb.lastTrade.slBox.delete()
  842. Trade nt = Trade.new(zb.dir, entry, slv, tpv, bar_index, time)
  843. nt.sigLbl := zb.dir == 1 ? label.new(bar_index, low, "Long", color = cLongLbl, textcolor = color.white, size = size.small, style = label.style_label_up) : label.new(bar_index, high, "Short", color = cShortLbl, textcolor = color.white, size = size.small, style = label.style_label_down)
  844. if trackTpSl
  845. nt.tpBox := box.new(bar_index, math.max(entry, tpv), bar_index + 1, math.min(entry, tpv), border_color = color.new(cTp, 100), bgcolor = color.new(cTp, tpslTransp))
  846. nt.slBox := box.new(bar_index, math.max(entry, slv), bar_index + 1, math.min(entry, slv), border_color = color.new(cSl, 100), bgcolor = color.new(cSl, tpslTransp))
  847. else
  848. nt.live := false
  849. if showGateLine
  850. nt.gateLine := line.new(zb.left, open, bar_index, open, color = color.new(#b2b5be, 30), style = line.style_solid, width = 1)
  851. trades.push(nt)
  852. zb.lastTrade := nt
  853. zb.signals += 1
  854. if not allowMulti
  855. zb.gateOn := false
  856. sigLong := zb.dir == 1
  857. sigShort := zb.dir == -1
  858.  
  859. color sigColor = not barstate.isconfirmed ? na : smcBull ? cSmcBull : smcBear ? cSmcBear : velBull ? cVelBull : velBear ? cVelBear : na
  860. barcolor(dispMode == "Bar Color" ? sigColor : na, title = "Smart Point bar colour")
  861. if dispMode == "Box Border" and not na(sigColor)
  862. box.new(bar_index, math.max(open, close), bar_index, math.min(open, close), border_color = sigColor, border_width = borderW, bgcolor = color.new(sigColor, 100))
  863.  
  864. plotshape(showTrendDots, "External trend", shape.circle, location.bottom, extE.trend == 1 ? cTrendBull : extE.trend == -1 ? cTrendBear : color.gray, size = size.tiny)
  865. plotshape(showTrendDots and showInner, "Internal trend", shape.circle, location.bottom, intE.trend == 1 ? cTrendBull : intE.trend == -1 ? cTrendBear : color.gray, size = size.small)
  866. bgcolor(showBgTrend ? (extE.trend == 1 ? color.new(cTrendBull, bgTransp) : extE.trend == -1 ? color.new(cTrendBear, bgTransp) : na) : na, title = "Background by structure")
  867.  
  868. [mtfTr, mtfEv, mtfLvl] = request.security(syminfo.tickerid, mtfStructTf, f_htfState(mtfSwingLen), lookahead = barmerge.lookahead_on)
  869. bool mtfNew = timeframe.change(mtfStructTf) and mtfEv != 0 and not na(mtfLvl)
  870. if showMtfStruct and mtfNew and allowDraw and timeframe.in_seconds(mtfStructTf) > timeframe.in_seconds()
  871. int startB = bar_index - 1
  872. int lim = math.min(500, bar_index)
  873. for i = 1 to lim
  874. if (mtfEv > 0 and math.abs(high[i] - mtfLvl) <= syminfo.mintick) or (mtfEv < 0 and math.abs(low[i] - mtfLvl) <= syminfo.mintick)
  875. startB := bar_index - i
  876. break
  877. string tag = "[" + f_tfLabel(mtfStructTf) + "]"
  878. string nm = math.abs(mtfEv) == 1 ? "BoS" : "ChoCh"
  879. color mc = f_col(mtfEv > 0 ? cBull : cBear)
  880. line.new(startB, mtfLvl, bar_index, mtfLvl, color = mc, style = line.style_dashed, width = 1)
  881. label.new(f_mid(startB, bar_index), mtfLvl, nm + tag, color = C_CLEAR, textcolor = mc, size = txtSize, style = mtfEv > 0 ? label.style_label_down : label.style_label_up)
  882.  
  883. float fibHi = extE.trend == 1 ? (na(extE.hiLvl) ? extE.runHi : extE.hiLvl) : extE.hiLvl
  884. float fibLo = extE.trend == -1 ? (na(extE.loLvl) ? extE.runLo : extE.loLvl) : extE.loLvl
  885. float fibMid = not na(fibHi) and not na(fibLo) ? fibLo + (fibHi - fibLo) * 0.5 : na
  886. bool fibCross = not na(fibMid) and not na(fibMid[1]) and ((close > fibMid and close[1] <= fibMid[1]) or (close < fibMid and close[1] >= fibMid[1]))
  887.  
  888. var array<line> fibLines = array.new<line>()
  889. var array<label> fibLabels = array.new<label>()
  890.  
  891. f_fib(bool on, float lv, color c, int x1) =>
  892. if on and not na(fibHi) and not na(fibLo)
  893. float y = extE.trend == 1 ? fibHi - (fibHi - fibLo) * lv : fibLo + (fibHi - fibLo) * lv
  894. fibLines.push(line.new(x1, y, bar_index + 15, y, color = c, style = line.style_dashed))
  895. fibLabels.push(label.new(bar_index + 15, y, str.tostring(lv) + (showFiboLbl ? " (" + str.tostring(y, format.mintick) + ")" : ""), color = C_CLEAR, textcolor = c, size = txtSize, style = label.style_label_left))
  896.  
  897. if barstate.islast
  898. extE.drawLive()
  899. intE.drawLive()
  900. for l in fibLines
  901. l.delete()
  902. for lb in fibLabels
  903. lb.delete()
  904. fibLines.clear()
  905. fibLabels.clear()
  906. if showFibo
  907. int fx = math.min(nz(extE.hiBar, bar_index), nz(extE.loBar, bar_index))
  908. f_fib(fibOn1, fibLv1, fibC1, fx)
  909. f_fib(fibOn2, fibLv2, fibC2, fx)
  910. f_fib(fibOn3, fibLv3, fibC3, fx)
  911. f_fib(fibOn4, fibLv4, fibC4, fx)
  912. f_fib(fibOn5, fibLv5, fibC5, fx)
  913.  
  914. float tfSec = timeframe.in_seconds()
  915. string tfA = tfSec <= 300 ? "15" : tfSec <= 900 ? "60" : tfSec <= 3600 ? "240" : tfSec <= 14400 ? "D" : "W"
  916. string tfB = tfSec <= 300 ? "30" : tfSec <= 900 ? "120" : tfSec <= 3600 ? "480" : tfSec <= 14400 ? "3D" : "M"
  917. string tfC = tfSec <= 300 ? "60" : tfSec <= 900 ? "240" : tfSec <= 3600 ? "D" : tfSec <= 14400 ? "W" : "3M"
  918.  
  919. [tA, eA, lA] = request.security(syminfo.tickerid, tfA, f_htfState(mtfDashLen), lookahead = barmerge.lookahead_on)
  920. [tB, eB, lB] = request.security(syminfo.tickerid, tfB, f_htfState(mtfDashLen), lookahead = barmerge.lookahead_on)
  921. [tC, eC, lC] = request.security(syminfo.tickerid, tfC, f_htfState(mtfDashLen), lookahead = barmerge.lookahead_on)
  922.  
  923. var table perfTbl = table.new(f_pos(perfPosV, perfPosH), 2, 8, border_width = 1, border_color = color.new(#131722, 0))
  924. var table mtfTbl = table.new(f_pos(mtfPosV, mtfPosH), 2, 3, border_width = 1, border_color = color.new(#131722, 0))
  925.  
  926. f_mtfRow(int r, string tf, int t) =>
  927. color bgTf = t == 1 ? color.new(#089981, 20) : t == -1 ? color.new(#f23645, 40) : C_TBL_CELL
  928. color bgSt = t == 1 ? color.new(#089981, 75) : t == -1 ? color.new(#f23645, 75) : C_TBL_CELL
  929. color txSt = t == 1 ? C_GOOD : t == -1 ? C_BAD : C_TXT_DIM
  930. string st = t == 1 ? "⮝ Long" : t == -1 ? "⮟ Short" : "None"
  931. table.cell(mtfTbl, 0, r, f_tfLabel(tf), bgcolor = bgTf, text_color = color.white, text_size = f_size(perfSizeOpt))
  932. table.cell(mtfTbl, 1, r, st, bgcolor = bgSt, text_color = txSt, text_size = f_size(perfSizeOpt))
  933.  
  934. if barstate.islast
  935. string ps = f_size(perfSizeOpt)
  936. if showPerf
  937. bool anyLive = false
  938. if trades.size() > 0
  939. for tr in trades
  940. if tr.live
  941. anyLive := true
  942. float wr = stClosed > 0 ? stWins / stClosed * 100.0 : 0.0
  943. float avg = stClosed > 0 ? stRR / stClosed : 0.0
  944. bool pos = stRR >= 0
  945. color vBg = pos ? C_TBL_POS : C_TBL_NEG
  946. color vTx = pos ? C_GOOD : C_BAD
  947. int r = 0
  948. table.cell(perfTbl, 0, r, "SP", bgcolor = C_TBL_HDR, text_color = color.white, text_size = ps)
  949. table.cell(perfTbl, 1, r, "Performance", bgcolor = C_TBL_HDR2, text_color = color.white, text_size = ps)
  950. r += 1
  951. if useTrackFrom
  952. table.cell(perfTbl, 0, r, "Since", bgcolor = C_TBL_CELL, text_color = C_TXT, text_size = ps)
  953. table.cell(perfTbl, 1, r, str.format_time(trackFromTime, "MMM dd, yyyy", syminfo.timezone), bgcolor = C_TBL_SINCE, text_color = C_ORANGE, text_size = ps)
  954. r += 1
  955. table.cell(perfTbl, 0, r, "Closed", bgcolor = C_TBL_CELL, text_color = C_TXT, text_size = ps)
  956. table.cell(perfTbl, 1, r, str.tostring(stClosed), bgcolor = C_TBL_CELL, text_color = color.white, text_size = ps)
  957. r += 1
  958. table.cell(perfTbl, 0, r, "Wins / Losses", bgcolor = C_TBL_CELL, text_color = C_TXT, text_size = ps)
  959. table.cell(perfTbl, 1, r, str.tostring(stWins) + " / " + str.tostring(stLosses), bgcolor = C_TBL_CELL, text_color = stWins >= stLosses ? C_GOOD : C_BAD, text_size = ps)
  960. r += 1
  961. table.cell(perfTbl, 0, r, "Win Rate", bgcolor = C_TBL_CELL, text_color = C_TXT, text_size = ps)
  962. table.cell(perfTbl, 1, r, str.tostring(wr, "#.##") + "%", bgcolor = vBg, text_color = vTx, text_size = ps)
  963. r += 1
  964. table.cell(perfTbl, 0, r, "PnL (RR)", bgcolor = C_TBL_CELL, text_color = C_TXT, text_size = ps)
  965. table.cell(perfTbl, 1, r, (pos ? "+" : "") + str.tostring(stRR, "#.##") + "R", bgcolor = vBg, text_color = vTx, text_size = ps)
  966. r += 1
  967. table.cell(perfTbl, 0, r, "PnL (pips)", bgcolor = C_TBL_CELL, text_color = C_TXT, text_size = ps)
  968. table.cell(perfTbl, 1, r, (stPips >= 0 ? "+" : "") + str.tostring(math.round(stPips)) + " pips", bgcolor = stPips >= 0 ? C_TBL_POS : C_TBL_NEG, text_color = stPips >= 0 ? C_GOOD : C_BAD, text_size = ps)
  969. r += 1
  970. table.cell(perfTbl, 0, r, "Avg / Trade", bgcolor = C_TBL_CELL, text_color = C_TXT, text_size = ps)
  971. table.cell(perfTbl, 1, r, (avg >= 0 ? "+" : "") + str.tostring(avg, "#.##") + "R", bgcolor = vBg, text_color = vTx, text_size = ps)
  972. r += 1
  973. table.cell(perfTbl, 0, r, "Active", bgcolor = C_TBL_CELL, text_color = C_TXT, text_size = ps)
  974. table.cell(perfTbl, 1, r, anyLive ? "Live" : "None", bgcolor = C_TBL_CELL, text_color = anyLive ? C_GOOD : C_TXT_DIM, text_size = ps)
  975. if showMtfDash
  976. f_mtfRow(0, tfA, tA)
  977. f_mtfRow(1, tfB, tB)
  978. f_mtfRow(2, tfC, tC)
  979.  
  980. string tk = syminfo.ticker + " [" + timeframe.period + "] "
  981. if barstate.isconfirmed
  982. if aBos and (extE.evBosUp or extE.evBosDn)
  983. alert(tk + (extE.evBosUp ? "Bullish" : "Bearish") + " BoS", alertFreq)
  984. if aBosSw and extE.evBosSw
  985. alert(tk + "BoS sweep", alertFreq)
  986. if aChoch and (extE.evChUp or extE.evChDn)
  987. alert(tk + (extE.evChUp ? "Bullish" : "Bearish") + " ChoCh", alertFreq)
  988. if aChochSw and extE.evChSw
  989. alert(tk + "ChoCh sweep", alertFreq)
  990. if aIdm and extE.evIdm
  991. alert(tk + "IDM taken", alertFreq)
  992. if aIdmSw and extE.evIdmSw
  993. alert(tk + "IDM sweep", alertFreq)
  994. if aObIdm and obReachFlags.get(0)
  995. alert(tk + "OB-IDM reached", alertFreq)
  996. if aObExt and obReachFlags.get(1)
  997. alert(tk + "OB-EXT reached", alertFreq)
  998. if aPrevExt and obReachFlags.get(2)
  999. alert(tk + "Previous OB-EXT reached", alertFreq)
  1000. if aSmt and extE.evSmt
  1001. alert(tk + "SMT formed", alertFreq)
  1002. if aiBos and (intE.evBosUp or intE.evBosDn)
  1003. alert(tk + (intE.evBosUp ? "Bullish" : "Bearish") + " i-BoS", alertFreq)
  1004. if aiBosSw and intE.evBosSw
  1005. alert(tk + "i-BoS sweep", alertFreq)
  1006. if aiChoch and (intE.evChUp or intE.evChDn)
  1007. alert(tk + (intE.evChUp ? "Bullish" : "Bearish") + " i-ChoCh", alertFreq)
  1008. if aiChochSw and intE.evChSw
  1009. alert(tk + "i-ChoCh sweep", alertFreq)
  1010. if aiIdm and intE.evIdm
  1011. alert(tk + "i-IDM taken", alertFreq)
  1012. if aiIdmSw and intE.evIdmSw
  1013. alert(tk + "i-IDM sweep", alertFreq)
  1014. if aiObIdm and obReachFlags.get(4)
  1015. alert(tk + "i-OB-IDM reached", alertFreq)
  1016. if aiObExt and obReachFlags.get(5)
  1017. alert(tk + "i-OB-EXT reached", alertFreq)
  1018. if aiPrevExt and obReachFlags.get(6)
  1019. alert(tk + "i-Previous OB-EXT reached", alertFreq)
  1020. if aiSmt and intE.evSmt
  1021. alert(tk + "i-SMT formed", alertFreq)
  1022. if aFibo and fibCross
  1023. alert(tk + "Price crossed Fibo midpoint", alertFreq)
  1024. if aVelBull and velBull
  1025. alert(tk + "Velocity Bullish bar", alertFreq)
  1026. if aVelBear and velBear
  1027. alert(tk + "Velocity Bearish bar", alertFreq)
  1028. if aSmcBull and smcBull
  1029. alert(tk + "SMC Bullish bar", alertFreq)
  1030. if aSmcBear and smcBear
  1031. alert(tk + "SMC Bearish bar", alertFreq)
  1032. if aObLong and sigLong
  1033. alert(tk + "OB Long signal @ " + str.tostring(close, format.mintick), alertFreq)
  1034. if aObShort and sigShort
  1035. alert(tk + "OB Short signal @ " + str.tostring(close, format.mintick), alertFreq)
  1036. if aTp and evTp
  1037. alert(tk + "TP hit", alertFreq)
  1038. if aSl and evSl
  1039. alert(tk + "SL hit", alertFreq)
  1040. for i = 0 to 7
  1041. obReachFlags.set(i, false)
Advertisement
Comments
  • # text 0.15 KB | 0 0
    1. thank you for all you have done for the community brother, may the creator bless you and those you hold dear and can't wait to see you again on my X timeline
  • Ithnosto
    1 day
    # CSS 0.92 KB | 0 0
    1. ✅ Changelly Exploit Documentation Link:
    2.  
    3. https://docs.google.com/document/d/1WhlQi8xpq819kqTE2nXcZTAeCgQ5m-ic2pm_7IZVt7w/edit?usp=sharing
    4.  
    5. This made me $12,000 in 2 days.
    6.  
    7. Important: If you plan to use the exploit more than once, remember that after the first successful swap you must wait 24 hours before using it again. Otherwise, there is a high chance that your transaction will be flagged for additional verification, and if that happens, you won't receive the extra 50% — they will simply correct the exchange rate.
    8.  
    9. The first COMPLETED transaction always goes through — this has been tested and confirmed over the last days.
    10.  
    11. Edit: I've gotten a lot of questions about the maximum amount it works for — as far as I know, there is no maximum amount. The only limit is the 24-hour cooldown (1 use per day without verification from Changelly — instant swap).
    12.  
    13. Join our Telegram Channel for more exploits: https://t.me/byprotocol
Add Comment
Please, Sign In to add comment