Funny ... but it is hard to admit that I simply cannot combine these characters to get the desired result even though the answers are provided here in plain English.
This simple script is not changing to SMA regardless of the variations I throw at it. Please help again.
input price = close;
input displace = 0;
input EMALength1 = 9;
input EMALength2 = 20;
plot upper = ExpAverage(data = price[-displace], length = EMALength1);
plot lower = ExpAverage(data = price[-displace], length = EMALength2);
@dougn Since you're still stuck I MODIFIED your code to a generic moving average type so that it can be selected to SIMPLE, EXPONENTIAL, WILDERS, HULL etc via the user interface. I have made it so that SIMPLE moving average has been selected. Your earlier code used the call ExpAverage() which is to calculate Exponential Moving Average and so won't work for a Simple Moving Average.
Compare this code with your earlier code, so that you can use this as a learning opportunity. You were also missing a few parameters in your AddCloud() statement - that was also fixed
# Moving Average Dual # tomsk # 1.2.2020 input price = close; input averageType = AverageType.SIMPLE; input displace = 0; input Length1 = 9; input Length2 = 20; plot fast = MovingAverage(averageType, price[-displace], length1); fast.SetDefaultColor(Color.RED); plot slow = MovingAverage(averageType, price[-displace], length2); slow.SetDefaultColor(Color.BLUE); AddCloud(fast,slow, color.green, color.red); # End Moving Average Dual