Skip to content

Instantly share code, notes, and snippets.

@carloswm85
Last active August 16, 2022 20:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save carloswm85/b25553a38c289a26d4b3ae950e1010ea to your computer and use it in GitHub Desktop.
Save carloswm85/b25553a38c289a26d4b3ae950e1010ea to your computer and use it in GitHub Desktop.
Saved as .js just for adding some color to it. No repainting function for Pinescript 5.0
//@version=5
// === No repainting.
f_nrp(_timeframe, _expression) =>
// request.security(symbol=syminfo.tickerid, timeframe=_timeframe, expression=_expression[barstate.isrealtime ? 1 : 0], gaps=barmerge.gaps_off)[barstate.isrealtime ? 0 : 1] // PineCoders best practice.
request.security(symbol=syminfo.tickerid, timeframe=_timeframe, expression=_expression[1], lookahead = barmerge.lookahead_on)
// Use
ema_expression = ta.ema(low, ema_length)
// Get values using anti-repainting
ema_quick_nrpvalue = f_nrp(ema_quick_resolution, ema_quick_expression)
// Then plot
plot(ema_quick_nrpvalue)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment