+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-429

Print statement bug

action_vote_minus_faded.png
0
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

The print statement has a bug. When a delimiter character is used inside quotes within a print statement the output is incorrect. I am moving legacy code from Tradestation to MC and have checked the MC output vs TS output and the MC output has issues as described.

Steps to reproduce this issue

Create a daily chart of @ES. Create a signal that has the following code
print (LEFTSTR(ELDateToString(date),2));
print (MIDSTR(ELDateToString(date),4,2));
print (",hello");
print (RIGHTSTR(ELDateToString(date),4)+ LEFTSTR(ELDateToString(date),2)+MIDSTR(ELDateToString(date),4,2),",hello");
For today (16th June 2011) you would expect the output (in the output bar in PowerLanguage editor) to be something like the following 4 lines (which is what you get in TS):-
2011
06
15
,hello
20110615,hello
However, in MC output bar you get:-
2011
06
15
,hello
2011061110615,hello
It appears the parsing on the delimiter (the comma) that is contained in quotes (another delimiter) is causing erroneous output.
As we are moving lots of legacy code to MC from TS this is a major issue as the output files we create are not correct.

Comments (5)
#0
user-offline.png  scooper (scooper)
Jun 17, 2011 - 02:50

Make a signal with this code in it and add to a daily chart of any instrument eg @ES
 
IF BarNumber = [b]1[/b] then

[color=#646464] 
[/color]cleardebug;
 [color=#0000ff]print
/color;
[color=#0000ff]print
/color;
[color=#0000ff]print
/color;
[color=#0000ff]print
/color;
[color=#0000ff]print
/color;
[color=#0000ff]print
/color;
[color=#0000ff]print
/color;
[color=#0000ff]print
/color;
[color=#0000ff]print
/color;
[color=#0000ff]print
/color;
[color=#0000ff]print
/color;
[color=#0000ff]print
/color;
[color=#0000ff]print
/color;
[color=#0000ff]print
[/color] (" ");
  
-----End of code
  
  
 The output looks like this (taken straight from my powerlanguage output bar):-
 

Concatenation Issue in Signals
RightStr on next line - should output 4 chars
2011
LeftStr on next line - should output 2 chars
06
MidStr on next line - should output 2 chars
16
Concatenated on next line of first 2 string functions above which should give a string 6 chars in length
201106
Concatenated on next line of all 3 string functions above which should give a string 8 chars in length but we get 13 chars
2011061110616
Concatenation on next line with a simple string again - note if you comment out this line and the next line in the strategy it sometimes works ok!
A16B
 
-----End of output

Note - this behaviour seems sporadic as sometimes if the last 3 lines of the signal are commented out it works correctly. Hence, I'm not sure if its a concat issue, pointer issue or a problem with one of the string functions.

 

#0
user-offline.png  scooper (scooper)
Jun 17, 2011 - 03:10

Heres the code again
 
IF BarNumber = 1 then
 cleardebug;
print("Concatenation Issue in Signals");
print("RightStr on next line - should output 4 chars");
print(RIGHTSTR(ELDateToString(date),4));
print("LeftStr on next line - should output 2 chars");
print(LEFTSTR(ELDateToString(date),2));
print("MidStr on next line - should output 2 chars");
print(MIDSTR(ELDateToString(date),4,2));
print("Concatenated on next line of first 2 string functions above which should give a string 6 chars in length");
print(RIGHTSTR(ELDateToString(date),4)+LEFTSTR(ELDateToString(date),2));
print("Concatenated on next line of all 3 string functions above which should give a string 8 chars in length but we get 13 chars");
print(RIGHTSTR(ELDateToString(date),4)+LEFTSTR(ELDateToString(date),2)+MIDSTR(ELDateToString(date),4,2));
print("Concatenation on next line with a simple string again - note if you comment out this line and the next line in the strategy it sometimes works ok!");
print("A"+MIDSTR(ELDateToString(date),4,2)+"B");
print (" ");
 
I have tested this on v6 release and its a problem. It seems to be OK in v7 beta 4 though.

#0
user-offline.png  scooper (scooper)
Jun 17, 2011 - 03:38

I also have taken a screenshot which I can email in if you need to see it or cannot replicate.

#0
user-offline.png  scooper (scooper)
Jun 17, 2011 - 10:34

Hi
 
That link appears to be broken....

#0
user-offline.png  Dave (Dave)
Jun 20, 2011 - 04:12

The issue has been fixed in MC 7 beta 1.

History
Issue basics
  • Type of issue
    Bug report
  • Category
    Not determined
  • Targeted for
    MultiCharts 7.0 (RELEASED)
  • Status
    Released
  • Priority
    Not determined
User pain
  • Type of bug
    Not triaged
  • Likelihood
    Not triaged
  • Effect
    Not triaged
Affected by this issue (3)
People involved
Times and dates
  • Posted at
  • Last updated
Issue details
  • Reproducability
    Not determined
  • Severity
    Critical
Attachments (0)
There is nothing attached to this issue
Commits (0)
There are no code checkins for this issue
Duplicate issues (0)
This issue does not have any duplicates