Hi again,
I use a for loop to loop through the bars and determine if a 50 MA is sloping up or down. Is there an easier way to do this? Perhaps a built in function?
I’m sorry I just can’t find it!
k
JSParticipant
Senior
Hi @krogen
You can make a indicator for this for example with colors.
ma = average[50](Close)
slope = ma - ma[1]
if slope > 0 then
if slope > slope[1] then
g = 255
r = 0
elsif slope < slope[1] then
g = 200
r = 0
endif
elsif slope < 0 then
if slope < slope[1] then
r = 255
g = 0
elsif slope > slope[1] then
r = 200
g = 0
endif
endif
return slope coloured(r, g, 10) style(histogram, 1)