- ago
I'm trying to call MedianAbsoluteDeviation() but I get nothing back. Obviously I'm not calling it right and the help docs fail to give an example (which they need to do). Please correct my "attempted" code below. I'm running WL8 Build 12.
CODE:
   public override void Initialize(BarHistory bars)    {       TimeSeries mad = bars.Close.MedianAbsoluteDeviation(14);       PlotTimeSeries(mad, mad.Description, mad.Description, WLColor.Blue);    }
0
327
Solved
6 Replies

Reply

Bookmark

Sort
- ago
#1
There must be a NaN somewhere which obstructs the plot. Let me check it.
0
- ago
#2
It looks like a bug in PlotTimeSeries to me. Try this instead:
CODE:
PlotTimeSeriesLine(mad, mad.Description, mad.Description, WLColor.Blue);

Though sometimes it may fail too if you Run while the chart view is open. In such case re-run in the Editor view.
0
- ago
#3
Glitch has corrected me: your usage of TimeSeries.Description (which in fact appears to be null) is not as intended and this explains the wrong result you're getting. It should be fine if you specify a custom non-null PaneTag.

CODE:
PlotTimeSeries(mad, "mad", "madPane", WLColor.Blue);
0
Best Answer
- ago
#4
QUOTE:
usage of TimeSeries.Description is not as intended

It would be nice if TimeSeries.Description "worked as expected" for MedianAbsoluteDeviation so as not to raise questions or create confusion.

But thanks for the workaround. Yes, the code below works--thanks again.
CODE:
   TimeSeries mad = bars.Close.MedianAbsoluteDeviation(14);    mad.Description = "MAD volatility";    PlotTimeSeries(mad, mad.Description, mad.Description, WLColor.Blue);
0
- ago
#5
You're welcome though it ain't a workaround. These auxiliary series aren't meant to return a TimeSeries.Description like a normal indicator, and the QuickRef suggests that a valid string should be passed on to Plot* methods.
0
- ago
#6
QUOTE:
a valid string should be passed on to Plot* methods.

In other words, an exception should be thrown if the string isn't valid so as not to raise questions or create confusion. I totally agree.
0

Reply

Bookmark

Sort