Left over orders

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

Left over orders

Postby MAtricks » 05 Feb 2014

Today I woke up to my strategy hitting its profit target which is always good news. However, there was an issue.

my code:
if --- and ---- and ---- and --- and ---- then buy this bar ;
setstoploss( --- ) ;
setprofittarget( --- ) ;

My buy order was 7 contracts. My profit target was filled with 7 contracts. However, my stop-loss order changed to 2 contracts once my profit target was filled. So I had a random 2 contract stop order sitting in the live market.

I turned off SA, and tried to cancel the order. It said "precanceled" but stayed in the market. I closed MC and canceled the order with ease from Rtrader.

Because of trying to stay out of harms way, I restarted MC so I believe my logs are gone?

My questions:
1. What happened? and what's a "saved" order? I've been running this code and similar code for quite some time. This has never happened to me.
2. Why would it use a random 2 contracts order when all I do is 7 contracts?
3. Is there any code that can protect me from sitting stoplosses and profit targets that aren't supposed to be there?

Image
Attachments
2014-02-05_1222.png
(3.55 KiB) Downloaded 348 times

User avatar
Andrew MultiCharts
Posts: 1587
Joined: 11 Oct 2011
Has thanked: 931 times
Been thanked: 559 times

Re: Left over orders

Postby Andrew MultiCharts » 06 Feb 2014

Hello MAtricks,
  1. More information about orders statuses can be found here.
  2. Without logs (that are deleted on restart of the software) we can only guess.
  3. As i mentioned above, without logs i cannot tell you for sure what happened and what can be done to prevent this. if you are auto-trading this symbol in SA mode and only from one chart, you can add logic to compare inner strategy market position in MC and market position at broker; when they are different for a relatively continuous time, it means something went wrong (like an order status is lost for example).
Could you provide me with following files?
  1. Right-click on the chart -> Format Signals... -> Properties -> Auto-Trading -> make a screenshot of this tab.
  2. Export of “Orders” tab (make sure filters are set to show all the trades) from Order and Position Tracker window: https://www.multicharts.com/trading-sof ... a_to_Excel
  3. Export of “Logs” tab from Order and Position Tracker window: https://www.multicharts.com/trading-sof ... a_to_Excel
  4. Complete code of your strategy or a simplified version (i need to see each line where an order is generated).

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

Re: Left over orders

Postby MAtricks » 06 Feb 2014

Andrew, I appreciate your response and apologize for not responding right away. I will get back to you with this info asap.


Return to “MultiCharts”