How to handle Portfolio_OpenPositionProfit in a chart  [SOLVED]

Questions about MultiCharts and user contributed studies.
moses
Posts: 54
Joined: 16 Nov 2012
Has thanked: 34 times
Been thanked: 7 times

How to handle Portfolio_OpenPositionProfit in a chart

Postby moses » 22 Jan 2013

I am using the "Portfolio_OpenPositionProfit" function in my signals, which can only be used in the portfolio backtester.
As to be expected, when I insert my signal on a chart, I get an error.

Has anyone found a way to make such signals work in a chart, e.g. with an íf' statement that can understand if the signal is running on a chart or in the portfolio optimiser?

Basically I would like to avoid having two signals doing the same job, which increases the risk of mistakes and inconsistencies.

Thanks a lot
Andreas

Dru
Posts: 107
Joined: 28 Aug 2007
Has thanked: 4 times
Been thanked: 171 times

Re: How to handle Portfolio_OpenPositionProfit in a chart  [SOLVED]

Postby Dru » 23 Jan 2013

moses wrote:I am using the "Portfolio_OpenPositionProfit" function in my signals, which can only be used in the portfolio backtester.
As to be expected, when I insert my signal on a chart, I get an error.

Has anyone found a way to make such signals work in a chart, e.g. with an íf' statement that can understand if the signal is running on a chart or in the portfolio optimiser?

Basically I would like to avoid having two signals doing the same job, which increases the risk of mistakes and inconsistencies.

Thanks a lot
Andreas

Code: Select all

if 1=getappinfo(aiisportfoliomode) then print("portfolio");
These users thanked the author Dru for the post (total 2):
mosesAndrew MultiCharts

moses
Posts: 54
Joined: 16 Nov 2012
Has thanked: 34 times
Been thanked: 7 times

Re: How to handle Portfolio_OpenPositionProfit in a chart

Postby moses » 23 Jan 2013

Thanks a lot!
Will try it tonight!

Andreas

moses
Posts: 54
Joined: 16 Nov 2012
Has thanked: 34 times
Been thanked: 7 times

Re: How to handle Portfolio_OpenPositionProfit in a chart

Postby moses » 24 Jan 2013

Dru, thanks again for the code.
Please let me ask. where did you find the 'aiisportfoliomode' word? I searched all the MC help files, wikis etc etc, and I can't find it anywhere!

I am wondering if there is an updated manual or something, that I am not aware of.

Take care
Andreas

User avatar
JoshM
Posts: 2090
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1526 times
Been thanked: 1487 times
Contact:

Re: How to handle Portfolio_OpenPositionProfit in a chart

Postby JoshM » 01 Feb 2013

moses wrote:where did you find the 'aiisportfoliomode' word? I searched all the MC help files, wikis etc etc, and I can't find it anywhere!

Good question, I can't find it either. Though the word does pop-up in the 'intellisense' feature of the PowerLanguage Editor, but without a help description.


Return to “MultiCharts”