plot moving average only on last bar


Category:
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: 12, Answers: 5)
Asked on February 26, 2019 10:53 am
77 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: 37, Answers: 4118)
Answered on February 27, 2019 12:49 pm