SmartQuant Discussion

Automated Quantitative Strategy Development, SmartQuant Product Discussion and Technical Support Forums
It is currently Tue May 21, 2019 5:36 am

All times are UTC + 3 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Wed Mar 13, 2013 11:22 am 
Offline

Joined: Thu Dec 29, 2011 5:59 am
Posts: 87
I have been running a strategy as follows for a while now:
    a. Send a limit order (long or short)
    b. If the limit order is not filled within a time amount, then cancel the limit order.
    c. If the limit order is filled and the position is opened. No more new limit order. The position would be
    close as soon as it was first opened. The position closing price is highly depends on ticker trade price.
    d.Once the position is closed. Strategy able to send out limit order again

Logicwise the strategy is running fine. However, the ticker update is slightly delay to reach my strategy as exchange send out the ticker to my broker server and the broker server in return send it to OQ. This delay can cause quite a few slippage as this strategy is fairly high frequent.

Now my broker offer me a new order type it’s called bull/bear order type that can cut down the ticker delay issues. It work like this

    a. Send a limit order with a stop loss and stop gain price as well. (It’s similar to OCA). I can code this stop loss/gain no problem on my userprovider.The stop loss/gain price are set in the order send method.

    b. If bull/bear order is not filled within a certain time amount, the strategy can cancel this order.

    c. The stop loss/gain would be executed by the broker server and trade reports would be send to userProvider on callback.
Doing this can cut down the slippage as both the gain/loss orders are rest on the broker server. If either the gain/loss is executed by the broker, it would cancel the other order as well. My question is how can I handle those trade reports for either the gain/loss orders which wasn’t created by OQ strategy in the first place. The strategy only knows the position was opened when the limit order was filled. Once this gain/loss order executed, the position is closed on the broker server. The userprovider would be able to receive the callback for the gain/loss order trade report, can I create those gain/loss order in the userprovider once it receive the trade report ? and the strategy would be able to match it with the limit order so that the position would be closed and recognized by the strategy ?

Let me know your insights/comments. Thanks


Top
 Profile  
 
PostPosted: Wed Mar 13, 2013 12:17 pm 
Offline

Joined: Tue Aug 05, 2003 3:43 pm
Posts: 6812
Hi,

I think you can create and send stop loss and take profit orders in your strategy right before you send limit order. You can mark stop loss and take profit orders somehow (for example add "bullbear stoploss", "bullbear takeprofit" to order text field). Then you can identify and store these orders in your user provider. Accept these orders but don't send them to the broker. Then emit execution report for corresponding order when you get execution callback from the broker. Group these orders in one OCA group in your strategy and I think this idea is going to work in the simulation mode as well.

Regards,
Anton


Top
 Profile  
 
PostPosted: Wed Mar 13, 2013 12:34 pm 
Offline

Joined: Thu Dec 29, 2011 5:59 am
Posts: 87
Sounds good. Thanks for suggestion.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC + 3 hours


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group