I have a strategy that is currently in a position. I turn off the strategy automation and then turn it back on to assign the initial market position. I input the position details and then MC shows that I'm in the correct position in the order and position tracker window. But then the strategy sends another order to enter the position again, doubling the position.
I think there's an issue with how MC is matching the assigned initial position to the correct Marketposition_at_Broker_for_the_Strategy.
My code is very very simple, since I'm just testing this out...
if Marketposition_at_Broker_for_the_Strategy = 0 then begin
buy ("B1") next bar at highest(high,20) stop;
sellshort ("S1") next bar at lowest(low,20) stop;
end;
I wanted to see what the MC team comes up with before adding this to the project management page. Thanks in advance
Issue with position sync and assigning initial position
- Stan Bokov
- Posts: 963
- Joined: 18 Dec 2009
- Has thanked: 367 times
- Been thanked: 302 times
Re: Issue with position sync and assigning initial position
Marketposition_at_Broker_for_the_Strategy checks what the MP is for all orders sent by this strategy. Since when you turn it on there are no orders sent by the strategy, the condition of Marketposition_at_Broker_for_the_Strategy = 0 is met.
You should use the MarketPosition_at_Broker keyword.
You should use the MarketPosition_at_Broker keyword.
Re: Issue with position sync and assigning initial position
thanks stan. the thing with using marketposition_at_broker is that i have multiple strategies trading the same contract and need the strategy to account for only its position and not positions triggered by the other strategies.
any suggestions on how to go about this? everything works fine until i turn strategy automation off and on and try to sync the positions. luckily, this doesn't happen too often but it is still definitely a very important aspect to handling automated trading.
any suggestions on how to go about this? everything works fine until i turn strategy automation off and on and try to sync the positions. luckily, this doesn't happen too often but it is still definitely a very important aspect to handling automated trading.
- Stan Bokov
- Posts: 963
- Joined: 18 Dec 2009
- Has thanked: 367 times
- Been thanked: 302 times