Moving Average Ribbon
Author: Sammy_G
Creation Date: 10/9/2019 7:21 PM
profile picture

Sammy_G

#1
I want to plot a number of moving averages but as a collective 'ribbon' rather than individually. Couldn't find a built-in indicator for that.
Qs:
1) Does it exist but perhaps under a different name?
2) If not, would you mind creating one? (e.g. it can be a user-specified color and may be allowed to take up to 5 different Moving Averages for input - such as EMA, SMA of different lengths etc.)?
profile picture

Eugene

#2
There is no such thing as collective ribbon because an indicator can only plot one DataSeries.
profile picture

Eugene

#3
P.S. Getting it done in code is trivial, though:

Enter positions on the same bar as exit: Moving Average Ribbon
profile picture

Sammy_G

#4
I should have called it Moving Averages Ribbon (plural) lol.
------------

Thx for referencing the other post...I got the code but it still plots each MA individually. Is it possible to fill in the gaps between the MAs so the (collective) plot visually appears like a ribbon?
profile picture

Eugene

#5
QUOTE:
Is it possible to fill in the gaps between the MAs so the (collective) plot visually appears like a ribbon?

Piece of cake:

CODE:
Please log in to see this code.
profile picture

Sammy_G

#6
Awesome, thanks much!

P.S. Please consider rolling it into an indicator (Community Indicators) so it becomes as easy as drag-&-drop with user inputs for type (SMA, EMA, etc) and period of the MAs, color, and transparency!
profile picture

Eugene

#7
Glad you like it!

At the risk of repeating (see post #2), an indicator can only plot one DataSeries. What you're proposing is impossible to reach given the current design.
profile picture

Sammy_G

#8
Hi Eugene,
The MA periods don't display in the chart window b/c the color is set to Transparent. Any suggestion how to show the periods - perhaps even as a separate string?
profile picture

Eugene

#9
Sam, a workaround could be as simple as drawing the string with DrawLabel or DrawText on the PricePane.
profile picture

Sammy_G

#10
That worked like a charm, thanks :)
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).