PureBytes Links
Trading Reference Links
|
Hi Donna,
I think the threshold value should be 0.015 not 0.15:
PPOAvg=Sum(PPO*(PPO>0.015),250)/Sum(PPO>0.015,250);
also, if PPO has not been above this value for the last 250 days it
results in division by zero which means PPOAvg will return empty
value (not value 1 as you say you get).
Regards,
Johan
--- In amibroker@xxxxxxxxxxxxxxx, "dmarval" <dmarval@xxxx> wrote:
> Hi Johan,
>
> It doesn't work. When I plot it, I get a value of 1.
>
> PPO = (EMA(C,20)-EMA(C,50)) / EMA(C,50);
>
>
> Plot( PPO, "Percentage",10,1);
> Plot( PPO, "Percentage",IIf(PPO>Ref(PPO,-
1),6,3),2); //GraphStyle=2+4
> (histogram)
>
> PPOAvg=Sum(PPO*(PPO>0.15),250)/Sum(PPO>0.15,250);
> Plot( PPO, "Percentage",10,1);
> Plot( PPOavg, "Percentage",10,1);
>
> Donna
>
> --- In amibroker@xxxxxxxxxxxxxxx, "johanskatt" <johanskatt@xxxx>
> wrote:
> > Hi,
> >
> > PPOAvg=SUM(PPO*(PPO>0.15),250)/SUM(PPO>0.15,250);
> >
> > Johan
> >
> >
> >
> > --- In amibroker@xxxxxxxxxxxxxxx, donna girardin <dmarval@xxxx>
> > wrote:
> > >
> > > Hi everyone,
> > >
> > >
> > >
> > > I'm new to AB and am having trouble determining the code
concepts
> > of the AFL language. What I'm trying to code is a simple math
> > function, but no matter how many different variables I use, I
can't
> > get it J. I have tried using functions of barssince, cum(1),
sum, =
> > =, y !=, ++y, but I can't put any of it together to obtain my
value.
> > >
> > >
> > >
> > > I'm trying to obtain the average value for my code:
> > >
> > >
> > >
> > > PPO = (EMA(C,20)-EMA(C,50)) / EMA(C,50);
> > >
> > >
> > >
> > > What I want to do is;
> > >
> > >
> > >
> > > sum value, over my time frame -- x =250 days, that PPO was
> > above .15 then divide the sum value by the total # of count days
> > (bars),over my time frame -- x =250 days, that PPO was
above .15.
> > Hence my average.
> > >
> > >
> > >
> > > Is there anyone that can help me?
> > >
> > >
> > >
> > > Donna
> > >
> > >
> > >
> > >
> > > ---------------------------------
> > > Post your free ad now! Yahoo! Canada Personals
------------------------ 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/
|