Created
June 4, 2020 09:53
-
-
Save denistex/6d5fff014026cbef587932fa1940498d to your computer and use it in GitHub Desktop.
Custom SMA that duplicates the last bar
This file contains hidden or 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=4 | |
study("Custom SMA") | |
CustomSma(source, length) => | |
sum = source | |
for i = 0 to length - 2 | |
sum := sum + source[i] | |
sum / length | |
plot(sma(close, 14)) | |
SMA = CustomSma(close, 14) | |
plot(barstate.islast ? SMA : na, color=color.red, offset=1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment