Order Submitted, Cancelled, Submitted, Cancelled...

Questions about MultiCharts and user contributed studies.
User avatar
t-rader
Posts: 139
Joined: 02 Feb 2011
Location: Australia
Has thanked: 11 times
Been thanked: 27 times

Order Submitted, Cancelled, Submitted, Cancelled...

Postby t-rader » 27 Mar 2013

Hi All,

I trade with MB Trading (MBT) and I turned on their email alerts so they will email me when an order is submitted, executed, cancelled, rejected and changed.

Now when my exit order got triggered I received the following email alerts from MBT:

email 1 - 10:04:23 - order submitted
email 2 - 10:04:28 - order cancelled
email 3 - 10:04:29 - order submitted
email 4 - 10:04:31 - order cancelled
email 5 - 10:04:32 - order submitted
email 6 - 10:04:33 - order executed

So for some reason my order was submitted and cancelled twice before actually being executed. Is there something wrong with my code or is something happening at the brokers end?

Here is my exit code:

Code: Select all

if marketposition = 1 then begin

If close >= (entryprice + Profit points) then begin
Sell ("profit") next bar at market ;
end;

If close <= (entryprice - loss points) then begin
Sell ("Stop Loss") next bar at market ;
end;

end;

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: Order Submitted, Cancelled, Submitted, Cancelled...

Postby Henry MultiСharts » 27 Mar 2013

Hello t-rader,

Are conditions for sending the order met on each calculation of the study?
Please use the Print statement before and after the IF statement to debug your code. That will help you to see whether conditions were met or not.
An article you may find useful: Why an Order Was or Was Not Executed

User avatar
t-rader
Posts: 139
Joined: 02 Feb 2011
Location: Australia
Has thanked: 11 times
Been thanked: 27 times

Re: Order Submitted, Cancelled, Submitted, Cancelled...

Postby t-rader » 03 Apr 2013

Hi Henry,

I've got no errors on the Logs tab of Order and Position Tracker (it just says order cancelled) so does that mean the order was not rejected by Multicharts or my broker and that there is something wrong with my code?

The code I'm using is exactly what I put in my first post.

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: Order Submitted, Cancelled, Submitted, Cancelled...

Postby Henry MultiСharts » 03 Apr 2013

so does that mean the order was not rejected by Multicharts or my broker and that there is something wrong with my code?
Most probably yes.
Please use the suggestions from my previous post to debug your code.

If your code works ok and the conditions in the code are always met but the order is still cancelled we will need to analyze the logs from your PC.
Please send me the following:
1) MultiCharts logs (if you have not restarted the platform. Logs from the previous run are erased when you start MC).
2) In MultiCharts go to File->New->Open Order and position tracker window-> Orders tab->make sure you are not filtering the information in columns, then go to File->Export to excel.
Please also export the information from the Logs tab and send it to me for analysis.
3) Create a screenshot of Format->Strategy properties->Auto trading tab.
4) Please attach a detailed problem description and highlight the problem orders on the screenshots.

User avatar
t-rader
Posts: 139
Joined: 02 Feb 2011
Location: Australia
Has thanked: 11 times
Been thanked: 27 times

Re: Order Submitted, Cancelled, Submitted, Cancelled...

Postby t-rader » 04 Apr 2013

Thanks Henry I will look to add some more prints to my code.

Do you think though it could be caused by the option 'Cancel market orders as obsolete if not filled within' as I have this set to 2 seconds and what I noticed is the cancelled orders were all 2 seconds or longer, where as the executed orders were all within 1 second... If this was the cause would this be reported under the logs tab of the order and position tracker?

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: Order Submitted, Cancelled, Submitted, Cancelled...

Postby Henry MultiСharts » 04 Apr 2013

Do you think though it could be caused by the option 'Cancel market orders as obsolete if not filled within'
That is possible. You can try disabling the option to see if that is the source of this behavior.
If this was the cause would this be reported under the logs tab of the order and position tracker?
Orders cancelled by this option are not logged in OPT logs.


Return to “MultiCharts”