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

[amibroker] Simple Test - STDEV and Subscript Zero



PureBytes Links

Trading Reference Links

Hi All,

I'm new to Amibroker, and although I've programmed in nearly all of the
major third-generation languages, I'm wrestling a little with Amibroker
scripts.  Maybe I'm just getting too old.  The simple code below was meant
to confirm my notion of what I could do with subscripts.  As AFL uses
zero-based subscripting, I filled a little array x[0] thru x[9].  But to my
dismay, I found STDEV() and MA() did not give me expected results at
subscript [9].  If I extend the array to x[10] and do a 10-bar STDEV() and
MA() -- subscripts [1] thru [10] -- my results are as expected (in subscript
[10]).  Is there something I don't understand about [0] subscript?

Thanks for your help,

...Don

// Explore - test stdev on small array; set "n last days" to 1, select
current stock

Filter =1;
x[0]=10; x[1]=10; x[2]=10; x[3]=10; x[4]=10; x[5]=10; x[6]=10; x[7]=10;
x[8]=10; x[9]=10; x[10]=10;

SD10 = StDev(x,10);
Avg10 = MA(x,10);
AddColumn(x[0],"x",4.2);
AddColumn(SD10[10],"SD[10]",4.4);
AddColumn(Avg10[10],"Avg[10]",4.4);
AddColumn(SD10[9],"SD[9]",4.4);
AddColumn(Avg10[9],"Avg[9]",4.4);

Results:
x	SD[10]	Avg[10]	SD[9]	Avg[9]
10.00	0.0000	10.0000




------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for your HP, Epson, Canon or Lexmark
Printer at MyInks.com. Free s/h on orders $50 or more to the US & Canada.
http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/GHeqlB/TM
---------------------------------------------------------------------~->

Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/