PureBytes Links
Trading Reference Links
|
Sorry, misread as usual
Try this, if looping not wanted
Lookback = 20;
DaysUp = IIf( C>O, 1, 0 );
UpCount = Cum( DaysUp );
UpPeriod = BarsSince( UpCount == (LastValue(Upcount)-Lookback) );
VolUpCount = Sum( V, UpPeriod);
DaysDown = IIf( C<O, 1, 0 );
DownCount = Cum( DaysDown );
DownPeriod = BarsSince( UpCount == (LastValue(Upcount)-Lookback) );
VolDownCount = Sum( V, DownPeriod);
Filter=1;
AddColumn(VolDownCount,"down",1);
AddColumn(VolUpCount,"up",1);
Cheers,
Graham
http://groups.msn.com/ASXShareTrading
http://groups.msn.com/FMSAustralia
-----Original Message-----
From: William Peters [mailto:williampeters@xxxxxxxxxxxx]
Sent: Thursday, 27 November 2003 8:24 AM
To: amibroker@xxxxxxxxxxxxxxx
Subject: RE: [amibroker] sum only positive days
Graham,
Your formula sums the volume from the up days within the last 20 bars (it
counts the days that were not up). Jayson asked for the sum of the volume of
the last 20 up/down days which could possible go back to the beginning of
the data array and isn't limited to the last 20 bars.
J:
"This is not to be confused with summing the up days of the last 20 bars"
Regards,
William Peters
www.amitools.com
-----Original Message-----
From: Graham [mailto:gkavanagh@xxxxxxxxxxxxx]
Sent: Wednesday November 26, 2003 5:49 PM
To: amibroker@xxxxxxxxxxxxxxx
Subject: RE: [amibroker] sum only positive days
Jayson, this will sum the last 20 bars for x which will either be zero or
the volume.
x=iif(c>ref(c,-1),v,0)
Y = sum(x,20);
Cheers,
Graham
http://groups.msn.com/ASXShareTrading
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
>
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/
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/
------------------------ 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/
|