Buy at open/Sell at open bug

Questions about MultiCharts and user contributed studies.
User avatar
MAtricks
Posts: 789
Joined: 09 Apr 2012
Has thanked: 286 times
Been thanked: 288 times

Buy at open/Sell at open bug

Postby MAtricks » 03 Feb 2013

This is with the recent MC 8.5 Beta 2. IOG ON. Please fix this...

Image
Attachments
Open_Orders.png
(34.88 KiB) Downloaded 3042 times
Last edited by MAtricks on 04 Feb 2013, edited 1 time in total.

sptrader
Posts: 742
Joined: 09 Apr 2010
Location: Texas
Has thanked: 483 times
Been thanked: 274 times
Contact:

Re: Buy at open/Sell at open bug

Postby sptrader » 03 Feb 2013

I tried your code on ES 15 min bars and it seems to work correctly..
What instrument and time frame are you using ?
Attachments
Sigs on open.png
(42.09 KiB) Downloaded 896 times

User avatar
MAtricks
Posts: 789
Joined: 09 Apr 2012
Has thanked: 286 times
Been thanked: 288 times

Re: Buy at open/Sell at open bug

Postby MAtricks » 03 Feb 2013

that was 5 minute bars.. weird that it worked for you. Intra-bar Orders ON?

sptrader
Posts: 742
Joined: 09 Apr 2010
Location: Texas
Has thanked: 483 times
Been thanked: 274 times
Contact:

Re: Buy at open/Sell at open bug

Postby sptrader » 03 Feb 2013

that was 5 minute bars.. weird that it worked for you. Intra-bar Orders ON?
***************************************************************
I was using 15 minute ES bars. I tried it with and without IOG , it works the same either way..

User avatar
MAtricks
Posts: 789
Joined: 09 Apr 2012
Has thanked: 286 times
Been thanked: 288 times

Re: Buy at open/Sell at open bug

Postby MAtricks » 04 Feb 2013

not sure what to tell ya. That screen shot isn't photoshopped.

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

Re: Buy at open/Sell at open bug

Postby TJ » 04 Feb 2013

not sure what to tell ya. That screen shot isn't photoshopped.
Maybe your codes need a review?

User avatar
MAtricks
Posts: 789
Joined: 09 Apr 2012
Has thanked: 286 times
Been thanked: 288 times

Re: Buy at open/Sell at open bug

Postby MAtricks » 04 Feb 2013

Sure, review it. The execution is:

Buy next bar open ;
Sellshort next bar open ;

Which SHOULD execute at the open of the next bar.
Last edited by MAtricks on 04 Feb 2013, edited 2 times in total.

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

Re: Buy at open/Sell at open bug

Postby TJ » 04 Feb 2013

Sure, review it. The execution is:

Buy next bar at open stop ;
sellshort next bar at open stop ;
that's different from what you had in the 1st post.

User avatar
MAtricks
Posts: 789
Joined: 09 Apr 2012
Has thanked: 286 times
Been thanked: 288 times

Re: Buy at open/Sell at open bug

Postby MAtricks » 04 Feb 2013

Sure, review it. The execution is:

Buy next bar at open stop ;
sellshort next bar at open stop ;
that's different from what you had in the 1st post.

Sorry for not checking the lines of code to make absolutely sure how I coded it.. The original post is correct.

Regardless, the flaw stands. Buying at the low and selling at the high isn't what "buy next bar market" Or "buy next bar market ; "should do.
Last edited by MAtricks on 04 Feb 2013, edited 1 time in total.

User avatar
MAtricks
Posts: 789
Joined: 09 Apr 2012
Has thanked: 286 times
Been thanked: 288 times

Re: Buy at open/Sell at open bug

Postby MAtricks » 04 Feb 2013

60 Minute bars:

Image
Attachments
2013-02-03_2259.png
(77.98 KiB) Downloaded 1057 times

User avatar
MAtricks
Posts: 789
Joined: 09 Apr 2012
Has thanked: 286 times
Been thanked: 288 times

Re: Buy at open/Sell at open bug

Postby MAtricks » 04 Feb 2013

I believe I've narrowed down the problem a bit more. Looking over my code I see a simple variable that's making this happen. It was in my "begin" statement. Try adding this to a test strategy and see what you come up with: (IOG doesn't matter)

If C < C[1] then sellshort next bar open ;
If C > C[1] then buy next bar open ;

Image
Attachments
2013-02-03_2326.png
(143.62 KiB) Downloaded 1035 times

User avatar
Dave Masalov
Posts: 1712
Joined: 16 Apr 2010
Has thanked: 51 times
Been thanked: 489 times

Re: Buy at open/Sell at open bug

Postby Dave Masalov » 04 Feb 2013

Hello MAtricks,

Please come to our Live Chat Mon-Fri from 6:30 AM to 10 AM EST to demonstrate the issue: http://messenger.providesupport.com/mes ... pport.html

User avatar
MAtricks
Posts: 789
Joined: 09 Apr 2012
Has thanked: 286 times
Been thanked: 288 times

Re: Buy at open/Sell at open bug

Postby MAtricks » 04 Feb 2013

Thanks Dave. Tomorrow morning I'll pop in there.

User avatar
MAtricks
Posts: 789
Joined: 09 Apr 2012
Has thanked: 286 times
Been thanked: 288 times

Re: Buy at open/Sell at open bug

Postby MAtricks » 06 Feb 2013

I keep making it to the chat room too late. Dave has anyone looked at this?

I'm not really sure what more you all would need when I provide this:

Image

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

Re: Buy at open/Sell at open bug

Postby SUPER » 07 Feb 2013

MAtricks,

I spent some time with the Live Chat and my understanding is that for it to work correctly you have to use Barstatus=2 in your code:

if BarStatus=2 then begin
if C < C[1] then buy next bar open;
if C > C[1] then sellshort next bar open;
end;

or

Use barmagnifier

User avatar
MAtricks
Posts: 789
Joined: 09 Apr 2012
Has thanked: 286 times
Been thanked: 288 times

Re: Buy at open/Sell at open bug

Postby MAtricks » 07 Feb 2013

Thanks Super.

I'm unsure where the complication is on this line of code that would require a barstatus = 2.

If C > C[1] then buy next bar open ;
or in english:
if the close is more than the last close, place a buy order at the open of the next bar.

If C < C[1] then sellshort next bar open ;
or in english:
if the close is less than the last close, place a sell order at the open of the next bar.


This doesn't make sense that a barstatus = 2 statement is needed, but I'll give it a shot if that's their workaround.

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

Re: Buy at open/Sell at open bug

Postby SUPER » 08 Feb 2013

Thanks Super.

I'm unsure where the complication is on this line of code that would require a barstatus = 2.

If C > C[1] then buy next bar open ;
or in english:
if the close is more than the last close, place a buy order at the open of the next bar.

If C < C[1] then sellshort next bar open ;
or in english:
if the close is less than the last close, place a sell order at the open of the next bar.


This doesn't make sense that a barstatus = 2 statement is needed, but I'll give it a shot if that's their workaround.
With IOG on arrival of each new tick "C" will change, so on live trade your order will get filled as soon as the condition is meet. But on historical orders the code runs four times on each bar comparing Open - High -Low - Close to establish if condition is meet, these are the only reference points it has for comparision if you have not selected bar magnifier.

For testing on Historical orders "Barmagnifier" is must.


Return to “MultiCharts”