Nicolas

Best of Rainbow MA

Category: Indicators By: Nicolas Created: November 24, 2022, 9:34 AM
November 24, 2022, 9:34 AM
Indicators
3 Comments
Best of Rainbow MA

The indicator proposes to calculate a series of several moving averages in a row (up to 5 maximum). Each of them smoothes the previous one, forming a “rainbow” type indicator.

The first moving average is calculated on the price Close, and the following ones smooth each of the previous ones with the same calculation period, which can be modified in the parameters. The type of moving average can also be changed at will with the “MAmode” setting.

The result is a cluster of moving averages of different colors to be applied to the price chart.

This indicator has been converted from LUA language following a request on the indicators forum.

//PRC_Best rainbow MA | indicator
//24.11.2022
//Nicolas @ www.prorealcode.com
//Sharing ProRealTime knowledge

//---settings 
MAmode=0
Period=20
NumberOfMA=5
//---end of settings 

MA2=undefined
MA3=undefined
MA4=undefined
MA5=undefined

numberofMA=max(min(numberofma,5),1)

MA1=average[period](close)

if numberofMA=2 then
 MA2=average[period,mamode](MA1)
elsif numberofMA=3 then
 MA2=average[period,mamode](MA1)
 MA3=average[period,mamode](MA2)
elsif numberofMA=4 then
 MA2=average[period,mamode](MA1)
 MA3=average[period,mamode](MA2)
 MA4=average[period,mamode](MA3)
elsif numberofMA=5 then
 MA2=average[period,mamode](MA1)
 MA3=average[period,mamode](MA2)
 MA4=average[period,mamode](MA3)
 MA5=average[period,mamode](MA4)
endif 

return ma1 coloured("blue"), ma2 coloured("purple"), ma3 coloured("red"), ma4 coloured("orange"), ma5 coloured("fuchsia")

Download
Filename: PRC_Best-rainbow-MA.itf
Downloads: 59
Nicolas
Nicolas Legend
I created ProRealCode because I believe in the power of shared knowledge. I spend my time coding new tools and helping members solve complex problems. If you are stuck on a code or need a fresh perspective on a strategy, I am always willing to help. Welcome to the community!
Author’s Profile

Comments

paullyons
4 years ago
#

Hello! Thanks for post your indicators. I'd like you to let me know how to draw lines for arrays in back test. Thanks again.

magnus59
4 years ago
#

Hi Nicolas, thaks for your great work here, I need a scanner for the swedish OMX when market open in hte morning is there anything you think will work good from your svcreener or you can build one,, maybe based on reltive volume, price etc. Thx Magnus

Nicolas
4 years ago
#

Yes, sure please open a new topic in the ProScreener forum section, thank you.

ProRealCode ProRealCode
Loading...