[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [amibroker] Code Question Involving Arrays



PureBytes Links

Trading Reference Links

 
Hello Bret,
 
you can transform your data sets by the well-known transformation
 
xNew = (xOld - xAverage) / sigma
 
where xOld is the old (or former) array to be transformed, xAverage the mean (or average) value of the old array over a period of interest, and sigma denotes the standard deviation of the old data set.
In this way the AFL-library function
 
Plot(xnew, "xnew", colorBrightGreen, styleThick);
 
displays the transformed data set that you can compare with other transformed sets and also plot those sets, too.
 
Best regards,
 
Udo


Quad Rate Serial Abby <quad_pumped_abby@xxxxxxxxx> wrote:
I have the following code.  I am trying to normalize the price and
plot the line of the slope of the average price over the last 15 days.
This way I can turn it into an explore and use it to see which stocks
are out performing relatively.  I don't really need to plot the slope
and I could take it out, but I would like to know why it doesn't work,
because I suspect it may cause an error in the calculation of the
array itself.  If I take out the normalization division there is no
problem.  The error in the "Plot LineArray" is:

Argument #4 has incorrect type (the function expects different
argument type here)

The code is:

StartP = 15;
EndP = 1;
Price_Array = MA (( H + L ) / 2, 1 );
LP1 = LastValue ( Cum ( 1 ));
XP0 = LP1 - StartP;
XP1 = LP1 - EndP;
Base_Normalization = Ref ((( H + L ) / 2), -StartP );
YP0 = Price_Array [ XP0 ] / Base_Normalization;
YP1 = Price_Array [ XP1 ] / Base_Normalization;
Plot ( Price_Array, "", 1, 1 );
Plot ( LineArray ( XP0, YP0, XP1, YP1 ), "", 4, 1 );

Thanks in advance for anybodys help,

Bret




Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com

For other support material please check also:
http://www.amibroker.com/support.html



__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com

For other support material please check also:
http://www.amibroker.com/support.html





Yahoo! Groups Links