SetScaleCompressed, ATR, and PlotSeries
Author: jreality
Creation Date: 4/27/2009 2:34 PM
profile picture

jreality

#1
I'm running WealthLab 5.3.44

The following code does not work. Original time interval is 60 minutes.

QUOTE:
SetScaleCompressed(120);
DataSeries TheSeries = ATR.Series(Bars,5);
RestoreContext();
TheSeries = Synchronize(TheSeries);
PlotSeries(pane1,TheSeries,Color.Beige,LineStyle.Solid,2);


When the PlotSeries gets executed, the following error happens:

Runtime error: Plotted DataSeries has fewer bars than the Symbol being charted.

Any idea why this does not work?

Further down in my code, it does appear that accessing the data directly from TheSeries may be working, because the program still works if I comment out the PlotSeries. However, I'm not yet sure it it works in the case of substituting SetScaleDaily() for SetScaleCompressed(120) because no trades get executed. Is there a problem with SetScaleDaily when compressing an ATR series?

Thanks,

jreality
profile picture

Cone

#2
Your mistake is that you used RestoreContext(), but never changed the Context. You need to RestoreScale() instead.
profile picture

jreality

#3
Ok, thanks. Will give it a try with RestoreScale instead.

EDIT: Works great, thanks!
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).