Is there anyone who got ChangeMarketPostion running ?
Posted: Jul 20 2024
The command you see is the command which makes the Strategy Position and Average Price equal to the Position and Average price at the Broker. Well, that is the intention of it. But I can't get it to work.
And I can't use this either : - knowing that people will tell me to use that.
The problem I am facing is that I work in AA (Asynchronous) mode with tick data, and that there does not seem to be a moment I can catch the not being equal (Broker vs Strategy) to be in order. I feel that this is related to this : - the second section you see in there. This, with the notice that in older versions of MC the option existed to not do anything at all, but today (15, 15 R2) we always have to let the general/internal MC code be ahead of things - which is earlier than my program code is in order (say that I tried in Create, StartCalc and CalcBar).
Please notice that the option "Always show dialog window" also does not bring the desired result in any of its variations, as only the Broker Position is obtained and not the Average Price. Hence, the CurrentOpenProfit starts out with 0 always, while in reality it could be -1000. The effect ? when the code is restarted and reaches the set TP of e.g. 50, it goes out at a loss of -950.
With all I tried (which must be over 100 times on Live), I can not get this Synchronization to run as it should. Thus also not with the standard Signal for it (as shown in the 2nd attachment).
Keywords seem to be : AA Mode, Code calls at the Tick level, Not IOG mode (while the standard Indicator uses that) and perhaps the impossibility to Sync at the tick level because all will choke.
On the latter : I only need to synchronize once. And not at each bar and most certainly not on each tick. Theoretically I need to do this before any other line of code is executed, but there just seems to be no way. A way which starts with If BrokerPosition != StrategyPosition (pseudo code).
I have turned every stone, but the "Sync" tag you see given in the first attachment, just never shows up (in very rare occasions the standard similar tag in the standard Indicator, may - but this seems a coincidence, plus it would be in the situation that the indicator is called each tick, which is not possibly in practice).
Anyone, please ?
Or questions ?