+1 888 340 6572
MultiCharts Project Management
previous_open_issue.png
Go to the previous open issue
previous_issue.png
Go to the previous issue (open or closed)
star_faded.png
Please log in to bookmark issues
bug_report_small.png
Open Bug report MC-2375

Portfolio Trader with 2 oposing strategies running on same instrument with same timeframe & history, on same broker: PNL graph looks surprisingly incorrect: instead of one line, there are two taking totally different paths

action_vote_minus_faded.png
1
Votes
action_vote_plus_faded.png
next_issue.png
Go to the next issue (open or closed)
next_open_issue.png
Go to the next open issue
Description

When applying two opposite signals in their own separate Strategies but on same symbol within a portfolio trader session, one would expect that when a backtest is run, the two completely oposing PNL Shapes would cancel eachother and result in a completely FLAT Aggregated PNL Line ... well, that's not the case: Aggregated PNL Line has actually two separated High & Low (green & red) lines ... which make little sense ... there should be a flat zero line.

Steps to reproduce this issue

Open Portfolio Trader, add two 2 strategies.
Under each Strategy - Instrument, add the same instrument - say @EC (1.1.2010 - now, daily bars local TimeZone).

Build a strategy test:
Once begin
Cleardebug; Clearprintlog;
end;

If BarNumber = 1 then buy next bar at open;

If BarNumber = 3000 then sell next bar at open;

Build a strategy test1:

Once begin
Cleardebug; Clearprintlog;
end;

If BarNumber = 1 then sellshort next bar at open;

If BarNumber = 3000 then buytocover next bar at open;

As you can see it's the same strategy but with inversed signals.

When applying first signal to first strategy and second signal on second strategy one would expect that when a backtest is run, the two completely oposing PNL Shapes would cancel eachother and result in a completely FLAT Aggregated PNL Line ... well, that's not the case: Aggregated PNL Line has actually two separated High & Low (green & red) lines ... which make little sense ... there should be a flat zero line.

Comments (10)
#1
user-offline.png  andb (andb)
Nov 03, 2017 - 12:32
A file was uploaded. Capture.PNGicon_open_new.png
#2
user-offline.png  andb (andb)
Nov 03, 2017 - 12:32
A file was uploaded. CaptureA.PNGicon_open_new.png
#3
user-offline.png  andb (andb)
Nov 03, 2017 - 12:32
A file was uploaded. CaptureB.PNGicon_open_new.png
#4
user-offline.png  Zheka (Zheka)
Nov 07, 2017 - 05:38

I was able to reproduce this bug. Equity Curve Detailed with Drawdown also shows incorrect intraday drawdown values.

In the process I discovered another bug: "xxx Bars Back" in Data Range does not load more then 3 months of data.

See Bug Report
https://www.multicharts.com/pm/public/multicharts/issues/MC-2376

#5
user-offline.png  MultiCharts Support (MultiCharts)
Nov 10, 2017 - 09:47
A file was uploaded. screen3.PNGicon_open_new.png
#6
user-offline.png  MultiCharts Support (MultiCharts)
Nov 10, 2017 - 09:47
A file was uploaded. screen2.PNGicon_open_new.png
#7
user-offline.png  MultiCharts Support (MultiCharts)
Nov 10, 2017 - 09:47
A file was uploaded. screen1.PNGicon_open_new.png
#8
user-offline.png  MultiCharts Support (MultiCharts)
Nov 10, 2017 - 09:51
Hello andb,

Let me introduce some terms:
Equity High – max Equity per bar;
Equity Low – min Equity per bar.

Aggregated Equity High is equal to the Equity High sum of all symbols.
Aggregated Equity Low is equal to the Equity Low sum of all symbols.
Please refer to the attached screenshots.

The results you are getting are expected since MC Portfolio doesn’t make a difference between similar and different symbols and simply creates the sum of them. For MC Portfolio all symbols in different cells are separate, not related to each other, and there is no information about the price movement inside a bar.

A straight equity line shall be displayed for 1 tick resolution.
#9
user-offline.png  Zheka (Zheka)
icon_reply.pngDec 01, 02:21, in reply to comment #8
Alex,

What is then the calculation for "Intraday drawdown" in the Equity Curve Detailed with DD chart?


#10
user-offline.png  MultiCharts Support (MultiCharts)
Dec 22, 2017 - 06:42
DrawDown on Equity Curve Detailed graph shows drawdown from maximum equity value within the bar. As an example, you can apply the following signal to MSFT 1 Day chart. Values printed in Output window of PowerLanguage Editor shall correspond to the DrawDown values on Equity Curve Detailed graph.

[IntrabarOrderGeneration=True]
if currentbar=10 and barstatus=2 then buy next bar at market;
if currentbar=20 and barstatus=2 then sell next bar at market;
once cleardebug;
var: intrabarpersist max_eq(0), intrabarpersist dd(0);
if marketposition<>0 then
begin
if max_eq <> netprofit+maxpositionprofit then dd = 0;
max_eq = netprofit+maxpositionprofit;
end;
if barstatus = 0 then dd = 0;
if dd < max_eq - i_OpenEquity then dd = max_eq - i_OpenEquity;
if currentbar>10 and currentbar<25 and barstatus=2 then
print("dt= ", datetimetostring(datetime), dd:10:5 );
History
Issue basics
  • Type of issue
    Bug report
  • Category
    Not determined
  • Targeted for
    Not determined
  • Status
    Not a bug
  • Priority
    Not determined
User pain
  • Type of bug
    Not triaged
  • Likelihood
    Not triaged
  • Effect
    Not triaged
Affected by this issue (0)
There are no items
People involved
Times and dates
  • Posted at
  • Last updated
Issue details
  • Reproducability
    Not determined
Attachments (6)
Commits (0)
There are no code checkins for this issue
Duplicate issues (0)
This issue does not have any duplicates