MicroTrendsLtd / NinjaTrader8

NinjaTrader8 Components Strategies and Trading tools
MIT License
72 stars 17 forks source link

TradeSystemWorkFlow position closing - overfills underfills -and Entry post fill exits #22

Closed MicroTrendsTom closed 3 years ago

MicroTrendsTom commented 3 years ago

Techniques Profit Target Exit Limit close

This will move the limit orders past price to close with OCO on stop loss - This is not in effect as of yet - Limit Exit Caveats So limit exit is better as there is less actions to do - than a "cancel and close" provided the balance was correct in the first place etc - always a pro and con to all Some traders dont understand the " target filled -" when its a close in loss not yet implemented

Cancel and Close Cancel all known working orders not of type market When cancel confirmed -send exit order to close the position The system will send an exit order based on the quantity reported at the time it prepares the submit, so that is where you can get differences and overfills underfills - ie it sends a 4 but its only a 3 by that time it was prepared

not yet implemented Assess if flat or not - raise error if not flat or submit new trade etc if ready Implemented

Post trade entry fill Assuming an order to enter was also in the workflow if the system misses then post trade entry fill is a double check - not yet implemented

Strategy position versus account position. Strategy can be out of sync with underlying account etc.

Exit Orders Submit

1 Exit orders static

logic to fire off the same as the entry order This assumes that the post exit checks worked and nothing slipped in between through the net such as an extr order fill short or long to add or subtract from the expected position Qty.

underfills/over fill handling Add or Substract - in practice this can cause a flurry of sequences that cascade if not done carefully and make matters worse...

OR

2 Exit Order Dynamic

Work off the position quantity - based on the reported so when the entry fill comes in - use that as a trigger to then look at the position qty and submit exits Caveats - the system must be able to adaptively set a different set of qty to the exti bracket - usually it is better to lump this on to stop 1 target 1 -

Can Be Implemented in Derived Strategy

The above can be handles by the derived layers or implementation can be added in the engine to trigger and send the position quantity... the problem is the quantity might not have updated at the time

Post Trade - Post Exit Balance check This would meant locking the new trades for a period to establish the correct balance of position and exits were created -caveats fast market scalping the exits might be filled etc - Not Implemented