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

Re: [amibroker] portfolio backtest. Extracting monthly cash



PureBytes Links

Trading Reference Links

hi Terry,
 
yes I am playing with it now and I think I have a solution. I look up Tomasz his presentation later. I made the following code that seems to do it.  It subtracts a certain amount of cash on the first of each month. It seems to work.
 
rgds, Ed
 
 
SetCustomBacktestProc("");

dd =
Day
();
dd = dd -
Ref(dd,-1
);

// amount of cash to extract from account each month

monthlySalary =
2000
;

if( Status("action") == actionPortfolio
) {
   
   
//fh = fopen("c:\\loopTest.txt", "w" );

   
   bo =
GetBacktesterObject();
   bo.PreProcess();

   
for( bar = 0; bar < BarCount
; bar++ ) {

      bo.ProcessTradeSignals( bar );
      
      
if (dd[ bar ] < -27
) {
      
         bo.Cash = bo.Cash - monthlySalary;
      
      }
      
      
//if( fh ) fputs( numtostr(bo.Cash) + "\n", fh );

            
   }

   bo.PostProcess();
  
//fclose( fh );

  
}
 
 
----- Original Message -----
From: "Terry" <MagicTH@xxxxxxxxxxx>
Sent: Sunday, March 12, 2006 4:41 PM
Subject: RE: [amibroker] portfolio backtest. Extracting monthly cash

> I'm pretty sure you need to use the Custom Backtest Interface. It can be
> done there. Tomasz gave a nice presentation on how to use this in
> Houston and this is posted on the Amibroker site somewhere.
> --
> Terry
> -----Original Message-----
> From:
amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On
> Behalf Of emp62
> Sent: Sunday, March 12, 2006 07:01
> To:
amibroker@xxxxxxxxxxxxxxx
> Subject: [amibroker] portfolio backtest. Extracting monthly cash
>
> hi,
>
> i'm sure it has been asked before but couldn't find it in the archives.
>
> If you do a portfolio backtest and want to subtract a certain amount of
> money from your Equity (as a salary for instance) how do you code this?
> Can
> it be done in the top level code or does one need to change the "cash"
> property of the Backtester Object using the custom backtester?
>
> thanks,
>
> Ed
>
>
>
>
> 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 other support material please check also:
>
http://www.amibroker.com/support.html
>

> Yahoo! Groups Links
>
>
>

>
>
>
>
> ------------------------ Yahoo! Groups Sponsor --------------------~-->
> Try Online Currency Trading with GFT. Free 50K Demo. Trade
> 24 Hours. Commission-Free.
>
http://us.click.yahoo.com/RvFikB/9M2KAA/U1CZAA/GHeqlB/TM
> --------------------------------------------------------------------~->
>
> 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 other support material please check also:
>
http://www.amibroker.com/support.html
>

> Yahoo! Groups Links
>
> <*> To visit your group on the web, go to:
>   
http://groups.yahoo.com/group/amibroker/
>
> <*> To unsubscribe from this group, send an email to:
>   
amibroker-unsubscribe@xxxxxxxxxxxxxxx
>
> <*> Your use of Yahoo! Groups is subject to:
>   
http://docs.yahoo.com/info/terms/

>
>
>


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 other support material please check also:
http://www.amibroker.com/support.html





SPONSORED LINKS
Investment management software Real estate investment software Investment property software
Software support Real estate investment analysis software Investment software


YAHOO! GROUPS LINKS