Mass close. Closes all orders passed in parameter(s)
Parameters: orders - orders to close Throws: JFException - if orders not in IOrder.State.FILLED state.
IEngine.closeOrders (....) for using mass closure of orders.. problem is if you have at runtime a dynamic number of parameters you have to pass to this function. MISSING EXAMPLES ON JFOREXBOARDS HOW to do it? amount of orders can varify at runtime so how to call this function correctly??
cheers,,
API Support
Post subject: Re: Mass close. Closes all orders passed in parameter(s);dynamic
Post subject: Re: Mass close. Closes all orders passed in parameter(s);dyn
Post rating: 0
Posted: Fri 10 Jul, 2009, 11:23
User rating: 3
Joined: Wed 18 May, 2011, 16:25 Posts: 331 Location: SwitzerlandSwitzerland
2 questions regarding closeOrders:
a) can the function be directly called outside onTick (without opening a new thread/Future)?
b) the function is throwing a JFException when an order is not in IOrder.State.FILLED. What happens if an order in the passed order list is not in state IOrder.State.FILLED? Does closeOrders throw the error immediately, stopping the processing of further elements in the orderlist, or will all elements in the list get processed before the error is thrown at the end of the order loop?
Thanks, RR.
API Support
Post subject: Re: Mass close. Closes all orders passed in parameter(s);dynamic
a) no it cannot be called from outside of strategy thread, you should use IContext.executeTask in this cases b) it checks that all passed orders have FILLED state, if one of the order has some other state it throws JFException and no requests are sent to server. You should check yourself that orders are in FILLED state