portfolio trader details

Questions about MultiCharts and user contributed studies.
orion
Posts: 250
Joined: 01 Oct 2014
Has thanked: 65 times
Been thanked: 104 times

portfolio trader details

Postby orion » 06 Nov 2014

I have some questions on the portfolio trader. Consider a portfolio tree as follows:
Strategy S1
@ES
@AD
@JY
Strategy S2
@AD
@JY

We will denote the portfolio trader modes as BT = backtesting, FT = forward testing, AT = auto trading. We will use dot notation to indicate levels in the tree. So S1.@ES denotes strategy S1 on @ES, S1.@AD denotes strategy S1 on @AD and so on. S1.all will indicate strategy S1 applied to all of its instruments (@ES, @AD, @JY). There are thus 3 levels in the portfolio tree:
L1 level: such as S2.@JY
L2 level: such as S1.all
L3 level: portfolio root level


Questions:

1. Some of the PMM keywords start with pmm_ and some with pmms_. What does the presence or absence of s in the prefix signify?


2. pmms_stategies_count() help page says this is equal to number of symbols traded which would mean 3 in our portfolio (@ES, @AD, @JY) but perhaps it means to say 5 (S1.@ES, S1.@AD, S1.@JY, S2.@AD, S2.@JY)?


3. Strategy index parameter for the PMM functions: there are help pages that use index of 0 and others that use index starting at 1. I assume correct index is 1 for S1.@ES, 2 for S1.@AD, ..., and 5 for S2.@JY in our example above?


4. Exposure in Portfolio Settings: is this capped at 100% or can it be set to 150% if we want to trade equities with 50% margin (100% long, 50% short) and even higher if we want to day trade equities with higher margin?


5. Initial Portfolio Capital in Portfolio Settings: presumably this is only for BT and FT modes where it is accessed with keyword InitialCapital and is ignored in AT mode since broker account equity is used?


6. Max% Capital at Risk per Position in Portfolio Settings: since capital at risk depends on the stop and the skid, it is not clear to me what this means. Can you give a numeric example of what this does for both futures and equities if it is set to 5%? Take 10 @ES contracts and 100 AAPL shares as examples.


7. Max Potential Loss per Contract in Portfolio Settings: this is not clear either. If this were set to 5%, can you help with numeric example using 10 @ES contracts and 100 AAPL shares.


8. Clarifying the flow in http://www.multicharts.com/trading-soft ... on_Diagram, the risk control in the last stage is not based on user PL code but just on the limits set via the GUI in Portfolio Settings?


9. How does portfolio_calcMaxPotentialLossForEntry() work? Please help with numeric examples using 10 @ES contracts and 100 AAPL shares.


10. How is pmms_strategy_riskCapital() calculated? Please show numeric examples using 10 @ES contracts and 100 AAPL shares.


11. We have strategy keywords such as NetProfit and MaxConsecLosers. The former has a portfolio equivalent called portfolio_NetProfit while the latter has none. Two questions:
a) I assume the strategy keywords work at L1 only (and not L2)?
b) Is there any plan to provide a fuller equivalence between L1 and L3?
[Please refer to above portfolio tree for what I mean by L1, L2, L3 levels.]


12. Assuming SA mode, are any of the portfolio_* or pmm keywords synced with broker accounts or are they just internal calculations by PT? Please answer this for the following:
portfolio_grossLoss
portfolio_grossProfit
portfolio_investedCapital
portfolio_netProfit
portfolio_currentEntries
portfolio_openPositionProfit


13. In SA mode, using 'Do not show Assign the intial market position' and 'Use the actual position at broker', we can work with one strategy per symbol. The above portfolio uses S1.@AD and S2.@AD. Is there a way to sync using PMM keywords and if so can you sketch an outline of what it
may be? (Fallback scenario would be to use a meta-strategy but perhaps there is a better workaround using PMM keywords??).


14. Which should we assume is the most current documentation on PMM keywords: wiki page at http://www.multicharts.com/trading-soft ... M_Keywords or the documentation that came with the MC9.0 release download? There are functions such as array_contains() that are in the former but not in the latter and others such as pmms_strategy_allow_long_entries that are in the latter but not the former. If wiki is not current, can you please update it?

Thanks!

orion
Posts: 250
Joined: 01 Oct 2014
Has thanked: 65 times
Been thanked: 104 times

Re: portfolio trader details

Postby orion » 07 Nov 2014

After tinkering with PT, some of my questions have been answered. I would appreciate MC staff helping with items #5, #12, (and #13 if possible) from above and also validating the following for correctness. If following are correct, then they can serve as addenda for wiki docs.

14. Risk manager that uses portfolio settings is concerned only with allowing or denying of orders based on capital limits at strategy and portfolio level and does not concern itself with stop losses. In other words, it does not initiate liquidation of positions on its own. Correct?

15. Pseudocode for risk manager logic (for both futures and equities) is as follows. The inputs to the risk manager are the following from portfolio settings pane:
ExposurePct (Exposure value set by user)
MaxPctCapitalAtRisk (Max% of capital at risk per position)
MarginPerContract (set if 'Absolute margin value from QM symbol settings' selected)
MarginPerContractPct (set if 'Margin value as % of contract cost' selected)
MaxLossPerContract (set if 'Absolute max potential loss' selected)
MaxLossPerContractPct (set if 'Max potential loss as %' selected)

Initialization at start of trading is as follows:

Code: Select all

if initialization_at_start_of_trading then begin
portfolioCapital = accountValue * (ExposurePct/100);
strategyCapital = accountValue * (MaxPctCapitalAtRisk/100);
// other stuff
end

Following is done on orders that build positions:

Code: Select all

// equities in Quote Manager don't have bigPointValue
// bigPointValue = 1 makes following work for equities too
// orderSize is raw order size before risk manager runs

if margin_value_as_%_selected then
MarginPerContract = orderPrice * bigPointValue * (MarginPerContractPct/100);

if max_potential_loss_as_%_selected then
MaxLossPerContract = orderPrice * bigPointValue * (MaxLossPerContractPct/100);

capitalPerContract = MarginPerContract + MaxLossPerContract;
strategyOrdersAllowed = strategyCapital / capitalPerContract;
portfolioOrdersAllowed = portfolioCapital / capitalPerContract;
orderSize = min(orderSize, strategyOrdersAllowed, portfolioOrdersAllowed);
capitalRequiredForOrder = orderSize * capitalPerContract;
strategyCapital = strategyCapital - capitalRequiredForOrder;
portfolioCapital = portfolioCapital - capitalRequiredForOrder;
Following is done on orders that liquidate positions:

Code: Select all

// do calculations to increase strategyCapital and portfolioCapital
16. Can you please confirm the above logic is indeed how the risk manager works for both equities and futures which means it is possible for an account with $100,000 initial capital to hold a simultaneous long position of $100,000 and short position of $100,000 in equities with the right portfolio settings even though PT does not allow Exposure setting to exceed 100%?
Last edited by orion on 07 Nov 2014, edited 1 time in total.

User avatar
Andrew MultiCharts
Posts: 1587
Joined: 11 Oct 2011
Has thanked: 931 times
Been thanked: 559 times

Re: portfolio trader details

Postby Andrew MultiCharts » 07 Nov 2014

1. Some of the PMM keywords start with pmm_ and some with pmms_. What does the presence or absence of s in the prefix signify?
2. pmms_stategies_count() help page says this is equal to number of symbols traded which would mean 3 in our portfolio (@ES, @AD, @JY) but perhaps it means to say 5 (S1.@ES, S1.@AD, S1.@JY, S2.@AD, S2.@JY)?
3. Strategy index parameter for the PMM functions: there are help pages that use index of 0 and others that use index starting at 1. I assume correct index is 1 for S1.@ES, 2 for S1.@AD, ..., and 5 for S2.@JY in our example above?
4. Exposure in Portfolio Settings: is this capped at 100% or can it be set to 150% if we want to trade equities with 50% margin (100% long, 50% short) and even higher if we want to day trade equities with higher margin?
5. Initial Portfolio Capital in Portfolio Settings: presumably this is only for BT and FT modes where it is accessed with keyword InitialCapital and is ignored in AT mode since broker account equity is used?
6. Max% Capital at Risk per Position in Portfolio Settings: since capital at risk depends on the stop and the skid, it is not clear to me what this means. Can you give a numeric example of what this does for both futures and equities if it is set to 5%? Take 10 @ES contracts and 100 AAPL shares as examples.
7. Max Potential Loss per Contract in Portfolio Settings: this is not clear either. If this were set to 5%, can you help with numeric example using 10 @ES contracts and 100 AAPL shares.
8. Clarifying the flow in http://www.multicharts.com/trading-soft ... on_Diagram, the risk control in the last stage is not based on user PL code but just on the limits set via the GUI in Portfolio Settings?
9. How does portfolio_calcMaxPotentialLossForEntry() work? Please help with numeric examples using 10 @ES contracts and 100 AAPL shares.
10. How is pmms_strategy_riskCapital() calculated? Please show numeric examples using 10 @ES contracts and 100 AAPL shares.
11. We have strategy keywords such as NetProfit and MaxConsecLosers. The former has a portfolio equivalent called portfolio_NetProfit while the latter has none. Two questions:
a) I assume the strategy keywords work at L1 only (and not L2)?
b) Is there any plan to provide a fuller equivalence between L1 and L3?
[Please refer to above portfolio tree for what I mean by L1, L2, L3 levels.]
12. Assuming SA mode, are any of the portfolio_* or pmm keywords synced with broker accounts or are they just internal calculations by PT? Please answer this for the following:
portfolio_grossLoss
portfolio_grossProfit
portfolio_investedCapital
portfolio_netProfit
portfolio_currentEntries
portfolio_openPositionProfit
13. In SA mode, using 'Do not show Assign the intial market position' and 'Use the actual position at broker', we can work with one strategy per symbol. The above portfolio uses S1.@AD and S2.@AD. Is there a way to sync using PMM keywords and if so can you sketch an outline of what it
may be? (Fallback scenario would be to use a meta-strategy but perhaps there is a better workaround using PMM keywords??).
14. Which should we assume is the most current documentation on PMM keywords: wiki page at http://www.multicharts.com/trading-soft ... M_Keywords or the documentation that came with the MC9.0 release download? There are functions such as array_contains() that are in the former but not in the latter and others such as pmms_strategy_allow_long_entries that are in the latter but not the former. If wiki is not current, can you please update it?
  1. "Pmms_" indicates functions and keywords that can be used in money management signals and "pmm_" indicates functions and keywords that can be used in any signals.
  2. In your example it is 5.
  3. Indexing starts with 0. In your example indexes should be: 0, 1, 2, 3, 4.
  4. Exposure (% of Initial Portfolio Capital) - is a total volume of all the opened positions as a % from Portfoli Capital.
  5. Yes, that is correct.
  6. It is maximum risk % from capital per one opening position
  7. Potential Loss per Contract: Maximum amount of risk capital per contract in currency. If «Absolute Max Potential Loss» option is selected, then you set absolute value of MaxPotentialLossPerContract in currency. If «Max Potential Loss» option is selected then you set value of MaxPotentialLossPerContractPrcnt in %. MaxPotentialLossPerContract value is calculated using the following formula: MaxPotentialLossPerContract = (OrderPrice*BigPointValue) * MaxPotentialLossPerContractPrcnt / 100, where: OrderPrice – price of the order (if it is a market order, then Open price of the bar where the order is sent (not generated, but sent) is taken); BigPointValue – cost of price unit in currency (taken from symbols settings in QuoteManager). MaxPotentialLossPerContractPrcnt - maximum risk capital amount set in %. Please note: no matter what was values are specified in the above mentioned fields, fixed loss will be defined by the script. It means that, there will be no additional StopLoss orders sent which will be closing position if loss of the opened position has reached the specified size.
  8. That is correct.
  9. It calculates the percentage (specified in Potential Loss per Contract) of maximum loss that would be reached by a strategy if it would have entered at a specified price with a specified number of contracts.
  10. It returns the amount of money that is withheld from your capital by the specified (index input) strategy
  11. A) yes, L1; B) Not sure i understand you, please elaborate.
  12. Yes, all values are locally calculated within Portfolio Trader.
  13. They will be in sync only at start. Further they can get out of sync.
  14. We will update it as soon as we can, thank youy.

orion
Posts: 250
Joined: 01 Oct 2014
Has thanked: 65 times
Been thanked: 104 times

Re: portfolio trader details

Postby orion » 07 Nov 2014

Andrew,

Thanks much for the response.
6. It is maximum risk % from capital per one opening position
7. Potential Loss per Contract: Maximum amount of risk capital per contract in currency. If «Absolute Max Potential Loss» option is selected, then you set absolute value of MaxPotentialLossPerContract in currency. If «Max Potential Loss» option is selected then you set value of MaxPotentialLossPerContractPrcnt in %. MaxPotentialLossPerContract value is calculated using the following formula: MaxPotentialLossPerContract = (OrderPrice*BigPointValue) * MaxPotentialLossPerContractPrcnt / 100, where: OrderPrice – price of the order (if it is a market order, then Open price of the bar where the order is sent (not generated, but sent) is taken); BigPointValue – cost of price unit in currency (taken from symbols settings in QuoteManager). MaxPotentialLossPerContractPrcnt - maximum risk capital amount set in %. Please note: no matter what was values are specified in the above mentioned fields, fixed loss will be defined by the script. It means that, there will be no additional StopLoss orders sent which will be closing position if loss of the opened position has reached the specified size.
This is still not clear. Is your last sentence saying the same thing as, to restate in my words, "risk manager that uses portfolio settings is concerned only with allowing or denying of orders based on capital limits at strategy and portfolio level and does not concern itself with stop losses. In other words, it does not initiate liquidation of positions on its own?" A lot of confusion on my part resulted from seeing words like "Max Potential Loss" and so forth.

Also I would like to how what is being done with MaxPotentialLossPerContract inside the risk engine and not just what its definition is. Your post above has provided the definition but not clarified the use. Can you go through my pseudocode and let me know that is indeed how this is being used. That will give me full clarity.
4. Exposure (% of Initial Portfolio Capital) - is a total volume of all the opened positions as a % from Portfoli Capital.
9. It calculates the percentage (specified in Potential Loss per Contract) of maximum loss that would be reached by a strategy if it would have entered at a specified price with a specified number of contracts.
Andrew, your responses for 4 and 9 repeated the definitions on the wiki. I read the wiki three times over before posting my questions. The definitions on the wiki in this area are all circular and not very illuminating.

For 4, my question was not asking for the definition but asking if it is possible for an equity portfolio to be 100% long and 50% short (so a $100K portfolio being $100K long and $50K short) since the PT does not allow me to have Exposure exceed 100%.

As for 9, after mulling this some more I realize I am more confused than I thought I was. The portfolio_calcMaxPotentialLossForEntry() takes side as a parameter!!? How does a side of -1 differ from side of +1? Can you provide me with the equation used in the function?
11. A) yes, L1; B) Not sure i understand you, please elaborate.
The portfolio is a tree with levels L1, L2, L3 as explained in first post. There are a number of performance related keywords at L1 level such as NetProfit and MaxConsecLoss. There are a number of performance related keywords at L3 level. At L3 level we have portfolio_NetProfit but not portfolio_MaxConsecLoss. By fuller equivalence, I mean providing performance keywords like portfolio_MaxConsecLoss at L3 that are currently missing. We should go through the performance keywords available at L1 and look at providing all of those also at L3 level assuming they make sense at the L3 level. Also, it may make sense for future release to provide the equivalents at L2 level as well (a feature currently missing).

User avatar
Andrew MultiCharts
Posts: 1587
Joined: 11 Oct 2011
Has thanked: 931 times
Been thanked: 559 times

Re: portfolio trader details

Postby Andrew MultiCharts » 12 Nov 2014

In other words, it does not initiate liquidation of positions on its own?"
The answer is "yes".
Also I would like to how what is being done with MaxPotentialLossPerContract inside the risk engine and not just what its definition is. Your post above has provided the definition but not clarified the use. Can you go through my pseudocode and let me know that is indeed how this is being used. That will give me full clarity.
You mean this?

Code: Select all

MaxLossPerContract = orderPrice * bigPointValue * (MaxLossPerContractPct/100);
For 4, my question was not asking for the definition but asking if it is possible for an equity portfolio to be 100% long and 50% short (so a $100K portfolio being $100K long and $50K short) since the PT does not allow me to have Exposure exceed 100%.
If i understand you correctly you want to exceed the initial capital of your portfolio, what is not possible. Exposure = how many % of your capital you want to use for all positions. It cannot exceed your initial capital.
As for 9, after mulling this some more I realize I am more confused than I thought I was. The portfolio_calcMaxPotentialLossForEntry() takes side as a parameter!!? How does a side of -1 differ from side of +1? Can you provide me with the equation used in the function?
Side in this case = the direction of trade = marketpossition.
Using this keyword you create hypothetical trade and see how many % of the value specified in Potential Loss per Contract would be reached by the moment of strategy calculation.
The portfolio is a tree with levels L1, L2, L3 as explained in first post. There are a number of performance related keywords at L1 level such as NetProfit and MaxConsecLoss. There are a number of performance related keywords at L3 level. At L3 level we have portfolio_NetProfit but not portfolio_MaxConsecLoss. By fuller equivalence, I mean providing performance keywords like portfolio_MaxConsecLoss at L3 that are currently missing. We should go through the performance keywords available at L1 and look at providing all of those also at L3 level assuming they make sense at the L3 level. Also, it may make sense for future release to provide the equivalents at L2 level as well (a feature currently missing).
Thank you for your suggestion. Please leave us such feature request.

orion
Posts: 250
Joined: 01 Oct 2014
Has thanked: 65 times
Been thanked: 104 times

Re: portfolio trader details

Postby orion » 12 Nov 2014

Thanks Andrew.
Also I would like to how what is being done with MaxPotentialLossPerContract inside the risk engine and not just what its definition is. Your post above has provided the definition but not clarified the use. Can you go through my pseudocode and let me know that is indeed how this is being used. That will give me full clarity.
You mean this?

Code: Select all

MaxLossPerContract = orderPrice * bigPointValue * (MaxLossPerContractPct/100);
No, I meant going through the code I posted above (and reposted below for convenience). Since the risk engine is a black box whose behavior is undocumented, I am looking for clarification on how it enforces portfolio limits using MaxLossPerContract and MarginPerContract. Can you clarify that this code reflects the portfolio logic inside the risk engine?

Upon startup:

Code: Select all

portfolioCapital = accountValue * (ExposurePct/100);
strategyCapital = accountValue * (MaxPctCapitalAtRisk/100);
On each entry order:

Code: Select all

if margin_value_as_%_selected then
MarginPerContract = orderPrice * bigPointValue * (MarginPerContractPct/100);

if max_potential_loss_as_%_selected then
MaxLossPerContract = orderPrice * bigPointValue * (MaxLossPerContractPct/100);

capitalPerContract = MarginPerContract + MaxLossPerContract;
strategyOrdersAllowed = strategyCapital / capitalPerContract;
portfolioOrdersAllowed = portfolioCapital / capitalPerContract;
orderSize = min(orderSize, strategyOrdersAllowed, portfolioOrdersAllowed);
capitalRequiredForOrder = orderSize * capitalPerContract;
strategyCapital = strategyCapital - capitalRequiredForOrder;
portfolioCapital = portfolioCapital - capitalRequiredForOrder;
For 4, my question was not asking for the definition but asking if it is possible for an equity portfolio to be 100% long and 50% short (so a $100K portfolio being $100K long and $50K short) since the PT does not allow me to have Exposure exceed 100%.
If i understand you correctly you want to exceed the initial capital of your portfolio, what is not possible. Exposure = how many % of your capital you want to use for all positions. It cannot exceed your initial capital.
I am confused with your response since it means one of the standard practices of being able to take a $100K portfolio and take a $100K long and $50K short position is not allowed? If you can go through the pseudocode and let me know if that is indeed how the portfolio limits work. If they do work that way, then the $100K long and $50K short position in a $100K portfolio should be possible.

Thanks for clarifying.

User avatar
Andrew MultiCharts
Posts: 1587
Joined: 11 Oct 2011
Has thanked: 931 times
Been thanked: 559 times

Re: portfolio trader details

Postby Andrew MultiCharts » 18 Nov 2014

Orion, i cannot confirm 100% the formulas are correct, simply because i don't know how your broker allows you to use the money on your account. Let me rephrase some of the formulas for Portfolio Trader:
Upon startup:

Code: Select all

portfolioCapital = accountValue * (ExposurePct/100);
strategyCapital = accountValue * (MaxPctCapitalAtRisk/100);
Initial Portfolio Capital = all money available for your portfolio to buy/sell securities;
Equity = Initial Portfolio Capital + realized PnL;
Strategy capital = % of Equity that is available for each of your strategies individually.
On each entry order:

Code: Select all

if margin_value_as_%_selected then
MarginPerContract = orderPrice * bigPointValue * (MarginPerContractPct/100);

if max_potential_loss_as_%_selected then
MaxLossPerContract = orderPrice * bigPointValue * (MaxLossPerContractPct/100);

capitalPerContract = MarginPerContract + MaxLossPerContract;
strategyOrdersAllowed = strategyCapital / capitalPerContract;
portfolioOrdersAllowed = portfolioCapital / capitalPerContract;
orderSize = min(orderSize, strategyOrdersAllowed, portfolioOrdersAllowed);
capitalRequiredForOrder = orderSize * capitalPerContract;
strategyCapital = strategyCapital - capitalRequiredForOrder;
portfolioCapital = portfolioCapital - capitalRequiredForOrder;
Margin per contract (%) = order price * big point value * (margin per contract / 100);
Max potential loss per contract (%) = order price * big point value * (max potential loss per contract / 100);
Capital per contract = margin per contract + max potential loss per contract;
Max number of contracts per strategy = strategy capital / capital per contract;
Max number of contracts for whole portfolio = the formula is much more complicated;
Order size = specified either in code, or in strategy properties and it also can be modified by margin per contract and by max potential loss per contract;
Capital required for one order = order size * capital per contract;
For 4, my question was not asking for the definition but asking if it is possible for an equity portfolio to be 100% long and 50% short (so a $100K portfolio being $100K long and $50K short) since the PT does not allow me to have Exposure exceed 100%.
If i understand you correctly you want to exceed the initial capital of your portfolio, what is not possible. Exposure = how many % of your capital you want to use for all positions. It cannot exceed your initial capital.
I am confused with your response since it means one of the standard practices of being able to take a $100K portfolio and take a $100K long and $50K short position is not allowed? If you can go through the pseudocode and let me know if that is indeed how the portfolio limits work. If they do work that way, then the $100K long and $50K short position in a $100K portfolio should be possible.
If your initial capital or equity = $100K, you cannot open $100K long + $50K short. You can open $50K long + $50K short; or only $100K long.

orion
Posts: 250
Joined: 01 Oct 2014
Has thanked: 65 times
Been thanked: 104 times

Re: portfolio trader details

Postby orion » 18 Nov 2014

Orion, i cannot confirm 100% the formulas are correct, simply because i don't know how your broker allows you to use the money on your account.
If i understand you correctly you want to exceed the initial capital of your portfolio, what is not possible. Exposure = how many % of your capital you want to use for all positions. It cannot exceed your initial capital.
I am confused with your response since it means one of the standard practices of being able to take a $100K portfolio and take a $100K long and $50K short position is not allowed? If you can go through the pseudocode and let me know if that is indeed how the portfolio limits work. If they do work that way, then the $100K long and $50K short position in a $100K portfolio should be possible.
If your initial capital or equity = $100K, you cannot open $100K long + $50K short. You can open $50K long + $50K short; or only $100K long.
Andrew, thanks for your response. There is some misunderstanding here.

I did some backtesting since my last post requesting clarification and found that PT does indeed allow one to go 100% long and 50% short. That is indeed how it should be since most brokers allow 400% of initial capital for equity day trading. Also, your response has provided some more visibility into the equations used inside the risk manager, and they are consistent with the equity position being able to exceed 100% of initial capital. The risk manager is less of a black box now. It is still grey since I still don't fully understand what is going on under the covers. But I don't think it is going to get in my way. So this is no longer an open issue for me.

orion
Posts: 250
Joined: 01 Oct 2014
Has thanked: 65 times
Been thanked: 104 times

Re: portfolio trader details

Postby orion » 20 Nov 2014

Right click on instruments under portfolio tree shows menu item "Import instrument list". Can you please clarify the format for importing instrument lists.

User avatar
Andrew MultiCharts
Posts: 1587
Joined: 11 Oct 2011
Has thanked: 931 times
Been thanked: 559 times

Re: portfolio trader details

Postby Andrew MultiCharts » 20 Nov 2014

Right click on instruments under portfolio tree shows menu item "Import instrument list". Can you please clarify the format for importing instrument lists.
Here is an example. But for some data vendors it may not work.
Attachments
symbol list example.txt
(16 Bytes) Downloaded 349 times

orion
Posts: 250
Joined: 01 Oct 2014
Has thanked: 65 times
Been thanked: 104 times

Re: portfolio trader details

Postby orion » 08 Dec 2014

I am finding PT backtest mode to be very useful for doing things other than backtest. For many of my PT runs, I do not need a backtest report since there are no trades in my script; the scripts are doing some other processing of the database.

However, with such scripts which process large numbers of symbols and large numbers of bars per symbol, PT continues to run for a long time after the script completion trying to generate a strategy report. It finishes by generating the empty report (as expected). The report generation time (even for an empty report) seems to scale as the square of the number of symbols and the number of bars touched by the script.

It will be great if the report generation phase can be completely avoided for such scripts. This can be done either via a portfolio settings button that allows us to turn off strategy report generation or directly from the script:
[StrategyReportGeneration = false]

User avatar
Andrew MultiCharts
Posts: 1587
Joined: 11 Oct 2011
Has thanked: 931 times
Been thanked: 559 times

Re: portfolio trader details

Postby Andrew MultiCharts » 08 Dec 2014

However, with such scripts which process large numbers of symbols and large numbers of bars per symbol, PT continues to run for a long time after the script completion trying to generate a strategy report. It finishes by generating the empty report (as expected). The report generation time (even for an empty report) seems to scale as the square of the number of symbols and the number of bars touched by the script.

It will be great if the report generation phase can be completely avoided for such scripts. This can be done either via a portfolio settings button that allows us to turn off strategy report generation or directly from the script:
[StrategyReportGeneration = false]
Workaround:
  1. Run a backtest.
  2. Select "Settings" in the opened report.
  3. Close the report.
  4. Change anything and run another backtest.
  5. Report should be opened much faster on the same "Settings" page and if you don't click anything else, it will not take time for calculation of values to dispaly.

orion
Posts: 250
Joined: 01 Oct 2014
Has thanked: 65 times
Been thanked: 104 times

Re: portfolio trader details

Postby orion » 08 Dec 2014

Thanks for the workaround Andrew. I will check it out.

It will also be great if we can plan for the feature suggested for a future release. The difference between PT and chart scripts is that for charts we have two types of scripts, namely indicators and signals, and strategy report calculation can be avoided when desiring other number crunching by running the script as an indicator on the chart. However, a chart script can process only a limited number of symbols and so the PT becomes the ideal vehicle for lots of number crunching across many symbols in the database. However, currently the PT only takes one type of script, namely a signal. A new keyword based setting [StrategyReportGeneration = false] can be very helpful in this case.

User avatar
Andrew MultiCharts
Posts: 1587
Joined: 11 Oct 2011
Has thanked: 931 times
Been thanked: 559 times

Re: portfolio trader details

Postby Andrew MultiCharts » 08 Dec 2014



Return to “MultiCharts”