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

RE: [amibroker] sum only positive days



PureBytes Links

Trading Reference Links




<FONT face=Arial color=#0000ff 
size=2>William,
Yes, I 
figured that out when I did some quick calculations on a piece of paper. Dennis 
also pointed out that both X and Y could be handled inside a single loop. I have 
learned several things the last few days!! Thanks for your 
help
 
Regards, 
Jayson 
<FONT face=Tahoma 
size=2>-----Original Message-----From: William Peters 
[mailto:williampeters@xxxxxxxxxxxx]Sent: Thursday, November 27, 2003 
4:41 PMTo: amibroker@xxxxxxxxxxxxxxxSubject: RE: 
[amibroker] sum only positive daysJayson,You 
need to change that loop a little. The loop should continue while i < pds + 
1See below. Otherwise your home.for( i = 1; i < pds + 1; i++ 
){      x = x + ValueWhen( C > Ref( C, -1 ), 
Volume, i );}y = 0;for( i = 1; i < pds + 1; i++ 
){      y = y + ValueWhen( C < Ref( C, -1 ), 
Volume, i );}Regards,William 
Peterswww.amitools.com-----Original Message-----From: 
Jayson [mailto:jcasavant@xxxxxxxxxxx]Sent: Thursday November 27, 2003 11:54 
AMTo: amibroker@xxxxxxxxxxxxxxxSubject: RE: [amibroker] sum only 
positive daysThanks to all who provided interesting and creative 
approaches to myquestion. My goal was to look at the last 20 up days and 
compare the volumeto the last 20 down days. William Peters got me started 
with a for loop (Ireally have to learn better to use these!!) and others 
provided variations.and I came up with the 
following......pds=Param("PDS",20,6,22,1);smooth=Param("Smooth",12,1,50,1);trig=Param("Trigger",10,1,25,1);x 
= 0;for( i = 1; i < pds; i++ ){      
x = x + ValueWhen( C > Ref( C, -1 ), Volume, i );}y = 0;for( i = 
1; i < pds; i++ ){      y = y + ValueWhen( C 
< Ref( C, -1 ), Volume, i 
);}vp=EMA(x-y,smooth);trigger=MA(vp,trig);Plot(vp,"",IIf(x-y>0,colorBrightGreen,colorRed),1);Plot(trigger,"",colorYellow,1);Title="A/D 
Volume of "+Name()+ " is "+WriteIf(x-y>0,EncodeColor(colorBrightGreen)+ 
"Positive",EncodeColor(colorRed)+" Is 
Negative")+EncodeColor(colorWhite)+"\nBar % of  all Vol Average = 
"+WriteVal(V/MA(V,50)*100,1.0) 
+"%";Buy=Cross(Vp,trigger);Sell=Cross(trigger,Vp);Equity(1);I am 
still experimenting with look back parameters and perhaps somesmoothing. The 
MA cross may be important or perhaps a zero cross is more tothe point. It 
will take some study. In any case this looks like aninteresting way to gauge 
money flow into and out of a stock. If there ismore interest (volume) on up 
days then perhaps the stock is underaccumulation, if more on down days 
perhaps distribution. At first glance theindicator turns ahead of the price. 
I like that as it allows me a heads up.Please do not confuse my reference to 
"Buy" and "Sell" as a system. This isjust an interesting study that some of 
you may find useful.Enjoy your 
HolidayRegards,Jayson-----Original Message-----From: 
Graham [mailto:gkavanagh@xxxxxxxxxxxxx]Sent: Wednesday, November 26, 2003 
5:49 PMTo: amibroker@xxxxxxxxxxxxxxxSubject: RE: [amibroker] sum only 
positive daysJayson, this will sum the last 20 bars for  x 
which will either be zero orthe 
volume.x=iif(c>ref(c,-1),v,0)Y = 
sum(x,20);Cheers,Graham<A 
href="">http://groups.msn.com/ASXShareTrading<A 
href="">http://groups.msn.com/FMSAustralia>  
-----Original Message-----> From:       
Jayson [mailto:jcasavant@xxxxxxxxxxx]> 
Sent:      Thursday, 27 November 2003 3:18 AM> 
To:      1ami> 
Subject:      [amibroker] sum only positive 
days>> I cannot seem to get my mind around what should be a fairly 
simple thing> to code. Perhaps someone could nudge me in the right 
direction.>> I want to sum the volume of the last 20 up days and 
compare it to the last> 20 down days. This is not to be confused with 
summing the up days of the> last 20 bars,  Simple code such as  
plot( c>ref(c,-1)"",4,2);  will plot> just the up days and 
x=iif(c>ref(c,-1),v,0) can calculate the volume but> how do I sum the 
last 20 bars where x>0 as opposed to summing the last 20> bars of 
X  ?>> TIA>> Regards,> 
Jayson>Yahoo! Groups 
SponsorADVERTISEMENTSend BUG REPORTS to 
bugs@xxxxxxxxxxxxxSend SUGGESTIONS to 
suggest@xxxxxxxxxxxxx-----------------------------------------Post 
AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx(Web page: <A 
href="">http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check 
group FAQ at:<A 
href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.htmlYour 
use of Yahoo! Groups is subject to the Yahoo! Terms of 
Service.Send BUG REPORTS to bugs@xxxxxxxxxxxxxSend 
SUGGESTIONS to 
suggest@xxxxxxxxxxxxx-----------------------------------------Post 
AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page: <A 
href="">http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check 
group FAQ at: <A 
href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
Your use of Yahoo! Groups is subject to <A 
href="">http://docs.yahoo.com/info/terms/ 
Send 
BUG REPORTS to bugs@xxxxxxxxxxxxxSend SUGGESTIONS to 
suggest@xxxxxxxxxxxxx-----------------------------------------Post 
AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page: <A 
href="">http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check 
group FAQ at: <A 
href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
Your use of Yahoo! Groups is subject to the <A 
href="">Yahoo! Terms of Service. 







Yahoo! Groups Sponsor


  ADVERTISEMENT 









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 the Yahoo! Terms of Service.