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

Re: [amibroker] Re: Trade.marginloan in custom backtester


  • Date: Wed, 6 Jan 2010 10:46:50 +0100
  • From: "Markus Witzler" <funnybiz@xxxxxx>
  • Subject: Re: [amibroker] Re: Trade.marginloan in custom backtester

PureBytes Links

Trading Reference Links



Hello Mike,
 
I though of anything but THAT>G<.
 
Many thanks
 
Markus
 
----- Original Message -----
From: Mike
Sent: Wednesday, January 06, 2010 2:44 AM
Subject: [amibroker] Re: Trade.marginloan in custom backtester

 

Margin is stored as a *negative* value. If you want to reduce your total, then add (not subtract) the margin to the total.

Mike

--- In amibroker@xxxxxxxxxps.com, "Markus Witzler" <funnybiz@xx.> wrote:
>
> Sorry,
>
> I meant this:
>
> < snip>
> for (trade = bo.GetFirstOpenPos(); trade; trade = bo.GetNextOpenPos())
>
>
> {
>
> value_all_open_pos=value_all_open_pos + trade.GetPrice(i, "C") * trade.shares - trade.marginloan; // I use margin in my system
>
> }
>
>
> my_equity [i] = value_all_open_pos + bo.cash;
>
> value_all_open_pos=0; // resetting to zero for next run - necessary?
>
> bo.UpdateStats(i, 1);
>
> bo.UpdateStats(i, 2);
>
> } // End of for loop over bars
>
> bo.PostProcess();
>
> AddToComposite(my_equity, "~~~My_Equity","x", 1+2+8+16+32+64+128);
>
> }
>
>
> ----- Original Message -----
> From: Markus Witzler
> To: amibroker@xxxxxxxxxps.com
> Sent: Tuesday, January 05, 2010 11:56 PM
> Subject: [amibroker] Trade.marginloan in custom backtester
>
>
>
>
> Hello,
>
> does anybody know if trade.marginloan also works for open positions?
>
> I want to use it like this
>
> < snip>
> for (trade = bo.GetFirstOpenPos(); trade; trade = bo.GetNextOpenPos())
>
>
> {
>
> value_all_open_pos=value_all_open_pos + trade.GetPrice(i, "C") * trade.shares;
>
> }
>
>
> my_equity [i] = value_all_open_pos + bo.cash - trade.marginloan; // I use margin in my system
>
> value_all_open_pos=0; // resetting to zero for next run - necessary?
>
> bo.UpdateStats(i, 1);
>
> bo.UpdateStats(i, 2);
>
> } // End of for loop over bars
>
> bo.PostProcess();
>
> AddToComposite(my_equity, "~~~My_Equity","x", 1+2+8+16+32+64+128);
>
> }
>
> For some reason, my_equity is higher if I use " minus trade.marginloan" (see above) than if I skip it. This is awkward...
>
> Thanks
>
> Markus
>
>
>
>
> __________ Information from ESET Smart Security, version of virus signature database 4668 (20091207) __________
>
> The message was checked by ESET Smart Security.
>
> http://www.eset.com
>



__________ Information from ESET Smart Security, version of virus signature database 4668 (20091207) __________

The message was checked by ESET Smart Security.

http://www.eset.com


__._,_.___


**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/





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

__,_._,___