Portfolio Trader: MM Signal called multiple times per bar?  [SOLVED]

Questions about MultiCharts and user contributed studies.
User avatar
fbertram
Posts: 166
Joined: 16 Oct 2014
Location: Seattle, USA
Has thanked: 36 times
Been thanked: 76 times
Contact:

Portfolio Trader: MM Signal called multiple times per bar?

Postby fbertram » 26 Oct 2014

Dear MultiChart fans,

I am working on signals for use with Portfolio Trader. I have signals which will generate raw orders for all the instruments and then a MM signal, doing some additional magic on top. All my instruments are added as 1 day.

Somehow, I see that my MM Signal is called multiple times per bar. I have stripped down my code to just one relevant line:

Code: Select all

print(datetimetostring_ms(datetime_bar_update));
What I would expect to see, is one line per day. What I see in the output window is the following though:

Code: Select all

...
10/10/2014 14:30:00.000
10/10/2014 14:30:00.000
10/13/2014 14:30:00.000
10/13/2014 14:30:00.000
10/14/2014 14:30:00.000
10/14/2014 14:30:00.000
10/15/2014 14:30:00.000
10/15/2014 14:30:00.000
10/16/2014 14:30:00.000
10/16/2014 14:30:00.000
10/17/2014 14:30:00.000
10/17/2014 14:30:00.000
10/20/2014 14:30:00.000
10/20/2014 14:30:00.000
10/21/2014 14:30:00.000
10/21/2014 14:30:00.000
10/21/2014 14:30:00.000
10/21/2014 14:30:00.000
10/23/2014 14:30:00.000
10/23/2014 14:30:00.000
10/23/2014 14:30:00.000
10/24/2014 14:30:00.000
It is interesting to see, that for 10/24, I got called only once. Most of the times, I get called twice per day. 10/21 I got called fours times, 10/23 three times. The timestamps are all the same. What are these redundant calls? What am I missing?

Thank you,
best regards, Felix

User avatar
JoshM
Posts: 2195
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1544 times
Been thanked: 1565 times
Contact:

Re: Portfolio Trader: MM Signal called multiple times per ba

Postby JoshM » 27 Oct 2014

As I understand it, signals are calculated multiple times per bar in the Portfolio Trader: once for the signal generation, then a new cycle to determine which signal to execute (with taking into consideration the money management and priority).

For more, see calculation diagram and script calculation in the Portfolio Trader.

That you have a few bars where the script is only calculated once (as opposed to the double calculations on the other bars) can be caused by no signals generated on those bars: then the second calculation cycle is not needed.

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

Re: Portfolio Trader: MM Signal called multiple times per ba

Postby Andrew MultiCharts » 27 Oct 2014

Hello fbertram,

Do your signals reference additional data series from code (data2, data3, etc.)?

User avatar
fbertram
Posts: 166
Joined: 16 Oct 2014
Location: Seattle, USA
Has thanked: 36 times
Been thanked: 76 times
Contact:

Re: Portfolio Trader: MM Signal called multiple times per ba

Postby fbertram » 27 Oct 2014

Hi Andrew,

no, my signals do not reference any additional data series. The portfolio has about 180 instruments in it, all of them 1 day. I also forgot to mention that I am seeing this during backtesting. Please let me know if there is any other information I can provide to help track this down.

Hi Josh,
thanks a lot for your response. I am not sure I interpret the information the same way you are. My understanding is that the 'regular' signals are executed once per bar per instrument. The money-management signal is then executed once per bar total, after the regular signals ran. The effect I am seeing is that most often my money-management signal is triggered multiple times per bar.

Thanks a lot,
best regards

Felix

User avatar
fbertram
Posts: 166
Joined: 16 Oct 2014
Location: Seattle, USA
Has thanked: 36 times
Been thanked: 76 times
Contact:

Re: Portfolio Trader: MM Signal called multiple times per ba

Postby fbertram » 27 Oct 2014

I have attached some files showing a minimalistic version of the issue I am seeing. Unfortunately, this is rather critical to me, as it messes up my strategy.

Hope this helps!

Thank you,
best regards, Felix
Attachments
2014x27- bug multiple calls per bar.zip
(16.61 KiB) Downloaded 224 times

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

Re: Portfolio Trader: MM Signal called multiple times per ba

Postby Andrew MultiCharts » 28 Oct 2014

Most likely the reason of this is the different session settings for the symbols. If you make the session end the same for each of them, it should be working. To learn more about sessions, please read this.

User avatar
fbertram
Posts: 166
Joined: 16 Oct 2014
Location: Seattle, USA
Has thanked: 36 times
Been thanked: 76 times
Contact:

Re: Portfolio Trader: MM Signal called multiple times per ba

Postby fbertram » 28 Oct 2014

Hi Andrew,

thanks a lot for your response. Unfortunately, I cannot check your suggestion with MultiCharts right now. However, I did look into the PWS file I sent to see if I can see what you are seeing.

There are 10 stocks in the sample. They all use Free Quotes as the data feed. They all use the default session. However, they are mixed from NYSE and NASDAQ.

Also, I read through the article you pointed me to. It says: "Daily-based charts, by default, are not affected by session settings." All my data are daily - what am I missing?

Is there a chance you can modify the project as you see is required, confirm that solves the problem and send it back?

Thank you,
best regards, Felix

User avatar
fbertram
Posts: 166
Joined: 16 Oct 2014
Location: Seattle, USA
Has thanked: 36 times
Been thanked: 76 times
Contact:

Re: Portfolio Trader: MM Signal called multiple times per ba

Postby fbertram » 28 Oct 2014

Hi Andrew,

unfortunately I cannot confirm your suggestion. I have created a new project, now only including 2 stocks, both traded on NASDAQ. While the problem occurs much less often, it is still there:

Code: Select all

10/10/2014 14:30:00.000
10/13/2014 14:30:00.000
10/14/2014 14:30:00.000
10/15/2014 14:30:00.000
10/16/2014 14:30:00.000
10/17/2014 14:30:00.000
10/20/2014 14:30:00.000
10/21/2014 14:30:00.000
10/21/2014 14:30:00.000 <<<< this bar is still called twice!
10/23/2014 14:30:00.000
10/24/2014 14:30:00.000
I consider this a critical bug, as - at least in my application: It makes Portfolio Trader unusable for my strategy, and there does not seem to be a feasible workaround.

Thank you,
best regards, Felix
Attachments
2014x28- bug multiple calls per bar.zip
sample project
(24.21 KiB) Downloaded 228 times

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

Re: Portfolio Trader: MM Signal called multiple times per ba

Postby TJ » 28 Oct 2014

Please add BarStatus to your print statement.

eg:

Code: Select all

print(date, "BarStatus=", barstatus, datetimetostring_ms(datetime_bar_update));

User avatar
fbertram
Posts: 166
Joined: 16 Oct 2014
Location: Seattle, USA
Has thanked: 36 times
Been thanked: 76 times
Contact:

Re: Portfolio Trader: MM Signal called multiple times per ba

Postby fbertram » 29 Oct 2014

Hi TJ,

thanks for your message. Here is the output from bar status:

Code: Select all

date=1141001.00 barstatus= 2.00 datetime_bar_update=10/1/2014 14:30:00.000
date=1141002.00 barstatus= 2.00 datetime_bar_update=10/2/2014 14:30:00.000
date=1141003.00 barstatus= 2.00 datetime_bar_update=10/3/2014 14:30:00.000
date=1141006.00 barstatus= 2.00 datetime_bar_update=10/6/2014 14:30:00.000
date=1141007.00 barstatus= 2.00 datetime_bar_update=10/7/2014 14:30:00.000
date=1141008.00 barstatus= 2.00 datetime_bar_update=10/8/2014 14:30:00.000
date=1141009.00 barstatus= 2.00 datetime_bar_update=10/9/2014 14:30:00.000
date=1141010.00 barstatus= 2.00 datetime_bar_update=10/10/2014 14:30:00.000
date=1141013.00 barstatus= 2.00 datetime_bar_update=10/13/2014 14:30:00.000
date=1141014.00 barstatus= 2.00 datetime_bar_update=10/14/2014 14:30:00.000
date=1141015.00 barstatus= 2.00 datetime_bar_update=10/15/2014 14:30:00.000
date=1141016.00 barstatus= 2.00 datetime_bar_update=10/16/2014 14:30:00.000
date=1141017.00 barstatus= 2.00 datetime_bar_update=10/17/2014 14:30:00.000
date=1141020.00 barstatus= 2.00 datetime_bar_update=10/20/2014 14:30:00.000
date=1141021.00 barstatus= 2.00 datetime_bar_update=10/21/2014 14:30:00.000
date=1141021.00 barstatus= 2.00 datetime_bar_update=10/21/2014 14:30:00.000 <<<<< called twice!
<<<<< where did 10/22 go?
date=1141023.00 barstatus= 2.00 datetime_bar_update=10/23/2014 14:30:00.000
date=1141024.00 barstatus= 2.00 datetime_bar_update=10/24/2014 14:30:00.000
date=1141029.00 barstatus= 2.00 datetime_bar_update=10/29/2014 14:30:00.000
I am only now noticing that while I have 10/21 twice, 10/22 is missing completely. Looking at the other logs I posted on this thread, 10/21 has always been missing. Any hints where to look? I am getting a bit frustrated by now as I would not have expected to have issues of such a basic nature.

Dear MultiCharts team - would be great if you could please look into this.

Thank you,
best regards, Felix

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

Re: Portfolio Trader: MM Signal called multiple times per ba

Postby TJ » 29 Oct 2014

Hi TJ,

thanks for your message. Here is the output from bar status:
::
I am only now noticing that while I have 10/21 twice, 10/22 is missing completely. Looking at the other logs I posted on this thread, 10/21 has always been missing. Any hints where to look? I am getting a bit frustrated by now as I would not have expected to have issues of such a basic nature.

Dear MultiCharts team - would be great if you could please look into this.

Thank you,
best regards, Felix
I assume you have checked your data for integrity?

User avatar
fbertram
Posts: 166
Joined: 16 Oct 2014
Location: Seattle, USA
Has thanked: 36 times
Been thanked: 76 times
Contact:

Re: Portfolio Trader: MM Signal called multiple times per ba

Postby fbertram » 29 Oct 2014

Hi TJ,

yes, I have. 10/22 is included in the data for both stocks, nothing was sticking out there. Is there a semi-automatic way to check the data? Did you see issues w/ FreeQuotes before?

Thank you,
best regards, Felix

User avatar
fbertram
Posts: 166
Joined: 16 Oct 2014
Location: Seattle, USA
Has thanked: 36 times
Been thanked: 76 times
Contact:

Re: Portfolio Trader: MM Signal called multiple times per ba

Postby fbertram » 29 Oct 2014

Filed issue MC-1788.

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

Re: Portfolio Trader: MM Signal called multiple times per ba

Postby TJ » 29 Oct 2014

Hi TJ,
yes, I have. 10/22 is included in the data for both stocks, nothing was sticking out there. Is there a semi-automatic way to check the data? Did you see issues w/ FreeQuotes before?
Thank you,
best regards, Felix
Probably this is not data related.

It might have to do with maxbarsback.

I will leave this to MultiCharts tech support to look at.

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

Re: Portfolio Trader: MM Signal called multiple times per ba

Postby Andrew MultiCharts » 30 Oct 2014

We are studying the case. I will let you know as soon as we have any update.

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

Re: Portfolio Trader: MM Signal called multiple times per ba

Postby Andrew MultiCharts » 30 Oct 2014

Please go to QuoteManager and check if the 10/22/2014 is there for both symbols.

User avatar
fbertram
Posts: 166
Joined: 16 Oct 2014
Location: Seattle, USA
Has thanked: 36 times
Been thanked: 76 times
Contact:

Re: Portfolio Trader: MM Signal called multiple times per ba

Postby fbertram » 30 Oct 2014

Hi Andrew,
Please find my updates in the bug tracker. There were issues with my data... but fixing the data won't fix the problem in all instances.

Thank you,
Best regards, Felix

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

Re: Portfolio Trader: MM Signal called multiple times per ba

Postby Andrew MultiCharts » 05 Nov 2014

Could you send us the following files to support@multicharts.com?
  1. The portfolio workspace to reproduce the situation.
  2. Export of used symbols (with data) from QuoteManager in .qmd archive: https://www.multicharts.com/trading-sof ... rting_Data
  3. The exported scripts with all dependant functions that are used on the workspace: https://www.multicharts.com/trading-sof ... ng_Studies

User avatar
fbertram
Posts: 166
Joined: 16 Oct 2014
Location: Seattle, USA
Has thanked: 36 times
Been thanked: 76 times
Contact:

Re: Portfolio Trader: MM Signal called multiple times per ba

Postby fbertram » 05 Nov 2014

Hi Andrew,

thank you for following up. I have sent the data to support@multicharts.com. Please let me know if there is anything else I can provide.


Thank you,
best regards, Felix

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

Re: Portfolio Trader: MM Signal called multiple times per ba  [SOLVED]

Postby Andrew MultiCharts » 07 Nov 2014

As mentioned above, the case occur when bars have different closing time. By "different closing time" i mean exactly the time of close of bars in Edit Data window in QuoteManager.
Here are the steps after which the issue will be fixed:
  1. Open QuoteManager.
  2. Select all the symbols you use in Portfolio Trader with your left mouse click and pressed CTRL key.
  3. Make a right-click on any of the selected --> Edit Symbol...
  4. In the opened Multiple Symbols Editing window on the Settings tab please select use Exchange & ECN's Settings --> select any exhcnage you want (for example NASDAQ).
  5. On the Sessions tab of the same window please make sure the Use Exchange & ECN's Sessions is selected.
  6. Close MultiCharts and all its parts. Make sure all MC processes are ended in Windows Task Manager. Here you can find the list of all MC processes: https://www.multicharts.com/trading-sof ... _Processes
  7. Open only MultiCharts.
  8. Create daily charts (going back as far as you selected it in Portfolio Trader) for each of the symbols used in Portfolio Trader (those you modified in QuoteManager).
  9. One-by-one select each of the charts and press CTRL+R to reload data for every symbol.
  10. As soon as the reloading of data is over, all bars should have identical closing time and now if you calculate your strategy in Portfolio Trader, the PMM signal should be calculated only once per each date (on daily bars).

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

Re: Portfolio Trader: MM Signal called multiple times per ba

Postby orion » 07 Nov 2014

Hi Andrew,

I plan to use the PT heavily. It seems Felix is using equities only. I am planning to work with both equities and futures. I have all equities set with "Use Custom Session Template" -> "Use Stocks Regular Trading Hours" and all futures set to "Use custom sessions" (the session times are automatically filled in correctly in QM with this). I also have the time zone set to "Local" and my computer time zone is NY since I like to see everything from that perspective. One issue with "Use Exchange & ECN sessions" is that I can't set the time zone to "Local" which means charts for instruments trading in Chicago show different time zone than charts for instruments trading in NY. Will I have the same issue at Felix?

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

Re: Portfolio Trader: MM Signal called multiple times per ba

Postby Andrew MultiCharts » 10 Nov 2014

I plan to use the PT heavily. It seems Felix is using equities only. I am planning to work with both equities and futures. I have all equities set with "Use Custom Session Template" -> "Use Stocks Regular Trading Hours" and all futures set to "Use custom sessions" (the session times are automatically filled in correctly in QM with this). I also have the time zone set to "Local" and my computer time zone is NY since I like to see everything from that perspective. One issue with "Use Exchange & ECN sessions" is that I can't set the time zone to "Local" which means charts for instruments trading in Chicago show different time zone than charts for instruments trading in NY. Will I have the same issue at Felix?
As long as the actual closing timestamp of bars shown in local timezone in QuoteManager if you go to Edit Data window is identical for all symbols, there will be nor problem.


Return to “MultiCharts”