Post subject: Management of Partial Take Profit fills
Post rating: 0
Posted: Sun 11 Nov, 2012, 19:27
User rating: 0
Joined: Sun 11 Nov, 2012, 19:10 Posts: 1
Hello everyone.
I have a trading system which mainly uses Limit Orders and Take Profits as order types.
I want to handle this particular scenario:
1) Limit Order is posted for amount X, with Take Profit. 2) Price hits limit and order fills for full amount X. 3) Price hits Take Profit and order partially closes for amount Y < X, so position is now X - Y. 3) At this point, if price hits again the limit price, I want my position to go back to full X, i.e. I want to post a new limit order for Y or add Y to the current order so that this happens.
Now the question is, how can I detect that a partial take profit has happened and thus the order has been partially closed ? I'm quite sure it can be done using the onMessage callback, but ATM all my code is running into the onBar section, so it would be great if I could do everything using the getAmount()/getRequestedAmount() functions. Unfortunately this is not something I can test in the historical tester (AFAIK) because I can't simulate partials there.
Also please note that the X amount is constant and fixed.
Thanks for your attention.
API Support
Post subject: Re: Management of Partial Take Profit fills