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

[amibroker] Re: Value of all my trades on a bar by bar basis



PureBytes Links

Trading Reference Links

Hi,

I found one error I made in the code numberofshares should be:

numberofshares = (Equity() * (PositionSize * -1) / 100) / C;

I had the close divided by the position size instead of the other way 
around to get the number of shares bought.

Even so, it still isn't what I'm after because I am using -10 for the 
PositionSize and it is not increasing as equity increases. Looking at 
the BarByBar output the stock value is stuck at 10% of equity.

Thanks

--- In amibroker@xxxxxxxxxxxxxxx, "garycristo" <garycristo@xxxx> 
wrote:
> Thanks Graham.
> 
> > I think you would need to use custom backtest stuff
> 
> OK cheers, I think that will take a bit of learning!
> 
> I did try this but it is simply the wrong way to do it I think:
> 
> Intrade        = Flip(Buy,Sell);
> numberofshares = C / (Equity() * (PositionSize * -1) / 100);
> BarByBar       = IIf(Intrade, C * numberofshares, Null);
> AddToComposite(BarByBar, "~BarByBar", "C");
> 
> AddColumn(Equity()*PositionSize*-1/100,"BuyValue",1.3,colorIndigo,
> colorYellow);
> AddColumn(BarByBar ,"BarByBar ",1.3,colorIndigo,colorYellow);
> AddColumn(numberofshares ,"numberofshares ",1.3,colorIndigo,
> colorYellow);
> 
> I'm getting errors in the result list.
> 
> Thanks
> 
> --- In amibroker@xxxxxxxxxxxxxxx, Graham <kavemanperth@xxxx> wrote:
> > I think you would need to use custom backtest stuff
> > 
> > You could try addtocomposite from an explore by adding the price
> > values only when in trades.
> > 
> > On 10/3/05, garycristo <garycristo@xxxx> wrote:
> > > Anyone have any tips to do this?
> > >
> > > I have a suspicion that I can't simply do a scan/addtocomposite 
to
> > > get
> > > the total value of all trades bar by bar as I think the 
backtester
> > > needs to run to get the correct position sizes.
> > >
> > > Could this be a custom backtester job? I hoped it would be
> simpler 
> as
> > > the custom backtester baffles me!
> > >
> > > Thanks for any help.
> > >
> > >
> > > --- In amibroker@xxxxxxxxxxxxxxx, "garycristo" <garycristo@xxxx>
> > > wrote:
> > > > Hi group,
> > > >
> > > > How can I get the value of all my trades on a bar by bar
basis 
> in
> > > my
> > > > backtested system and chart it?
> > > >
> > > > I'm not talking about the normal equity() which is plotted at 
> the
> > > exit
> > > > of a trade but by multiplying the Positionsize by the
Buyprice 
> for
> > > > each trade that is open on each bar and add them to get the 
> value.
> > > How
> > > > can I do this please?
> > > >
> > > > Thanks.




------------------------ Yahoo! Groups Sponsor --------------------~--> 
Help tsunami villages rebuild at GlobalGiving. The real work starts now.
http://us.click.yahoo.com/njNroD/KbOLAA/cosFAA/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/