Implementing FIX Protocol-based orders with support for Stop Loss and Take Profit
I spent a substantial amount of time looking for examples or descriptions of how to implement order execution methodology that will support stop losses and take profits through FIX Protocol.
I assume that I will have to generate three orders, the main one, the SL one and the TP on开发者_StackOverflow社区e. I also assume that I will have to issue the SL and TP orders after the main order has been filled. I am not sure about the order types I should use for SL and TP, and about the general execution methodology.
I'd appreciate constructive comments and directions.
Regards,
Not really a programming question (most programmers wont even know what you talk of.
Stop loss order type is generally - STOP EXIT or whatever it is named in Fix. Profit Target will be either a MARKET IF TOUCHED order or - more normal - a LIMIT order.
Entering the SL / PT after entry is normal, though you may be able to put in the STOP LOSS at a similar time (as it can only get executed when the order is entered). The tricky thing is closing the orders without having something left over in case of trailing stops - because in fast markets you may get an exit order + the stop filled before the cancels hit.
You may find that both the SL and TP orders can be implemented as "stop" orders. In FIX this is "40=3"; in QuickFIX you'd say orderMsg.set(OrdType(OrdType_STOP))
.
Beyond that, I'm not sure if what you are asking here is programming-related, really--it's more or less a question about trading and execution.
Which language are you using for the Quickfix ? Java or C++. Both the language libraries have sample applications. C++ has an executor and order matcher and trader client. You can use them as a starting point and modify them to your stop loss orders. Java has an executor and a trading client(banzai). You can try them out and add your code to test for the specific orders you want to create.
精彩评论