Simple TOS study – (EMA + SMA)/2


Category:
0
0

Hello Pete – thank you so much for all the great info provided here!  I would like to obtain the code for a presumably simple study – (EMA+SMA)/2.  The user would need to be able to enter the EMA and SMA values, and select line weight, style, color, etc.  An alert would be nice, but not required.  No luck trying it myself.  Thanks, again!  Steve

Marked as spam
Posted by (Questions: 1, Answers: 0)
Asked on February 13, 2019 11:03 pm
121 views
0
Private answer

Yep, pretty simple:

input lengthOne = 8;
input lengthTwo = 21;
input averageTypeOne = AverageType.EXPONENTIAL;
input averageTypeTwo = AverageType.SIMPLE;
input priceOne = close;
input priceTwo = close;
def maOne = MovingAverage(averageTypeOne, priceOne, lengthOne);
def maTwo = MovingAverage(averageTypeTwo, priceTwo, lengthTwo);
plot average = (maOne + maTwo) / 2;

Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on February 16, 2019 11:16 am