Order cancel and replace
Author: jkwong
Creation Date: 8/11/2009 12:04 PM
profile picture

jkwong

#1
Hello, I just upgraded from WL5.3 to WL5.4 and the order cancel & replace feature is still not working. Here is the screen dump from my LIVE trading account.

Date/Time status Symbol Action Type QTY Order Price Filled
#1 8/11/2009 9:49am filled MSCC Short Market 1000 1000
#2 8/11/2009 9:50am Active MSCC Cover Stop 1000 14.37
#3 8/11/2009 9:53am error MSCC Cover Stop 1000 14.31

exec #1 status change from staged to filled. That is working.
exec #2 status change from staged to active. That is working.
exec #3 status change from staged to error with error msg "0: Error(s): The security specified in your order was not found in the account selected. This could be caused by selecting the wrong account where the security is held short. Buy To Cover orders are only for covering short positions."

here is the code:

if <<condition>>
{
CoverAtStop( bar + 1, p, StopPrice, "CoverStop" );
}
else
{
CoverAtMarket( bar + 1, p, "CoverMarket" );
}

Thank you in advance.



profile picture

Eugene

#2
FYI: the WealthScript Programming Guide will tell how to correct your code; please see Programming Trading Strategies > Peeking > Order of Trading Signals.
profile picture

Cone

#3
For sure you should correct the code for backtesting as Eugene suggests, but something else is wrong that caused the error. Please create a Support Ticket, make a copy of your Orders screen (right click copy and paste to a text doc), and attach it to the ticket please.
profile picture

jkwong

#4
Eugene, is cancel & replace only apply to auto trade? These orders were generated by my strategy and I select and exec order manually thought order mgr.
Question, from my strategy how can I issue OCO (one cancel other) order (ie stop and limit order for the same instrument). Thanks.

profile picture

Cone

#5
QUOTE:
cancel & replace only apply to auto trade?
No, it should work when clicking "Place" manually provided the order was generated by the Strategy.

QUOTE:
how can I issue OCO (one cancel other) order
I assume you're asking about how to do it manually. See User Guide: Orders > Manual Trade Ticket > Bracket Order, Manual Placement


profile picture

jkwong

#6
Cone, these orders were generated by the strategy and staged in the order mgr screen. I just click place manually and error occur during cancel & replace as I mention early.
profile picture

Cone

#7
Okay. In V5, if you're manually placing orders, you must either:
1) cancel the previous order before placing a new order, or,
2) right click the order and use the Cancel & Replace option. See the User Guide for details.