Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
- // © Maurizio-Ciullo
- // https://www.youtube.com/watch?v=-ZvGC0wUNAI&t=625s
- // <<<<<<<<<<<<<<<<<<< Explanation >>>>>>>>>>>>>>>>>>>>> //
- // Ci sono più forme di repainting:
- // 1 = Sugli indicatori.
- // 2 = Sulle candele o pattern di candele.
- // 3 = Sulle request.security "chiediamo un timeframe diverso"
- // 4 = Lookahead = barmerge.lookahead_on "traccia un'indicazione es "come il prezzo" in avanti
- // che sarà poi modoficato appena confermato. Consigli di tenerlo sempre off comeda default
- //@version=5
- strategy("37 Spiegazione Repainting", overlay=true, margin_long=100, margin_short=100)
- // Get User Inputs
- disableRepaint = input.bool(title="disable repainting", defval=false)
- // <<<<<<<<<<<<<<<<<<< How to eliminate repaint >>>>>>>>>>>>>>>>>>>>> //
- // validShortEntry = xxxx
- // If validShortEntry and barstate.isconfirmed
- // alert(send data to third party)
- // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 1 "Indicatori" [NO Repainting] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> //
- atr = ta.atr(14)
- // <<<<<<<<<<<<<<<<<<< Get Stops >>>>>>>>>>>>>>>>>>>>> //
- longStop = disableRepaint ? (barstate.isconfirmed ? close - atr : close[1] - atr[1]) : close - atr
- shortStop = disableRepaint ? (barstate.isconfirmed ? close + atr : close[1] + atr[1]) : close + atr
- plot(longStop, title="longStop", color=color.green)
- plot(shortStop, title="shortStop", color=color.red)
- // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 2 Signal [NO Repainting] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> //
- // <<<<<<<<<<<<<<<<<<< Detect Entry Patterns >>>>>>>>>>>>>>>>>>>>> //
- longEntry = close > high[1] and (barstate.isconfirmed or not disableRepaint)
- shortEntry = close < low[1] and (barstate.isconfirmed or not disableRepaint)
- plotshape(longEntry ? 1 : na , title="longEntry", color=color.green, style = shape.arrowup, location = location.belowbar)
- plotshape(shortEntry ? 1 : na , title="shortEntry", color=color.red, style = shape.arrowdown)
- // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 3 request.security [SI Repainting] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> //
- // <<<<<<<<<<<<<<<<<<< Detect High Timeframe Data That Repaint >>>>>>>>>>>>>>>>>>>>> //
- // 0 : 1 Si rifresicono alla candela 0 = attuale 1 = 1na candela indietro
- htfDataRep = request.security(syminfo.tickerid, "D", close[disableRepaint and barstate.isrealtime ? 1 : 0])
- htfAtrRep = request.security(syminfo.tickerid, "D", atr[disableRepaint and barstate.isrealtime ? 1 : 0])
- htfLongStopRep = htfDataRep + htfAtrRep
- htfShortStopRep = htfDataRep - htfAtrRep
- plot(htfLongStopRep, title="htfLongStopRep", color=color.green)
- plot(htfShortStopRep, title="htfShortStopRep", color=color.red)
- // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Detect High Timeframe Data That Does Not Repaint [NO Repainting] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> //
- // 0 : 1 Si rifresicono alla candela 0 = attuale 1 = 1na candela indietro
- htfData = request.security(syminfo.tickerid, "D", close[disableRepaint and barstate.isconfirmed ? 0 : 1])
- htfAtr = request.security(syminfo.tickerid, "D", atr[disableRepaint and barstate.isconfirmed ? 0 : 1])
- htfLongStop = htfData + htfAtr
- htfShortStop = htfData - htfAtr
- plot(htfLongStop, title="htfLongStop", color=color.green)
- plot(htfShortStop, title="htfShortStop", color=color.red)
- // <<<<<<<<<<<<<<<<<<< Detect High Timeframe Data That Repaints Lookahead = barmerge.lookahead_on [SI Repainting] >>>>>>>>>>>>>>>>>>>>> //
- // 4 = Lookahead = barmerge.lookahead_on "traccia un'indicazione es "come il prezzo" in avanti, che sarà poi modificato appena confermato
- // Si consiglia di tenerlo off come da default altrimenti crea un repainting
- htfDataBarMer = request.security(syminfo.tickerid, "D", close[disableRepaint and barstate.isconfirmed ? 0 : 1], lookahead=barmerge.lookahead_on)
- htfAtrBarMer = request.security(syminfo.tickerid, "D", atr[disableRepaint and barstate.isconfirmed ? 0 : 1], lookahead=barmerge.lookahead_on)
- htfLongStopBarMer = htfDataBarMer + htfAtrBarMer
- htfShortStopBarMer = htfDataBarMer - htfAtrBarMer
- plot(htfLongStopBarMer, title="htfLongStoBarMerp", color=color.green)
- plot(htfShortStopBarMer, title="htfShortStopBarMer", color=color.red)
- plot(htfDataBarMer, title="htfDataBarMer", color=color.red)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement