Last active
August 16, 2022 20:27
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//@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