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

Re: [amibroker] Monthly Stats



PureBytes Links

Trading Reference Links

Hello ken,


You may be able to use MothlyCharts View -> Monthly, with AA -> Settings -> Periodicity - > Monthly


If you only want lasts month values for each symbol, something like that below might do, just run over your WatchList, or all ticker. Click on the change header to see all pos ticker at the top.


Price                 = C;

Per                 = BarCount - 1;

R                = ROC( Price, 1 );

UpMnths         = Cum( R > 0 );

DnMnths         = Cum( R < 0 );


SetOption"NoDefaultColumns"False );

Filter = Status"LastBarInRange" );

Col = IIf( R > 0colorPaleGreencolorWhite );

AddColumn( Price, "Price"1.2colorDefault, Col, 50 );

AddColumn( R, "%Change"1.2colorDefault, Col, 50 );

AddColumn( Per, "Per"1.0colorDefault, Col, 50 );

AddColumn( UpMnths, "UpMnths"1.0colorDefault, Col, 70 );

AddColumn( DnMnths, "DnMnths"1.0colorDefault, Col, 70 ); 


Best regards,

herman


For tips on developing Real-Time Auto-Trading systems visit:

http://www.amibroker.org/userkb/


Wednesday, June 25, 2008, 10:37:40 AM, you wrote:


>

I have a need to produce a csv from the AA results which show a variety of monthly stats on equity curves, or even fund or index symbols.  Things like the total number of months the symbol was up for the month, or down for the month, etc.

 

I produced this snippit of test code which seems to do the job ok, but I am wondering if there is an easier and better way.  I am only showing a couple of stats here but I have to make a whole list of monthly stats.

 

Two questions for those willing and interested in commenting:

 

1.  Is there a better more efficient way of doing this either with or without loops?  (It seems this approach without loops would be faster---(???) )

 

2.  My several attempts at using different time frame commands (inMonthly for example) did not produce anything.  Can someone tell me if this is a place to use SetTimeFrame(inMonthly) and if so, how would the code below be modified to make it work.  I have read and reread the Help files on this, and experimented to no avail, but obviously am missing a key piece of understanding.

 

Here is the code snippit that works:

 

Thanks for any comments:

 

Ken

 

 

Price = C;

Mnth = Month();

Nmnth = Mnth != Ref(Mnth,-1);

LmPrice = ValueWhen(Nmnth,Price,2);

ThisMP = ValueWhen(Nmnth,Price,1);

MnGain = 100 * (ThisMP - LmPrice)/LmPrice;

Per = LastValue(Cum(1));

MarkUp = MnGain>

0 AND Nmnth; 

Mark

Dn = MnGain<0 AND Nmnth; 

Up = 

IIf(Markup,1,0); 

Dn = 

IIf(Markdn,1,0); 

Up

Mnths = Sum(Up,Per); 

Dn

Mnths = Sum(Dn,Per); 

 

// Set to n =1 days

Filter

= 1;//Nmnth; 

Col = 

IIf(Nmnth,colorPink,colorDefault); 

AddColumn

(Price,"Price",1.2,colorDefault,Col,50); 

AddColumn

(LmPrice,"LmPrice",1.2,colorDefault,Col,50); 

AddColumn

(Per,"Per",1.0); 

AddColumn

(Up,"Up",1.0); 

AddColumn

(UpMnths,"UpMnths",1.0,colorDefault,Col,70); 

AddColumn

(DnMnths,"DnMnths",1.0,colorDefault,Col,70); 

   

__._,_.___

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 NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html




Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___