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

[amibroker] Re: Average: barssince, cum(1), sum ??



PureBytes Links

Trading Reference Links

Hi Graham,

It doesn't seem to work. When I put this in indicator builder, I only 
get an avg value of 1?. As well, it is my understanding that the cum
(1) fuction calculates all the data since the start of chart, 
whereas, I was hoping to set a condition regarding set # days.

PPO = (EMA(C,20)-EMA(C,50)) / EMA(C,7);

PPOover = PPO>0;  
PPOcount = Cum(PPOover);  
PPOtotal = Cum(PPO>0);  
PPOavg = PPOtotal / PPOcount ;  

Plot( PPOavg, "PPOavg",5,1); 


--- In amibroker@xxxxxxxxxxxxxxx, "Graham" <gkavanagh@xxxx> wrote:
> You use the Cum function I think would be easiest
>  
> PPOover = PPO>0.15;  
> PPOcount = cum(PPOover);  
> PPOtotal = cum(PPO>0.15);  
> PPOavg = PPOtotal / PPOcount ;  
>  
> Hoping I have understood your requirements.
>  
> 
> Cheers,
> Graham
> http://groups.msn.com/asxsharetrading
> http://groups.msn.com/fmsaustralia 
> 
> -----Original Message-----
> From: donna girardin [mailto:dmarval@x...] 
> Sent: Saturday, 6 December 2003 6:53 PM
> To: amibroker@xxxxxxxxxxxxxxx
> Subject: [amibroker] Average: barssince, cum(1), sum ??
> 
> 
> 
> 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!  <http://ca.personals.yahoo.com/> Yahoo! 
Canada
> Personals
> 
> 
> Yahoo! Groups Sponsor	
> 
> ADVERTISEMENT
>  
> 
<http://rd.yahoo.com/SIG=12c15q3q2/M=267637.4116732.5333197.1261774/D=
egroup
> 
web/S=1705632198:HM/EXP=1070799485/A=1853619/R=0/*http://www.netflix.c
om/Def
> ault?mqso=60178356&partid=4116732> click here	
>  
> <http://us.adserver.yahoo.com/l?
M=267637.4116732.5333197.1261774/D=egroupmai
> l/S=:HM/A=1853619/rand=156504931> 	
> 
> Send BUG REPORTS to bugs@xxxx
> Send SUGGESTIONS to suggest@xxxx
> -----------------------------------------
> 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 the Yahoo! Terms of Service
> <http://docs.yahoo.com/info/terms/> .



------------------------ 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/