DIFFERENT RESULT WITH TS2K

Questions about MultiCharts and user contributed studies.
ppan
Posts: 106
Joined: 31 Jan 2007
Has thanked: 2 times

DIFFERENT RESULT WITH TS2K

Postby ppan » 07 Dec 2008

I have the following signal and apply in a 1 min chart.
----------------------------------------------------------------------------
SETEXITONCLOSE;

IF DATE <> DATE[1] THEN BEGIN
BUY ("B1") NEXT BAR AT MARKET;
BUY ("B2") NEXT BAR AT MARKET;
BUY ("B3") NEXT BAR AT MARKET;
END;
IF TIME = 1000 THEN BEGIN
SELL ("E1") 1 CONTRACT TOTAL NEXT BAR AT MARKET;
END;
IF TIME = 1100 THEN BEGIN
SELL ("E2") 1 CONTRACT TOTAL NEXT BAR AT MARKET;
END;
IF TIME = 1200 THEN BEGIN
SELL ("E3") 1 CONTRACT TOTAL NEXT BAR AT MARKET;
END;
----------------------------------------------------------------------------
The system will exit all 3 contracts at 10:00. The result is wrong.
If I apply the same code in TS2000 (replace the SELL with EXITLONG), the result is right. The system will exit ONLY 1 contract each time.


If I change the 3 BUY orders to 1 BUY order as follow, then the result become correct in MC.
----------------------------------------------------------------------------
IF DATE <> DATE[1] THEN BEGIN
BUY ("B1") 3 CONTRACTS NEXT BAR AT MARKET;
END;
----------------------------------------------------------------------------
Is it a BUG?

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

Postby SUPER » 08 Dec 2008

I tested your code ond TS 8.4 and can confirm that it works as desired. So it seems there is something wrong with MC for sure.

ppan
Posts: 106
Joined: 31 Jan 2007
Has thanked: 2 times

Postby ppan » 09 Dec 2008

You can try another example:

----------------------------------------------------------------------------
var: _counter(0) ;
VARS: COUNTER2(0);

SETEXITONCLOSE;

IF DATE <> DATE[1] THEN BEGIN
FOR COUNTER2 = 1 TO 2 BEGIN
BUY ("B1") 5 CONTRACTS NEXT BAR AT MARKET;
END;
_counter = 0 ;
END;

IF DATE = DATE[1] and _counter = 1 THEN
SELL("S1") 1 CONTRACT entry("B1") NEXT BAR AT MARKET;
IF DATE = DATE[1] and _counter = 2 THEN
SELL("S2") 1 CONTRACT entry("B1") NEXT BAR AT MARKET;
IF DATE = DATE[1] and _counter = 3 THEN
SELL("S3") 1 CONTRACT entry("B1") NEXT BAR AT MARKET;
IF DATE = DATE[1] and _counter = 4 THEN
SELL("S4") 1 CONTRACT entry("B1") NEXT BAR AT MARKET;
IF DATE = DATE[1] and _counter = 5 THEN
SELL("S5") 1 CONTRACT entry("B1") NEXT BAR AT MARKET;
IF DATE = DATE[1] and _counter = 6 THEN
SELL("S6") 1 CONTRACT entry("B1") NEXT BAR AT MARKET;
IF DATE = DATE[1] and _counter = 7 THEN
SELL("S7") 1 CONTRACT entry("B1") NEXT BAR AT MARKET;
IF DATE = DATE[1] and _counter = 8 THEN
SELL("S8") 1 CONTRACT entry("B1") NEXT BAR AT MARKET;
IF DATE = DATE[1] and _counter = 9 THEN
SELL("S9") 1 CONTRACT entry("B1") NEXT BAR AT MARKET;
IF DATE = DATE[1] and _counter = 10 THEN
SELL("S10") 1 CONTRACT entry("B1") NEXT BAR AT MARKET;
if ( barstatus = 2 ) then _counter += 1 ;
----------------------------------------------------------------------------

The above code is modified from the previous post:
http://forum.tssupport.com/viewtopic.ph ... highlight=

The S5 will exit 2 contracts. Is it a bug?

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

Postby SUPER » 09 Dec 2008

I am not able to verify your code in TS, as it seems order can not be inside a loop, its this part of the code which has problem

FOR COUNTER2 = 1 TO 2 BEGIN
BUY ("B1") 5 CONTRACTS NEXT BAR AT MARKET;
END;

also there is error on last line of code it should read

if ( barstatus(1) = 2 ) then _counter =_counter + 1 ;

-------------------------------------------------------

Marina's Code on the other link with last line modification as above works perfectly in TS

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

Postby Marina Pashkova » 09 Dec 2008

Hi ppan,

It has been confirmed that exits, using the 'total' keyword, do not work correctly in MultiCharts. The bug will be fixed in the next MC version.

Regards.

ppan
Posts: 106
Joined: 31 Jan 2007
Has thanked: 2 times

Postby ppan » 09 Dec 2008

Hi Super,

The above code cannot be run in TS. It can be run in MC. You can see the bug on the MC chart.

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

Postby SUPER » 10 Dec 2008

Hi Super,

The above code cannot be run in TS. It can be run in MC. You can see the bug on the MC chart.
"Wow "did not know that powerlangage coding is different from EasyLanguage, just learnt something new.

I ran your latest code on MC and this is what I see on my screen, looks like its showing desired results. I am using MC v 5 Beta 2

Regards
Super
Attachments
ppan.jpg
(91.43 KiB) Downloaded 638 times

ppan
Posts: 106
Joined: 31 Jan 2007
Has thanked: 2 times

Postby ppan » 11 Dec 2008

You should turn on the Position Limits:
Signal -> Properties -> Select the "Allow up to 10 entry orders" and Select the "regardless of the entry that generated the order"

Then you can see there are 2 "S5" sell orders.

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

Postby SUPER » 11 Dec 2008

ppan,

I now can see what you are experincing.

Try out your code with IntrabarOrderGeneration=true and see what you make of it.

Regards

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

Postby Marina Pashkova » 18 Dec 2008

Hi guys,

It has been confirmed that exits, using the 'total' keyword, do not work correctly in MultiCharts. The bug will be fixed in the next MC version.

Regards.

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

Postby Andrew Kirillov » 16 Mar 2009

The bug has been fixed in Beta 3.


Return to “MultiCharts”