Add cloud between two moving averages


Category:
0
0

Hi Pete,

Is it possible to add cloud (ie shaded area) between two moving averages per code below? I tried combining them into a single code to have a go at it to no avail.

Thank you!

Guga

##############

input price=close;
input offset=0;
input length = 13;

plot AvgExp = ExpAverage(price[-offset], length);

rec line = if IsNaN(AvgExp) then line[1] else AvgExp[offset];

plot priceline=highestAll (if isnan(AvgExp) then line else double.nan);
priceline.setpaintingStrategy(paintingStrategy.LINE);
priceline.setlineWeight(1);
priceline.setdefaultColor(Color.MAGENTA);
priceline.hideBubble();

###############

input price=close;
input offset=0;
input length = 21;

plot AvgExp = ExpAverage(price[-offset], length);

rec line = if IsNaN(AvgExp) then line[1] else AvgExp[offset];

plot priceline=highestAll (if isnan(AvgExp) then line else double.nan);
priceline.setpaintingStrategy(paintingStrategy.LINE);
priceline.setlineWeight(1);
priceline.setdefaultColor(Color.MAGENTA);
priceline.hideBubble();

##########################

Marked as spam
Posted by (Questions: 4, Answers: 2)
Asked on August 5, 2020 3:31 pm
1033 views
0
Private answer

The method to add a cloud between to moving averages has already been asked and answered in the forum. I only had to search the term "cloud" to locate this:

https://www.hahn-tech.com/ans/how-to-make-a-cloud-from-emas/

 

Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on August 5, 2020 5:00 pm