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

[amibroker] StDev of a custom figure Job for the cracks



PureBytes Links

Trading Reference Links

Hello,
i am working on this problem since quite a while. 

I got a special array that finds the last 30 figures of daily O-L when
a certain condition (Open<= Pivot) was given.
I calculate a sort of median (ODn) from these 30 figures for every day.

Now i am trying to get the Standard Deviation of the last 20 ODn's,
but i can't get this done.
Anybody who can help?

Here the code until now.


function sort(inlist, period)
{
//sort inlist
temp=0;
for(i = period; i>0; i--)
{
for (j = 1; j <= i; j++)
{
if (inlist[j-1] > inlist[j])
{
temp = inlist[j-1];
inlist[j-1] = inlist[j];
inlist[j] = temp;
}
}
}
//inlist now sorted
return inlist;
}




// MPP is a special Pivotpoint i calculate

for(i=1; i<=30;i++){
	PreODn[i]= LastValue(IIf(dailyOpen <= MPP, ValueWhen(dailyopen <=
MPP, dailyOpen - dailyLow, i) , ValueWhen(dailyopen > MPP,
dailyOpen-dailyLow, i)));
}
ArrayODn = sort(PreODn, 30);


// ODn = MA of the 30 ArrayODn but without 5 biggest and 5 smallest
ArrayODn
ODn = 0;
for(i = 6; i <= 25; i++){
	ODn = ODn + ArrayODn[i];
}
ODn = ODn/20;

//How do i get the StDev of ODn?
// This one doesn't work :(

/*for (y=BarCount-100;y<BarCount;y++){
  for (i=6; i<=25;i++){
	Mean      = Sum(ODn,20)/20;
	Dev       = Mean - ArrayODn[25];
	DevSq     = Dev * Dev;
	MeanDevSq = Sum(DevSq, 20)/20;
	StODn = sqrt(MeanDevSq);
}
//}
*/



Regards
Robert






------------------------ Yahoo! Groups Sponsor --------------------~--> 
Try Online Currency Trading with GFT. Free 50K Demo. Trade 
24 Hours. Commission-Free. 
http://us.click.yahoo.com/RvFikB/9M2KAA/U1CZAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

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

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

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