The sole purpose of the strategy is getting me in the market as soon as possible when certain conditions are met, and from there on I want to be able to manage my order the way I want. Then when I exit the market I want the strategy to be 'back on track' and keep monitoring the market for additional entries.
The issue I experience is the following:
- When I exit the market (manually), the strategy position remains unchanged.
ex. Long condition was met, I entered the market long, then went out of it manually. Account Position: Flat, Strategy Position: Long
I tried manually setting Strategy's position to flat through the code, but still Unrealized PnL is being calculated and when a signal for the opposite direction is received then the strategy gets 'Flat', because there were lots remaining.
Other thing I've tried was - keeping my 'Order' referrence in a variable
[...] if(PositionAccount.MarketPosition == MarketPosition.Flat && PositionAccount.MarketPosition != Position.MarketPosition) { Position.MarketPosition = MarketPosition.Flat; CancelOrder(latestOrder); }
What method should I go for to accomplish the desired result?
Should I stick with Managed Order Execution or maybe I should go for Unmanaged?
Or perhaps I should consider exploring ATM Strategy methods and rework my logic using them?
Best regards, Martin.
Comment