[Bug Report] Signal does not execute at all

Questions about MultiCharts and user contributed studies.
2haerim
Posts: 502
Joined: 01 Sep 2006
Been thanked: 2 times

[Bug Report] Signal does not execute at all

Postby 2haerim » 10 Feb 2009

Code: Select all


Input: Price1(151.66), Price2(153.81), Price3(155.02), Price4(157.33), conNumber(10);

Input: LossCut(0.66);
var: entryNumber(0);

Var: BN(0);


IF DATE<>DATE[1] THEN BEGIN
BN=BARNUMBER;
END;

If time > 0859 and time < 1429 then
begin
print(d," ", t, " ", marketposition, " ",c," ", c crosses over Price1 ," ",c crosses over Price2
, " ", c crosses over Price3);

If marketposition = 0 then
begin
if c crosses over Price1 then
begin
buy("c 1") conNumber contracts next bar at market;
entryNumber = 1;
end;

if c crosses over Price2 then
begin
buy("c 2") conNumber contracts next bar at market;
entryNumber =2;
end;

if c crosses over Price3 then
begin
buy("c 3") conNumber contracts next bar at market;
entryNumber=3;
end;

if c crosses over Price4 then
begin
buy("c 4") conNumber contracts next bar at market;
entryNumber=4;
end;

end;

if marketposition = 1 then
begin
if c crosses under Price2 and entryNumber = 1 then
begin
sell("s 1") conNumber contracts next bar at market;
entryNumber=0;
end;

if c crosses under Price3 and (entryNumber = 1 or entryNumber = 2) then
begin
sell("s 2") conNumber contracts next bar at market;
entryNumber=0;
end;

if c crosses under Price4 and (entryNumber = 1 or entryNumber = 2 or entryNumber = 3 ) then
begin
sell("s 3" ) conNumber contracts next bar at market;
entryNumber=0;
end;

if c crosses under (entryprice - LossCut) then
begin
sell("z " ) conNumber contracts next bar (entryprice - LossCut) at stop;
end;
end;
End;

if time > 1439 then
begin
if marketposition = 1 then
begin
sell("final") conNumber contracts next bar at market;
end;
end;
The above code NEVER prints any output in the following settings:
Resolution : 1 min
Date range : From 2009/02/11 To 2009/02/11 (to use today's chart only)
MBB : 1


Check if this is bug or not please.

SUPER
Posts: 646
Joined: 03 Mar 2007
Has thanked: 106 times
Been thanked: 84 times

Postby SUPER » 11 Feb 2009

2haerim,

I tried your code on Dax futures with relevent changes to your input Price1 etc,. and it seems to work on my end.

I do not know what intstrument (symbol) you are using it on. It works on futures for sure.


Regards
Super

2haerim
Posts: 502
Joined: 01 Sep 2006
Been thanked: 2 times

Postby 2haerim » 11 Feb 2009

Thanks for trying.

This code does not work on special situations.
For example, when the market is open at 9:00AM, there is an empty chart because I set the date range as today only. And I set the MBB 1.
So you will see just a black screen before the market is open.

Now the market is open, and the realtime ticks are coming in. Strangely the signal should never gets generated but after a while I close the chart and reopen it, there was some signals and after then it works normal.

So, I think MC does not handle the initial signal because there are no ticks before market is open.

Just try to set the chart before market opens and limit the date range as today, that is, set the "from" and "to" as today's value. Then wait to see the ticks come in after markets open.

If you adjust the input value appropriately, sooner or later you should be able to see a signal, but the reality is not the case.

SUPER
Posts: 646
Joined: 03 Mar 2007
Has thanked: 106 times
Been thanked: 84 times

Postby SUPER » 11 Feb 2009

Based on your suggestion I tried it out on@ES.D and managed to get correct trades, I will give it a try again tomorrow to see if it still holds good.

I do remember that you discovered bug with "Cross over/under" wondering if it could be causing this problem your have highlighted?

2haerim
Posts: 502
Joined: 01 Sep 2006
Been thanked: 2 times

Postby 2haerim » 11 Feb 2009

Ok. Here is again very clear evidence of the bug.
I tried this code to V5 Beta2 and also V4 Beta3 (Build 1609). Both showed the same bug.

Code: Select all

Input: Price1(151.66), Price2(153.81), Price3(155.02), Price4(157.33), conNumber(10);


print(d," X2 ", t, "ind");

If time > 0559 and time < 1429 then
begin
print(d," Y2 ", t, "ind");
Plot1(c,"Close");
End;
This is the test indicator code (named HanTestInd2). It does not use any history bar at all but use d,t, and c only.

See the attached chronological screen captures.
HanTestInd2 started to plot only after I turned off and on again the status.
Otherwise it won't never plot or print output anything forever.

This bug applies to signals too.
Attachments
BUG_HanTest.zip
(500.48 KiB) Downloaded 131 times

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

Postby TJ » 11 Feb 2009

MC product version: Version 4.0 Beta 1 (Build 1440)
PowerEditor version 3
product version 4.0.1440.201
File version 1.6.1440.201

i tried code A (no change)

Code: Select all

{code A}
Input: Price1(151.66), Price2(153.81), Price3(155.02), Price4(157.33), conNumber(10);

print(d," X2 ", t, "ind");

If time > 0559 and time < 1429 then
begin
print(d," Y2 ", t, " ind");
Plot1(c,"Close");
End;
result of code A
1090211.00 X2 1606.00 ind
1090211.00 X2 1608.00 ind
1090211.00 X2 1610.00 ind
1090211.00 X2 1612.00 ind
1090211.00 X2 1614.00 ind
1090211.00 X2 1615.00 ind
I tried Code B (with X2 section commented out)

Code: Select all

{Code B}
{commented out X2 section}

Input: Price1(151.66), Price2(153.81), Price3(155.02), Price4(157.33), conNumber(10);


{print(d," X2 ", t, " ind");}

If time > 0559 and time < 1429 then
begin
print(d," Y2 ", t, " ind");
Plot1(c+1000,"Close");
End;
Result of Code B
1090211.00 Y2 1416.00 ind
1090211.00 Y2 1418.00 ind
1090211.00 Y2 1420.00 ind
1090211.00 Y2 1422.00 ind
1090211.00 Y2 1424.00 ind
1090211.00 Y2 1426.00 ind
1090211.00 Y2 1428.00 ind

2haerim
Posts: 502
Joined: 01 Sep 2006
Been thanked: 2 times

Postby 2haerim » 11 Feb 2009

Ok. let me ask a few questions.

[1] Did you set up the chart before market open?
[2] Did you set up the chart as I said? See the screen shots from my previous post. You should see no bars at all in your chart and open it before market opens. Date range should be today only.
[3] Did you apply the indicator before market opens?

I know it works and prints well if I apply the indicator or signal after many bars already plotted. If you set up the chart and do exactly as I say, you won't see any prints at all until you turn it off and turn it on again.


Anyway thanks for trying and keep try as I recommended and see what you get.

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

Postby TJ » 11 Feb 2009

no, i tested it out just now.
even with the bars plotted, it is not right.
i only get the X2 but not the Y2.
shouldn't i get both?

edit: ok, maybe not because the time is passed 1429
but then, when I commented out the X2 section, I shouldn't get anything at all, right?

2haerim
Posts: 502
Joined: 01 Sep 2006
Been thanked: 2 times

Postby 2haerim » 11 Feb 2009

Ok. I see your point correctly now.

I thought you got all the correct results, but now I understand your results are not correct either.

Yes I've already tested this before and commenting on and off the first print statement affects the results, but to avoid confusion, I just described the main bug issue.

Anyway, MC has clearly bug about this code and chart settings.

Thanks for your trying. :!:

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

Postby TJ » 11 Feb 2009

i ran the code on HSI 49 volume bar chart.
I added the indicator before the market opens.

see attached for result:
Attachments
X2Y2.txt
(66.13 KiB) Downloaded 279 times

SUPER
Posts: 646
Joined: 03 Mar 2007
Has thanked: 106 times
Been thanked: 84 times

Postby SUPER » 12 Feb 2009

Like I said yesterday I ran your new code on first tick of @ES.D and it seems to work, here's print out to confirm .

Code: Select all


1090212.00 X2 831.00ind
1090212.00 Y2 831.00ind
1090212.00 X2 831.00ind
1090212.00 Y2 831.00ind
1090212.00 X2 831.00ind
1090212.00 Y2 831.00ind
1090212.00 X2 831.00ind
1090212.00 Y2 831.00ind
1090212.00 X2 831.00ind
1090212.00 Y2 831.00ind

2haerim
Posts: 502
Joined: 01 Sep 2006
Been thanked: 2 times

Postby 2haerim » 12 Feb 2009

SUPER,

Can you post some screen shots as I did?

Format Symbol Settings => to see the date range is today only
Empty screen before market open with indicator applied
screen shots some minutes after market opens

Even if you still have the correct results, me and TJ confirmed MC behaves buggy.

TSS should check this and fix the bug.

User avatar
Marina Pashkova
Posts: 2758
Joined: 27 Jul 2007

Postby Marina Pashkova » 13 Feb 2009

Hi HaeRim,

The behavior that you have been describing in this thread has been reproduced and confirmed as a bug. The bug will be fixed in the gold release.

Regards.

SUPER
Posts: 646
Joined: 03 Mar 2007
Has thanked: 106 times
Been thanked: 84 times

Postby SUPER » 13 Feb 2009

2Haerim.

Yes you are absolutely correct in your observation, Today,I managed to get same error you have reported, strange I did not get it yesterday though. The only thing that I did was re-boot my PC this morning and maybe that helped me reproduce it on my end.

I am glad that Marina has confirmed this bug and look foward to their fix.

Great job 2Haerim..keep up the good work.
Attachments
H2.jpg
(132.84 KiB) Downloaded 968 times

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

Postby TJ » 13 Feb 2009

if there is a Bug Sweeper rating, HaeRim will get +1 vote from me.

User avatar
Andrew Kirillov
Posts: 1589
Joined: 28 Jul 2005
Has thanked: 2 times
Been thanked: 31 times
Contact:

Postby Andrew Kirillov » 17 Mar 2009

The bug will be fixed in Beta 5.


Return to “MultiCharts”