|
Problem with series and/or LowPass?
#429107
09/09/13 07:14
09/09/13 07:14
|
Joined: Aug 2013
Posts: 28 --Select a State--
CL1
OP
Newbie
|
OP
Newbie
Joined: Aug 2013
Posts: 28
--Select a State--
|
Hi, I can get some behavior when making series, particularly using LowPass. Often, a series of a series doesn't display on the plot and returns a value of -1. This is more frequent with LowPass. An example with two very similar series functions that give different results:
var fxn1(var* Data,int Period) { return (Data[0]-MidPoint(Data,Period))/(MaxVal(Data,Period)); }
var fxn2(var* Data,int Period) { return (Data[0]-MidPoint(Data,Period))/(MaxVal(Data,Period)-MidPoint(Data,Period)); }
function run() { StartDate = 2002; LookBack=1440; set(PLOTPRICE+PLOTNOW); PlotBars = 20000; var* Price = series(price()); vars M1=series(fxn1(Price,1440)); vars M2=series(fxn2(Price,1440)); vars M3=series(LowPass(M1,100)); plot("M1",M1[0],NEW,BLUE); plot("M2",M2[0],NEW,BLUE); plot("M3",M3[0],NEW,BLUE); }
These all plot fine. However, if you change M3 to be a LowPass series of M2 (instead of M1, ie. fxn2 instead of fxn1), the plot is blank with -1. M1 and M2 are still fine in this case.
Is this user error, or a bug somewhere? Thanks for any help you can provide.
|
|
|
Re: Problem with series and/or LowPass?
[Re: CL1]
#429143
09/09/13 12:43
09/09/13 12:43
|
Joined: Aug 2013
Posts: 28 --Select a State--
CL1
OP
Newbie
|
OP
Newbie
Joined: Aug 2013
Posts: 28
--Select a State--
|
This should make it more clear. Now both fxn1 and fxn2 have series (M1, M2) and these are then passed through a LowPass filter (M3, M4). Why does M3 plot, but M4 is blank with -1?
var fxn1(var* Data,int Period) { return (Data[0]-MidPoint(Data,Period))/(MaxVal(Data,Period)); }
var fxn2(var* Data,int Period) { return (Data[0]-MidPoint(Data,Period))/(MaxVal(Data,Period)-MidPoint(Data,Period)); }
function run() { StartDate = 2002; LookBack=1440; set(PLOTPRICE+PLOTNOW); PlotBars = 20000; var* Price = series(price()); vars M1=series(fxn1(Price,1440)); vars M2=series(fxn2(Price,1440)); vars M3=series(LowPass(M1,100)); vars M4=series(LowPass(M2,100)); plot("M1",M1[0],NEW,BLUE); plot("M2",M2[0],NEW,BLUE); plot("M3",M3[0],NEW,BLUE); plot("M4",M4[0],NEW,BLUE); }
|
|
|
|