Advertisement
Maurizio-Ciullo

37 Spiegazione Repainting

Mar 16th, 2023
770
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
  2. // © Maurizio-Ciullo
  3.  
  4. // https://www.youtube.com/watch?v=-ZvGC0wUNAI&t=625s
  5.  
  6. // <<<<<<<<<<<<<<<<<<< Explanation >>>>>>>>>>>>>>>>>>>>> //
  7. // Ci sono più forme di repainting:
  8. // 1 = Sugli indicatori.
  9. // 2 = Sulle candele o pattern di candele.
  10. // 3 = Sulle request.security "chiediamo un timeframe diverso"
  11. // 4 = Lookahead = barmerge.lookahead_on "traccia un'indicazione es "come il prezzo" in avanti
  12. // che sarà poi modoficato appena confermato. Consigli di tenerlo sempre off comeda default
  13.  
  14. //@version=5
  15. strategy("37 Spiegazione Repainting", overlay=true, margin_long=100, margin_short=100)
  16.  
  17.  
  18. // Get User Inputs
  19. disableRepaint = input.bool(title="disable repainting", defval=false)
  20.  
  21.  
  22. // <<<<<<<<<<<<<<<<<<< How to eliminate repaint >>>>>>>>>>>>>>>>>>>>> //
  23.  
  24. // validShortEntry = xxxx
  25. // If validShortEntry and barstate.isconfirmed
  26. //     alert(send data to third party)
  27.  
  28.                  // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 1 "Indicatori" [NO Repainting] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> //
  29. atr = ta.atr(14)
  30.  
  31. // <<<<<<<<<<<<<<<<<<< Get Stops >>>>>>>>>>>>>>>>>>>>> //
  32. longStop = disableRepaint ? (barstate.isconfirmed ? close - atr : close[1] - atr[1]) : close - atr
  33. shortStop = disableRepaint ? (barstate.isconfirmed ? close + atr : close[1] + atr[1]) : close + atr
  34.  
  35. plot(longStop, title="longStop", color=color.green)
  36. plot(shortStop, title="shortStop", color=color.red)
  37.  
  38.  
  39.                 // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 2 Signal [NO Repainting] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> //
  40.  
  41. // <<<<<<<<<<<<<<<<<<< Detect Entry Patterns >>>>>>>>>>>>>>>>>>>>> //
  42. longEntry = close > high[1] and (barstate.isconfirmed or not disableRepaint)
  43. shortEntry = close < low[1] and (barstate.isconfirmed or not disableRepaint)
  44.  
  45. plotshape(longEntry ? 1 : na , title="longEntry", color=color.green, style = shape.arrowup, location = location.belowbar)
  46. plotshape(shortEntry ? 1 : na , title="shortEntry", color=color.red, style = shape.arrowdown)
  47.  
  48.  
  49.                 // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 3 request.security [SI Repainting] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> //
  50.  
  51. // <<<<<<<<<<<<<<<<<<< Detect High Timeframe Data That Repaint >>>>>>>>>>>>>>>>>>>>> //
  52. // 0 : 1 Si rifresicono alla candela 0 = attuale 1 = 1na candela indietro
  53. htfDataRep = request.security(syminfo.tickerid, "D", close[disableRepaint and barstate.isrealtime ? 1 : 0])
  54. htfAtrRep = request.security(syminfo.tickerid, "D", atr[disableRepaint and barstate.isrealtime ? 1 : 0])
  55.  
  56. htfLongStopRep = htfDataRep + htfAtrRep
  57. htfShortStopRep = htfDataRep - htfAtrRep
  58.  
  59. plot(htfLongStopRep, title="htfLongStopRep", color=color.green)
  60. plot(htfShortStopRep, title="htfShortStopRep", color=color.red)
  61.  
  62.  
  63. // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Detect High Timeframe Data That Does Not Repaint [NO Repainting] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> //
  64. // 0 : 1 Si rifresicono alla candela 0 = attuale 1 = 1na candela indietro
  65. htfData = request.security(syminfo.tickerid, "D", close[disableRepaint and barstate.isconfirmed ? 0 : 1])  
  66. htfAtr = request.security(syminfo.tickerid, "D", atr[disableRepaint and barstate.isconfirmed ? 0 : 1])
  67.  
  68. htfLongStop = htfData + htfAtr
  69. htfShortStop = htfData - htfAtr
  70.  
  71. plot(htfLongStop, title="htfLongStop", color=color.green)
  72. plot(htfShortStop, title="htfShortStop", color=color.red)
  73.  
  74.  
  75. // <<<<<<<<<<<<<<<<<<< Detect High Timeframe Data That Repaints Lookahead = barmerge.lookahead_on [SI Repainting] >>>>>>>>>>>>>>>>>>>>> //
  76. // 4 = Lookahead = barmerge.lookahead_on "traccia un'indicazione es "come il prezzo" in avanti, che sarà poi modificato appena confermato
  77. // Si consiglia di tenerlo off come da default altrimenti crea un repainting
  78. htfDataBarMer = request.security(syminfo.tickerid, "D", close[disableRepaint and barstate.isconfirmed ? 0 : 1], lookahead=barmerge.lookahead_on)  
  79. htfAtrBarMer = request.security(syminfo.tickerid, "D", atr[disableRepaint and barstate.isconfirmed ? 0 : 1], lookahead=barmerge.lookahead_on)
  80.  
  81. htfLongStopBarMer = htfDataBarMer + htfAtrBarMer
  82. htfShortStopBarMer = htfDataBarMer - htfAtrBarMer
  83.  
  84. plot(htfLongStopBarMer, title="htfLongStoBarMerp", color=color.green)
  85. plot(htfShortStopBarMer, title="htfShortStopBarMer", color=color.red)
  86. plot(htfDataBarMer, title="htfDataBarMer", color=color.red)
  87.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement