1. When we use EnterLong, at that time if we have short position then strategy closing short position first and then going long or vise versa (something like reverse position except order's quantity may different).
Can i do same thing with limit orders? I think when we use EnterLongLimit and if we have short position at that time, strategy don't touch current position and manage new order recording to it's order management properties.
2. Related to my first question... I have a strategy using EnterLongLimit/EnterShortLimit orders for go long/short and using ExitLongStopMarket/ExitShortStopMarket for stop loss orders. My stop loss orders working like traling stop and when hit stop loss level, i want to reverse my position in the same bar. For test a strategy i'm using market replay, when i put my strategy on a chart and enable it. I see on historical bars working correctly. After start market replay i see after stop loss hit, my entry limit orders don't send to market.
My strategy working OnBarClose, i try to change order handling properties all entries/unique entries etc. bar can not solve my problem. Any idea about it?
UPDATE : I put some print lines to my code and these are from output window exactly same order and all of them printing at the same bar's close;
* LONG => SHORT (This print from OnBarUpdate method and meaning that we have long position and short conditions met, after that line EnterShortLimit method calling)
* An Enter() method to submit an entry order at '24.01.2017 11:20:16' has been ignored. Please search on the term 'Internal Order Handling Rules' in the Help Guide for detailed explanation.
* STOPLOSS EXECUTED (This from OnExecutionUpdate method and meaning executed my stopLossOrder for long position and so now we are flat. After that next OnBarUpdate will call this bar close but this time short conditions can not be met and so short position run away!)
Thanks,
Aytac
Comment