Profit Factor & Average Trade Profit in Portfolio Trader

Questions about MultiCharts and user contributed studies.
CharlieChalk
Posts: 7
Joined: 09 Feb 2015

Profit Factor & Average Trade Profit in Portfolio Trader

Postby CharlieChalk » 02 Jul 2016

Hello all,

i am struggling to find how to correctly code for Profit Factor and Average Trade as custom performance report indicators in Portfolio Trader.

I keep getting error messages such as "strategy performance is undefined". The problem is that while there are examples presenting the format, which to the best of my knowledge i have copied, they don't work!

For profit factor i have used the code below.

Any help appreciated.

Thanks

Code: Select all

Profit Factor(0);
id(strategyperformance.grossloss !=0) {
return strategy performance.grossprofit / strategyperformance.grossloss;
}

User avatar
TJ
Posts: 7742
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2222 times

Re: Profit Factor & Average Trade Profit in Portfolio Trader

Postby TJ » 02 Jul 2016

Hello all,

i am struggling to find how to correctly code for Profit Factor and Average Trade as custom performance report indicators in Portfolio Trader.

I keep getting error messages such as "strategy performance is undefined". The problem is that while there are examples presenting the format, which to the best of my knowledge i have copied, they don't work!

For profit factor i have used the code below.

Any help appreciated.

Thanks

Code: Select all

Profit Factor(0);
id(strategyperformance.grossloss !=0) {
return strategy performance.grossprofit / strategyperformance.grossloss;
}

is this TS code?

or MultiCharts .net code?

CharlieChalk
Posts: 7
Joined: 09 Feb 2015

Re: Profit Factor & Average Trade Profit in Portfolio Trader

Postby CharlieChalk » 06 Jul 2016

Hi thanks for replying.

This is MC code, it is a snippet from the PT > Optimisation > Optimisation Criteria > Custom Criteria

There is sample code that can be added to backtest criteria of your own choice or those beyond what is provided within the PT Backtester. The Normal Backtester for a standalone instrument has all of the basic criteria most need

Thanks

Charles

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: Profit Factor & Average Trade Profit in Portfolio Trader

Postby Henry MultiСharts » 12 Jul 2016

The proper code would be:

Code: Select all

Profit_Factor(0);
if (StrategyPerformance.GrossLoss != 0) {
return StrategyPerformance.GrossProfit / StrategyPerformance.GrossLoss;
}

CharlieChalk
Posts: 7
Joined: 09 Feb 2015

Re: Profit Factor & Average Trade Profit in Portfolio Trader

Postby CharlieChalk » 12 Jul 2016

Hi Henry,

when i try and apply the code to the chart i get an error message stating the following "Microsoft Script execution error. Description, Object expected Line 1"

Thanks
Charles

CharlieChalk
Posts: 7
Joined: 09 Feb 2015

Re: Profit Factor & Average Trade Profit in Portfolio Trader

Postby CharlieChalk » 12 Jul 2016

Hello Henry,

Just incase others are following and for future reference on the forum the correct code is as follows:

Code: Select all

if (StrategyPerformance.GrossLoss != 0) {
return StrategyPerformance.GrossProfit / StrategyPerformance.GrossLoss;
}
On a related subject, can i have more than one indicator within the Custom criteria? It looks like from the performance report there is only one designated column for the Custom Criteria?

Charles

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: Profit Factor & Average Trade Profit in Portfolio Trader

Postby Henry MultiСharts » 12 Jul 2016

You need to use the exact code with capital letters as it was provided above.

The performance report has only one Custom Criteria column. That is correct.


Return to “MultiCharts”