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

[amibroker] Re: CBI: bo.InitialEquity to set value not working?



PureBytes Links

Trading Reference Links

Hi Tomasz,

I also tried to set the equity by using bo.Equity, but also this did
not work (I tried both before and after bo.PreProcess). The manual
says that Equity property is read-only.

Best regards,
Markus

--- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko" <groups@xxx> wrote:
>
> Hello,
> 
> Initial Equity is used to INITIALIZE equity at the start of the
backtest,
> nothing more. So even if you write to it, it has no effect because
> Equity is already initialized when you call GetBacktesterObject.
> 
> If you want to affect the equity (including equity at the start of
backtest)
> use Equity property instead.
> 
> Best regards,
> Tomasz Janeczko
> amibroker.com
> ----- Original Message ----- 
> From: "markhoff" <markhoff@xxx>
> To: <amibroker@xxxxxxxxxxxxxxx>
> Sent: Thursday, May 01, 2008 2:36 PM
> Subject: [amibroker] CBI: bo.InitialEquity to set value not working?
> 
> 
> > Hi,
> > 
> > I wonder if the CBI property bo.InitialEquity cannot be used to set
> > the initial equity. At least for me it does not work and I must use
> > the SetOption("InitialEquity", ...) command, although the
> > documentation does not say that the bo.InitialEquity is read-only.
> > 
> > Please see the code below:
> > 
> > --- cut ---
> > 
> > defaultPosSize = 1000;
> > 
> > InitialEquity = 123456;
> > 
> > Buy = Sell = Short = Cover = 0;
> > 
> > SetOption("UseCustomBacktestProc", True);
> > 
> > //SetOption("InitialEquity", InitialEquity);
> > 
> > SetCustomBacktestProc(""); 
> > 
> > // the trading rules
> > TwentyBarHHV = Ref(HHV(High, 20), -1);
> > Buy = High > TwentyBarHHV;
> > Sell = Ref(Buy, -10);
> > // cleanup excessive signals
> > Buy = ExRem( Buy, Sell );
> > Sell = ExRem( Sell, Buy );
> > 
> > if( Status("action") == actionPortfolio )
> > {
> > bo = GetBacktesterObject();
> > 
> > _TRACE("# bo.InitialEquity (default) = " + bo.InitialEquity);
> > _TRACE("# bo.Equity (default) = " + bo.Equity);
> > 
> > bo.InitialEquity = InitialEquity;
> > 
> > _TRACE("# bo.InitialEquity (updated) = " + bo.InitialEquity);
> > _TRACE("# bo.Equity (updated) = " + bo.Equity);
> > 
> > bo.PreProcess();
> > 
> > _TRACE("# bo.InitialEquity (after bo.PreProcess) = " +
bo.InitialEquity);
> > _TRACE("# bo.Equity (after bo.PreProcess) = " + bo.Equity);
> > 
> > for( bar = 0; bar < BarCount; bar++ )
> > {
> > for( sig = bo.GetFirstSignal( bar ); sig; sig = bo.GetNextSignal(
> > bar ) )
> > {
> > // cash and equity are only correct if SetOption() is used to set
> > InitialEquity
> > _TRACE("# " + sig.Symbol + " : Cash = " + bo.Cash);
> > _TRACE("# " + sig.Symbol + " : Equity = " + bo.Equity);
> > 
> > if(sig.IsEntry())
> > {
> > sig.PosSize = defaultPosSize ;
> > }
> > }
> > bo.ProcessTradeSignals( bar );
> > }
> > bo.PostProcess();
> > }
> > 
> > --- cut ---
> > 
> > Do you have any idea why bo.InitialEquity cannot be used to write
a value?
> > 
> > Thanks in advance and best regards,
> > Markus
> > 
> > 
> > 
> > ------------------------------------
> > 
> > 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
> > Yahoo! Groups Links
> > 
> > 
> >
>



------------------------------------

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
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

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