[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,

sorry, I have to become more precise regarding the bo.Equity problem.
Please see the debug output below for details:

[2744] # bo.InitialEquity (default) = 10000
[2744] # bo.Equity (default) = 10000
[2744] # bo.InitialEquity (updated) = 10000
[2744] # bo.Equity (updated) = 123456
[2744] # bo.InitialEquity (after bo.PreProcess) = 10000
[2744] # bo.Equity (after bo.PreProcess) = 123456
[2744] # VZ : Cash = 10000    // not set to bo.Equity
[2744] # VZ : Equity = 123456 // set to bo.Equity
[2744] # VZ : IsEntry
[2744] # VZ : Cash = 9001.12
[2744] # VZ : Equity = 10000  // changed to default after first exit
signal???
[2744] # VZ : IsExit
[2744] # VZ : Cash = 10001
[2744] # VZ : Equity = 10001
[2744] # VZ : IsEntry
[2744] # VZ : Cash = 9016.78
[2744] # VZ : Equity = 10047.5
[2744] # VZ : IsExit
[2744] # VZ : Cash = 9990.15
[2744] # VZ : Equity = 9990.15
[2744] # VZ : IsEntry
[2744] # VZ : Cash = 9003.65

Immediately after bo.Equity = 123456 the equity is updated, but as you
can see the equity changes back to the default value after the first
exit signal and ignores my setting! Hereafter the Equity is calculated
correct. I think the "Cash" value should also be the same as Equity
before the first signal arrives, is my understanding correct?

Best regards,
Markus

--- In amibroker@xxxxxxxxxxxxxxx, "markhoff" <markhoff@xxx> wrote:
>
> 
> 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@> 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@>
> > 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/