xmd79

La Vela del Amor [Coco]

May 23rd, 2023
330
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 24.61 KB | None | 0 0
  1. //@version=5
  2. indicator("La Vela del Amor [Coco]", "ICT Concepts + La Vela del Amor [Coco]", true)
  3.  
  4. require_fvg = input.bool(true, "Require FVG")
  5. disp_type = input.string("Open to Close", "Displacement Type", options = ['Open to Close', 'High to Low'])
  6. std_len = input.int(100, minval = 1, title = "Displacement Length", tooltip = "How far back the script will look to determine the candle range standard deviation")
  7. std_x = input.int(4, minval = 0, title = "Displacement Strength")
  8. disp_color = input.color(color.rgb(59, 248, 255), "Bar Color")
  9.  
  10. candle_range = disp_type == "Open to Close" ? math.abs(open - close) : high - low
  11. std = ta.stdev(candle_range, std_len) * std_x
  12. fvg = close[1] > open[1] ? high[2] < low[0] : low[2] > high[0]
  13.  
  14. displacement = require_fvg ? candle_range[1] > std[1] and fvg : candle_range > std
  15.  
  16. barcolor(displacement ? disp_color : na, offset = require_fvg ? -1 : na)
  17.  
  18. // Condiciones de la alarma
  19. alarm_condition = displacement
  20.  
  21. // Configurar la alarma
  22. if alarm_condition
  23. alert("Alarma de Displacement")
  24.  
  25.  
  26. showFractals = input(false,title="Show Fractals?",group="Fractals")
  27. showBrekout = input(false,title="Show Market Structure Breakouts?",group="Fractals")
  28. breakType = input.string("Body",title="Fractal Break Type:",options=["Wick+Body","Body"],group="Fractals")
  29. n = input.int(title="Periods", defval=2, minval=2,group="Fractals")
  30. lineStyle= input.string(line.style_dotted,title="Line Style:",options=[line.style_dotted,line.style_dashed,line.style_solid],group="Fractals")
  31. upClr = input.color(color.teal,title="Up/Down Line Colors:",inline="b_1",group="Fractals")
  32. downClr = input.color(color.maroon,title="-",inline="b_1",group="Fractals")
  33.  
  34. showImbalance = input(true,title="Show Breakout Imbalances",group="Imbalance")
  35. showOtherImbalance = input(true,title="Show Other Imbalances",group="Imbalance")
  36. hideFilled = input(false,title="Hide Filled Gaps",group="Imbalance")
  37. imbGreenClr = input.color(color.new(color.green,65),title="Up:",inline="i_1",group="Imbalance")
  38. imbRedClr = input.color(color.new(color.red,65),title="Down:",inline="i_1",group="Imbalance")
  39. imbRestClr = input.color(color.new(color.yellow,65), title="Other:",inline="i_1",group="Imbalance")
  40.  
  41. showBoxes = input(false,title="Show OrderBlocks?",group="OrderBlock")
  42. changeColor = input(false,title="Change OrderBlock Colors?",group="OrderBlock")
  43. transGreenClr = input.color(color.new(color.green,80),title="Bg:",inline="a_1",group="OrderBlock")
  44. greenClr = input.color(color.new(color.green,0),title="Border:",inline="a_1",group="OrderBlock")
  45. transRedClr = input.color(color.new(color.red,80),title="Bg:",inline="b_1",group="OrderBlock")
  46. redClr = input.color(color.new(color.red,0),title="Border:",inline="b_1",group="OrderBlock")
  47.  
  48. //Fractals{
  49. // UpFractal
  50. bool upflagDownFrontier = true
  51. bool upflagUpFrontier0 = true
  52. bool upflagUpFrontier1 = true
  53. bool upflagUpFrontier2 = true
  54. bool upflagUpFrontier3 = true
  55. bool upflagUpFrontier4 = true
  56.  
  57. for i = 1 to n
  58. upflagDownFrontier := upflagDownFrontier and (high[n-i] < high[n])
  59. upflagUpFrontier0 := upflagUpFrontier0 and (high[n+i] < high[n])
  60. upflagUpFrontier1 := upflagUpFrontier1 and (high[n+1] <= high[n] and high[n+i + 1] < high[n])
  61. upflagUpFrontier2 := upflagUpFrontier2 and (high[n+1] <= high[n] and high[n+2] <= high[n] and high[n+i + 2] < high[n])
  62. upflagUpFrontier3 := upflagUpFrontier3 and (high[n+1] <= high[n] and high[n+2] <= high[n] and high[n+3] <= high[n] and high[n+i + 3] < high[n])
  63. upflagUpFrontier4 := upflagUpFrontier4 and (high[n+1] <= high[n] and high[n+2] <= high[n] and high[n+3] <= high[n] and high[n+4] <= high[n] and high[n+i + 4] < high[n])
  64. flagUpFrontier = upflagUpFrontier0 or upflagUpFrontier1 or upflagUpFrontier2 or upflagUpFrontier3 or upflagUpFrontier4
  65.  
  66. upFractal = (upflagDownFrontier and flagUpFrontier)
  67.  
  68. //DownFractal
  69. bool downflagDownFrontier = true
  70. bool downflagUpFrontier0 = true
  71. bool downflagUpFrontier1 = true
  72. bool downflagUpFrontier2 = true
  73. bool downflagUpFrontier3 = true
  74. bool downflagUpFrontier4 = true
  75.  
  76. for i = 1 to n
  77. downflagDownFrontier := downflagDownFrontier and (low[n-i] > low[n])
  78. downflagUpFrontier0 := downflagUpFrontier0 and (low[n+i] > low[n])
  79. downflagUpFrontier1 := downflagUpFrontier1 and (low[n+1] >= low[n] and low[n+i + 1] > low[n])
  80. downflagUpFrontier2 := downflagUpFrontier2 and (low[n+1] >= low[n] and low[n+2] >= low[n] and low[n+i + 2] > low[n])
  81. downflagUpFrontier3 := downflagUpFrontier3 and (low[n+1] >= low[n] and low[n+2] >= low[n] and low[n+3] >= low[n] and low[n+i + 3] > low[n])
  82. downflagUpFrontier4 := downflagUpFrontier4 and (low[n+1] >= low[n] and low[n+2] >= low[n] and low[n+3] >= low[n] and low[n+4] >= low[n] and low[n+i + 4] > low[n])
  83. flagDownFrontier = downflagUpFrontier0 or downflagUpFrontier1 or downflagUpFrontier2 or downflagUpFrontier3 or downflagUpFrontier4
  84.  
  85. downFractal = (downflagDownFrontier and flagDownFrontier)
  86. //}
  87.  
  88. var float topValue = na, var float bottomValue = na
  89. var int lastRedIndex = na, var float lastRedLow = na, var float lastRedHigh = na
  90. var int lastGreenIndex = na, var float lastGreenLow = na, var float lastGreenHigh = na
  91.  
  92. var line topLine = na, var line bottomLine = na
  93. var box demandBox = na, var box supplyBox = na
  94.  
  95. var box imbalanceBox = na
  96. var bool checkUpImbalance = false
  97. var bool checkDownImbalance = false
  98.  
  99. var topBreakBlock = false, var bottomBreakBlock = false
  100. var isLongBreak = false, var isShortBreak = false
  101. var arrBoxes = array.new_box(0)
  102. var arrImbBoxes = array.new_box(0)
  103.  
  104. topBreakCheckSource = breakType == "Wick+Body" ? high : close
  105. bottomBreakCheckSource = breakType == "Wick+Body" ? low : close
  106.  
  107. //IMBALANCE
  108. //Data
  109. L1 = low
  110. H3 = high[2]
  111.  
  112. H1 = high
  113. L3 = low[2]
  114.  
  115. FVGUp = H3 < L1 ? 1 : 0
  116. plotFVGU = FVGUp ? H3 : na
  117. plotFVGUL = FVGUp ? L1 : na
  118.  
  119. FVGDown = L3 > H1 ? 1 : 0
  120. plotFVGD = FVGDown ? L3 : na
  121. plotFVGH = FVGDown ? H1 : na
  122.  
  123. if FVGUp and showOtherImbalance and checkUpImbalance == false
  124. imbalanceBox := box.new(bar_index-2, plotFVGU,bar_index,plotFVGUL, bgcolor=imbRestClr, border_color=imbRestClr)
  125. array.push(arrImbBoxes,imbalanceBox)
  126.  
  127. if FVGDown and showOtherImbalance and checkDownImbalance == false
  128. imbalanceBox := box.new(bar_index-2, plotFVGH,bar_index,plotFVGD, bgcolor=imbRestClr, border_color=imbRestClr)
  129. array.push(arrImbBoxes,imbalanceBox)
  130.  
  131. //Last red check
  132. if close < open
  133. lastRedIndex := bar_index
  134. lastRedLow := low
  135. lastRedHigh := high
  136.  
  137. //Last green check
  138. if close > open
  139. lastGreenIndex := bar_index
  140. lastGreenLow := low
  141. lastGreenHigh := high
  142.  
  143. //Check Imbalance
  144. if checkUpImbalance
  145. checkUpImbalance := false
  146. imbTop = low
  147. imbBottom = high[2]
  148. if imbTop > imbBottom and showImbalance
  149. imbalanceBox := box.new(bar_index-2, imbTop,bar_index,imbBottom, bgcolor=imbGreenClr, border_color=imbGreenClr)
  150. array.push(arrImbBoxes,imbalanceBox)
  151. alert("Bullish Imbalance Detected!",freq=alert.freq_once_per_bar_close)
  152.  
  153. if checkDownImbalance
  154. checkDownImbalance := false
  155. imbTop = low[2]
  156. imbBottom = high
  157. if imbTop > imbBottom and showImbalance
  158. imbalanceBox := box.new(bar_index-2, imbTop,bar_index,imbBottom, bgcolor=imbRedClr, border_color=imbRedClr)
  159. array.push(arrImbBoxes,imbalanceBox)
  160. alert("Bearish Imbalance Detected!",freq=alert.freq_once_per_bar_close)
  161.  
  162. //Top break
  163. if ta.crossover(topBreakCheckSource,topValue) and topBreakBlock == false
  164. topBreakBlock := true
  165. isLongBreak := true
  166. checkUpImbalance := true
  167. if showBrekout
  168. line.set_x2(topLine,bar_index)
  169. if showBoxes
  170. demandBox := box.new(lastRedIndex-1, lastRedHigh,lastRedIndex+1,lastRedLow, bgcolor=transGreenClr, border_color=greenClr)
  171. array.push(arrBoxes,demandBox)
  172.  
  173. //Bottom break
  174. if ta.crossunder(bottomBreakCheckSource,bottomValue) and bottomBreakBlock == false
  175. bottomBreakBlock := true
  176. isShortBreak := true
  177. checkDownImbalance := true
  178. if showBrekout
  179. line.set_x2(bottomLine,bar_index)
  180. if showBoxes
  181. supplyBox := box.new(lastGreenIndex-1, lastGreenHigh,lastGreenIndex+1,lastGreenLow, bgcolor=transRedClr, border_color=redClr)
  182. array.push(arrBoxes,supplyBox)
  183.  
  184. //New up fractal
  185. if upFractal
  186. topBreakBlock := false
  187. isLongBreak := false
  188. topValue := high[n]
  189. if showBrekout
  190. topLine := line.new(bar_index[n],topValue,bar_index,topValue, color=upClr, style=lineStyle, width=2)
  191. if isLongBreak[1] == false
  192. line.delete(topLine[1])
  193.  
  194. //New down fractal
  195. if downFractal
  196. bottomBreakBlock := false
  197. isShortBreak := false
  198. bottomValue := low[n]
  199. if showBrekout
  200. bottomLine := line.new(bar_index[n],bottomValue,bar_index,bottomValue, color=downClr, style=lineStyle, width=2)
  201. if isShortBreak[1] == false
  202. line.delete(bottomLine[1])
  203.  
  204. //Imbalance Box Update
  205. activeImbBoxes = arrImbBoxes
  206. if array.size(activeImbBoxes) > 0 and hideFilled
  207. for i = 0 to array.size(activeImbBoxes) - 1
  208. bVal = box.get_bottom(array.get(activeImbBoxes, i))
  209. tVal = box.get_top(array.get(activeImbBoxes, i))
  210.  
  211. if open > tVal and low < tVal
  212. box.delete(array.get(activeImbBoxes, i))
  213. if open < bVal and high > bVal
  214. box.delete(array.get(activeImbBoxes, i))
  215.  
  216. //OB Box state update
  217. activeBoxes = arrBoxes
  218. if array.size(activeBoxes) > 0 and changeColor
  219. for i = 0 to array.size(activeBoxes) - 1
  220. bVal = box.get_bottom(array.get(activeBoxes, i))
  221. tVal = box.get_top(array.get(activeBoxes, i))
  222. if close < bVal
  223. box.set_bgcolor(array.get(activeBoxes, i),transRedClr)
  224. box.set_border_color(array.get(activeBoxes, i),redClr)
  225. if close > tVal
  226. box.set_bgcolor(array.get(activeBoxes, i),transGreenClr)
  227. box.set_border_color(array.get(activeBoxes, i),greenClr)
  228.  
  229. //PLOTS
  230. plotshape(showFractals ? downFractal : na,style=shape.triangleup, location=location.belowbar, offset=-n, color=color.new(color.gray,80), size = size.tiny)
  231. plotshape(showFractals ? upFractal : na, style=shape.triangledown, location=location.abovebar, offset=-n, color=color.new(color.gray,80), size = size.tiny)
  232. //#region[GLOBAL]
  233. var line[] EXT = array.new_line()
  234. var label[] LBL = array.new_label()
  235. nMacros = 8 // HEY! This is Step 1.5 for INSTRUCTIONS TO ADD CUSTOM MACROs - Start from the beginning at line 192 :)
  236. oneDayMS = 86400000
  237. oneBarMS = time_close-time
  238. noColor =color.new(#ffffff,100)
  239. one = ta.highest(timeframe.in_seconds("15")/timeframe.in_seconds(timeframe.period))+syminfo.mintick*10
  240. y_btm_Line1 = one
  241. y_top_Line1 = one+syminfo.mintick*5
  242. //#endregion
  243.  
  244.  
  245. //#region[INPUTS]
  246. _macroC = input.color(color.new(#000000,0), title="Macro Color", inline='main')
  247. _mode = input.string("On Chart", title="", inline='main', options=["On Chart", "New Pane"]
  248. , tooltip='When "New Pane" is selected, make sure you move the indicator to a New Pane as well, it is not automatic.')
  249.  
  250. _showL = input.bool(true, title="Macro Label?", inline='sh')
  251. _mTxt = input.bool(false, title="Show Time?", inline='sh')
  252. _extt = input.bool(false, title="Macro Projections?", inline='sh'
  253. , tooltip='Extends On Chart Macro lines towards price.')
  254.  
  255. _bgln = input.color(color.new(#9c27b0,70), title="London Macro", inline='bc')
  256. _bgny = input.color(color.new(#4caf50,70), title="New York Macro", inline='bc'
  257. , tooltip='Visible only in "New Pane" mode')
  258. //#endregion
  259.  
  260.  
  261. //#region[FUNCTIONS]
  262. time_isnewbarNY(string sess) =>
  263. t = time("1", sess, "America/New_York")
  264. na(t[1]) and not na(t) or t[1] < t
  265.  
  266. _controlMacroLine(line[] _lines, label[] _lbl, bool _time) =>
  267. if _time
  268. _lbl.last().set_x(math.round(math.avg(_lines.get(_lines.size()-2).get_x1(),time)))
  269. if high>_lines.last().get_y2()-syminfo.mintick*10
  270. _lines.get(_lines.size()-2).set_y2(high+(syminfo.mintick*10))
  271. _lines.last().set_y1(high+(syminfo.mintick*10))
  272. _lines.last().set_y2(high+(syminfo.mintick*10))
  273. LBL.last().set_y(high+(syminfo.mintick*10))
  274. if na or _lines.last().get_x2() == time
  275. _lines.last().set_x2(time+oneBarMS)
  276.  
  277. _controlMacroBox(box[] _boxes, bool _time, bool _friday) =>
  278. dly = _friday?oneDayMS*3:oneDayMS
  279. if na or _time
  280. _boxes.last().set_right(time+dly)
  281.  
  282. method memoryCleanLine(line[] A) =>
  283. if A.size()>0
  284. for i=0 to A.size()-1
  285. _line = A.get(i)
  286. if _line.get_x1()<time-oneDayMS
  287. line.delete(_line)
  288. method memoryCleanLabel(label[] A, int len) =>
  289. if A.size()>0
  290. for i=0 to A.size()-1
  291. _line = A.get(i)
  292. if _line.get_x()<time-oneDayMS
  293. label.delete(_line)
  294.  
  295. macroOC(line[] LINES, bool _time, string _kzTime, bool _friday, string _type)=>
  296. dly = _friday?oneDayMS*3:oneDayMS
  297. _col = _type=='ny'?_bgny:_bgln
  298. _txt = _mTxt?"MACRO"+"\n"+_kzTime:"MACRO"
  299. _tt = _type=='ny'?"NY MACRO\n"+_kzTime:(_type=='ln'?"LN MACRO\n"+_kzTime:"myMACRO\n"+_kzTime)
  300.  
  301. // Overlay False
  302. if not _time[1] and _time
  303. _vline1 = line.new(time,y_btm_Line1,time,y_top_Line1,xloc=xloc.bar_time,color=_macroC)
  304. LINES.push(_vline1)
  305. _hline = line.new(time,y_top_Line1,time+oneBarMS,y_top_Line1,xloc=xloc.bar_time,color=_macroC)
  306. LINES.push(_hline)
  307. if _extt
  308. EXT.push(line.new(time,high,time,_vline1.get_y2(),xloc=xloc.bar_time,color=_macroC,style=line.style_dotted))
  309.  
  310. if _mode=="On Chart"
  311. LBL.push(label.new(time
  312. , LINES.get(LINES.size()-2).get_y2()
  313. , _showL?_txt:""
  314. , tooltip=_tt
  315. , xloc=xloc.bar_time
  316. , style=label.style_label_down
  317. , color=noColor
  318. , textcolor=_macroC
  319. , size=size.small))
  320.  
  321. if _time[1] and not _time and LINES.size()>0 and LBL.size()>0
  322. _vline2 = line.new(time,y_btm_Line1,time,y_top_Line1,xloc=xloc.bar_time,color=_macroC)
  323. LBL.last().set_x(math.round(math.avg(LINES.get(LINES.size()-2).get_x1(),time)))
  324. if y_top_Line1 > LINES.get(LINES.size()-2).get_y2()
  325. LINES.get(LINES.size()-2).set_y2(y_top_Line1)
  326. LINES.last().set_y1(y_top_Line1)
  327. LINES.last().set_y2(y_top_Line1)
  328. LBL.last().set_y(y_top_Line1)
  329. else if y_top_Line1 < LINES.get(LINES.size()-2).get_y2()
  330. _vline2.set_y2(LINES.get(LINES.size()-2).get_y2())
  331. if _extt
  332. EXT.push(line.new(time,high,time,_vline2.get_y2(),xloc=xloc.bar_time,color=_macroC,style=line.style_dotted))
  333.  
  334. LINES.push(_vline2)
  335.  
  336. if LINES.size()>0 and LBL.size()>0
  337. _controlMacroLine(LINES, LBL, _time)
  338.  
  339.  
  340. macroNP(box[] BOXES, bool _time, string _kzTime, bool _friday, string _type)=>
  341. dly = _friday?86400000*3:86400000
  342. _col = _type=='ny'?_bgny:_bgln
  343. _tt = _type=='ny'?"NY MACRO\n"+_kzTime:"LN MACRO\n"+_kzTime
  344. end = not _time and _time[1]
  345.  
  346. // Overlay False
  347. var _plotNP = false
  348. if not _time[1] and _time
  349. _macro = box.new(time+dly,2,time+dly,0,_macroC,xloc=xloc.bar_time,bgcolor=_col)
  350. BOXES.push(_macro)
  351. _plotNP := true
  352.  
  353. if _time[1] and not _time and BOXES.size()>0
  354. _controlMacroBox(BOXES, true, dayofweek(time)==dayofweek.friday and syminfo.type!='crypto')
  355. _plotNP := false
  356. macroL = label.new(math.round(math.avg(BOXES.last().get_left(),BOXES.last().get_right()))
  357. , 1
  358. , xloc=xloc.bar_time
  359. , style=label.style_label_center
  360. , color=noColor
  361. , tooltip=_tt
  362. , text='ⓘ\n\n\n\n\n\n'
  363. , textcolor=_macroC
  364. , size=size.small)
  365.  
  366. if _time and _plotNP
  367. _controlMacroBox(BOXES, _time, dayofweek(time)==dayofweek.friday and syminfo.type!='crypto')
  368. //#endregion
  369.  
  370.  
  371. //#region[LOGIC]
  372. // LONDON
  373. var line[] _LINES_LN_1 = array.new_line()
  374. var box[] _BOXES_LN_1 = array.new_box()
  375. timeLN1 = time_isnewbarNY("0233-0300:1234567")
  376. lblLN1 = "2:33 - 3:00"
  377.  
  378. var line[] _LINES_LN_2 = array.new_line()
  379. var box[] _BOXES_LN_2 = array.new_box()
  380. timeLN2 = time_isnewbarNY("0403-0430:1234567")
  381. lblLN2 = "4:03 - 4:30"
  382.  
  383. // NEW YORK
  384. var line[] _LINES_NY_1 = array.new_line()
  385. var box[] _BOXES_NY_1 = array.new_box()
  386. timeNY1 = time_isnewbarNY("0850-0910:1234567")
  387. lblNY1 = "8:50 - 9:10"
  388.  
  389. var line[] _LINES_NY_2 = array.new_line()
  390. var box[] _BOXES_NY_2 = array.new_box()
  391. timeNY2 = time_isnewbarNY("0950-1010:1234567")
  392. lblNY2 = "9:50 - 10:10"
  393.  
  394. var line[] _LINES_NY_3 = array.new_line()
  395. var box[] _BOXES_NY_3 = array.new_box()
  396. timeNY3 = time_isnewbarNY("1050-1110:1234567")
  397. lblNY3 = "10:50 - 11:10"
  398.  
  399. var line[] _LINES_NY_4 = array.new_line()
  400. var box[] _BOXES_NY_4 = array.new_box()
  401. timeNY4 = time_isnewbarNY("1150-1210:1234567")
  402. lblNY4 = "11:50 - 12:10"
  403.  
  404. var line[] _LINES_NY_5 = array.new_line()
  405. var box[] _BOXES_NY_5 = array.new_box()
  406. timeNY5 = time_isnewbarNY("1310-1340:1234567")
  407. lblNY5 = "13:10 - 13:40"
  408.  
  409. var line[] _LINES_NY_6 = array.new_line()
  410. var box[] _BOXES_NY_6 = array.new_box()
  411. timeNY6 = time_isnewbarNY("1515-1545:1234567")
  412. lblNY6 = "15:15 - 15:45"
  413.  
  414. // //\//////////////////////////////////////////////////////////////////////////////////////////////////////////////\///
  415. // // INSTRUCTIONS TO ADD CUSTOM MACROs (PART 1): //
  416. // // 1.1) Copy these four lines of code and add them below the instruction box -> // CUSTOM MACROS; //
  417. // var line[] _lines_YourMacroName = array.new_line() // Make sure the text is not gray like these instructions. To do that, remove the '//' in front. //
  418. // var box[] _boxes_YourMacroName = array.new_box() // 1.2) Replace 'YourMacroName' with whatever you want in these four lines. //
  419. // _time_YourMacroName = time_isnewbarNY("hhmm-hhmm:1234567") // 1.3) Add your macro time window in the format: "hhmm-hhmm:1234567" //
  420. // _lbl_YourMacroName = "15:15 - 15:45" // 1.4) Add your macro time text in _lbl_YourMacroName, this will be displayed in the tooltips, //
  421. // // and in the MACRO label on chart, if toggled on. //
  422. // // 1.5) You are nearly there! Just go to line 12, and make sure the nMacros variable //
  423. // // is equal to the overall number of MACROs in the script (Standard value is 8, if you add 2, make it 10!). //
  424. // // //
  425. // ///\//////////////////////////////////////////. PART 2 BELOW .////////////////////////////////////////////////\//
  426.  
  427. // CUSTOM MACROS
  428. // Your custom macros go here
  429.  
  430.  
  431. //#endregion
  432.  
  433.  
  434. //#region[PLOT]
  435. if _mode=="On Chart"
  436. macroOC(_LINES_LN_1, timeLN1, lblLN1, dayofweek(time)==dayofweek.friday and syminfo.type!='crypto', 'ln') //\////////////////////////////////////////////////////////////////////////////\///
  437. macroOC(_LINES_LN_2, timeLN2, lblLN2, dayofweek(time)==dayofweek.friday and syminfo.type!='crypto', 'ln') // INSTRUCTIONS TO ADD CUSTOM MACROs (PART 2): //
  438. macroOC(_LINES_NY_1, timeNY1, lblNY1, dayofweek(time)==dayofweek.friday and syminfo.type!='crypto', 'ny') // 2.1) Find line 221 under "CUSTOM MACROS ON CHART PLOT" title. //
  439. macroOC(_LINES_NY_2, timeNY2, lblNY2, dayofweek(time)==dayofweek.friday and syminfo.type!='crypto', 'ny') // 2.2) Copy it to the following line, remove '//' and replace 'YourMacroName' //
  440. macroOC(_LINES_NY_3, timeNY3, lblNY3, dayofweek(time)==dayofweek.friday and syminfo.type!='crypto', 'ny') // with what you used above in step (1.2). //
  441. macroOC(_LINES_NY_4, timeNY4, lblNY4, dayofweek(time)==dayofweek.friday and syminfo.type!='crypto', 'ny') // 2.3) Make sure the beginning of the line is aligned with all the ones above; //
  442. macroOC(_LINES_NY_5, timeNY5, lblNY5, dayofweek(time)==dayofweek.friday and syminfo.type!='crypto', 'ny') // To do that press 'Tab' once, or add spaces until they match. //
  443. macroOC(_LINES_NY_6, timeNY6, lblNY6, dayofweek(time)==dayofweek.friday and syminfo.type!='crypto', 'ny') // //
  444. ///\/////////////////////////. CONT'D BELOW .///////////////////////////////\//
  445.  
  446. // CUSTOM MACROS ON CHART PLOT
  447. //macroOC(_lines_YourMacroName, _time_YourMacroName, _lbl_YourMacroName, dayofweek(time)==dayofweek.friday and syminfo.type!='crypto', '')
  448. else
  449. macroNP(_BOXES_LN_1, timeLN1, lblLN1, dayofweek(time)==dayofweek.friday and syminfo.type!='crypto', 'ln') //\//////////////////////////. \/\/\/ .//////////////////////////////\///
  450. macroNP(_BOXES_LN_2, timeLN2, lblLN2, dayofweek(time)==dayofweek.friday and syminfo.type!='crypto', 'ln') // //
  451. macroNP(_BOXES_NY_1, timeNY1, lblNY1, dayofweek(time)==dayofweek.friday and syminfo.type!='crypto', 'ny') // 2.4) Find line 236 under "CUSTOM MACROS NEW PANE PLOT" title. //
  452. macroNP(_BOXES_NY_2, timeNY2, lblNY2, dayofweek(time)==dayofweek.friday and syminfo.type!='crypto', 'ny') // 2.5) Copy it to the following line, remove '//' and replace 'YourMacroName' //
  453. macroNP(_BOXES_NY_3, timeNY3, lblNY3, dayofweek(time)==dayofweek.friday and syminfo.type!='crypto', 'ny') // with what you used above in step (1.2). //
  454. macroNP(_BOXES_NY_4, timeNY4, lblNY4, dayofweek(time)==dayofweek.friday and syminfo.type!='crypto', 'ny') // 2.6) Make sure the beginning of the line is aligned with all the ones above; //
  455. macroNP(_BOXES_NY_5, timeNY5, lblNY5, dayofweek(time)==dayofweek.friday and syminfo.type!='crypto', 'ny') // To do that press 'Tab' once, or add spaces until they match. //
  456. macroNP(_BOXES_NY_6, timeNY6, lblNY6, dayofweek(time)==dayofweek.friday and syminfo.type!='crypto', 'ny') // //
  457. ///\///////////////////////. LAST STEP BELOW ./////////////////////////////\//
  458.  
  459.  
  460. // CUSTOM MACROS NEW PANE PLOT
  461. //macroNP(_boxes_YourMacroName, _time_YourMacroName, _lbl_YourMacroName, dayofweek(time)==dayofweek.friday and syminfo.type!='crypto', '')
  462. //#endregion
  463.  
  464.  
  465. //#region[MEMORY CLEAN UP]
  466. _LINES_LN_1.memoryCleanLine()
  467. _LINES_LN_2.memoryCleanLine()
  468. _LINES_NY_1.memoryCleanLine()
  469. _LINES_NY_2.memoryCleanLine() //\//////////////////////////. \/\/\/ .//////////////////////////////\///
  470. _LINES_NY_3.memoryCleanLine() // //
  471. _LINES_NY_4.memoryCleanLine() // 2.4) Find line 253 under "CUSTOM MACROS LINE CLEAN UP" title. //
  472. _LINES_NY_5.memoryCleanLine() // 2.5) Copy it to the following line, remove '//' and replace 'YourMacroName' //
  473. _LINES_NY_6.memoryCleanLine() // with what you used above in step (1.2). //
  474. // //
  475. ///\/////////////////////. YOU ARE DONE! GLGT .///////////////////////////\//
  476.  
  477. // CUSTOM MACROS LINE CLEAN UP
  478. //_lines_YourMacroName.memoryCleanLine()
  479.  
  480.  
  481. EXT.memoryCleanLine()
  482. LBL.memoryCleanLabel(nMacros)
  483. //#endregion
  484.  
  485.  
  486. //#region[ALERTS]
  487. alertcondition(time_isnewbarNY("0228-0229:1234567") or
  488. time_isnewbarNY("0358-0359:1234567") or
  489. time_isnewbarNY("0845-0846:1234567") or
  490. time_isnewbarNY("0945-0946:1234567") or
  491. time_isnewbarNY("1045-1046:1234567") or
  492. time_isnewbarNY("1145-1146:1234567") or
  493. time_isnewbarNY("1305-1306:1234567") or // ADD YOUR ALERTS HERE
  494. time_isnewbarNY("1510-1511:1234567") //or
  495. , "Alert 5 Minutes Before Macro"
  496. , "A Macro Starts in 5 Minutes!")
  497. //#endregion
  498.  
Advertisement
Add Comment
Please, Sign In to add comment