Portfolio backtester?

Questions about MultiCharts and user contributed studies.
greenroomhoo
Posts: 62
Joined: 03 Nov 2011
Has thanked: 12 times
Been thanked: 2 times

Portfolio backtester?

Postby greenroomhoo » 15 Feb 2012

Is there away to have it close all trades so there is no Open Position PL?
Does the Gross/Net Profits include the Open Position PL?

thanks

64 bit ROCKS

User avatar
Dave Masalov
Posts: 1712
Joined: 16 Apr 2010
Has thanked: 51 times
Been thanked: 489 times

Re: Portfolio backtester?

Postby Dave Masalov » 16 Feb 2012

Hello greenroomhoo,
Is there away to have it close all trades so there is no Open Position PL?
You want to see portfolio performance report with all positions closed (no Open Position PL), is my understanding correct?

The only way to do so is to close the positions using your script. I.e. close all open positions at the end of every trading session.
Does the Gross/Net Profits include the Open Position PL?
No it does not. You can calculate the sum of Portfolio_NetProfit and Portfolio_OpenPositionProfit in your script.

greenroomhoo
Posts: 62
Joined: 03 Nov 2011
Has thanked: 12 times
Been thanked: 2 times

Re: Portfolio backtester?

Postby greenroomhoo » 16 Feb 2012

ok thanks.

Xyzzy
Posts: 162
Joined: 19 Mar 2011
Has thanked: 43 times
Been thanked: 79 times

Re: Portfolio backtester?

Postby Xyzzy » 18 Feb 2012

I have a simple signal to do this, called "_Close Last Trade." It just has four lines of code:

Code: Select all

If LastBarOnChart AND MarketPosition = 1 then begin
Sell this bar at close ;
BuyToCover this bar at close ;
end ;
You can just add this additional signal to your existing portfolio, rather than having to add custom code to each and every script.

This is adapted from some code by Sunny Harris in TS Made Easy. (A good introductory book that's largely transferable to MultiCharts.)

http://www.amazon.com/TS-Made ... 0471353531

txls
Posts: 76
Joined: 17 Nov 2010
Has thanked: 36 times
Been thanked: 24 times

Re: Portfolio backtester?

Postby txls » 18 Feb 2012

Code: Select all

If LastBarOnChart AND MarketPosition = 1 then begin
if Marketposition <> 0, no?

Xyzzy
Posts: 162
Joined: 19 Mar 2011
Has thanked: 43 times
Been thanked: 79 times

Re: Portfolio backtester?

Postby Xyzzy » 18 Feb 2012

D'oh! Good catch.

greenroomhoo
Posts: 62
Joined: 03 Nov 2011
Has thanked: 12 times
Been thanked: 2 times

Re: Portfolio backtester?

Postby greenroomhoo » 18 Feb 2012

Wow many many thanks for this.


Return to “MultiCharts”