plot moving average only on last bar


0
0

Hello

I would like to know is it possible to have a script that plot 50 or any SMA don’t want to see a line in chart just want a small line attach is the picture. please help if you can.

 

thanks

Attachments:
Marked as spam
Posted by (Questions: 6, Answers: 3)
Asked on February 26, 2019 10:53 am
44 views
0
Private answer

This should do it:

input length = 50;
input type = AverageType.EXPONENTIAL;
input price = close;
def ma = MovingAverage(type, price, length);
plot line = if IsNaN(close[-1]) then ma else Double.NaN;
line.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);

Marked as spam
Posted by (Questions: 36, Answers: 1978)
Answered on February 27, 2019 12:49 pm