Page 1 of 1

Auto trading in replay - positions don't reverse

Posted: Sep 07 2024
by MCuser123
I'm observing a peculiar behavior when I run replay with my strategies. When a long signal is followed by a short signal, the short signal acts as a stop and just closes the long position, instead of reversing and opening a short position. Should be as simple as sell short contract count x 2, rather than x 1. The same thing with short followed by a long. The strategies just never reverse, there is always a flat period between entries. This makes replay unusable for strategies that don't rely on stops and are always in the market. Is there a setting controlling that, which I'm not aware of? Or is this a bug?

Re: Auto trading in replay - positions don't reverse

Posted: Sep 08 2024
by TJ
This is a coding issue.
Please post your codes.

Re: Auto trading in replay - positions don't reverse

Posted: Sep 08 2024
by MCuser123

Code: Select all

if BuyCondition then begin buy("LE") this bar on close; end else if SellshortCondition then begin sellshort("SE") this bar on close; end else if SellCondition then begin sell("LX") this bar on close; end else if BuytocoverCondition then begin buytocover("SX") this bar on close; end;
I'm trading futures. Sellshort I expect to reverse a long position. It does work in real trading as expected by sending a 2 x position size sell order.

Re: Auto trading in replay - positions don't reverse

Posted: Sep 08 2024
by PeterSt
Should be as simple as sell short contract count x 2, rather than x 1.
It is as simple as Sell Short Contract count x 1. This will immediately Reverse.
I think it may depend on the Broker - with IBKR this is so. Without Broker, default MC behaves the same (not even sure this is settable).

Re: Auto trading in replay - positions don't reverse

Posted: Sep 12 2024
by MCuser123
Weirdly, this behavior depends on the option "Preferences >> Trading >> Simulated Trading >> Start Simulated Trading Automatically". At least after I turn it off, positions start to reverse as expected. Not sure if this particular option matters, or just a change in setting that triggers some cache flush or whatever. Not sure if anyone from MC support is watching these threads, as I couldn't figure out how to submit a bug request to their Project Management portal.

Re: Auto trading in replay - positions don't reverse

Posted: Sep 13 2024
by Polly MultiCharts
Dear Users,

If you’d like us to check the issue in detail, please send us the following files to our support email so that we would be able to investigate the issue:
  1. The workspace where the issue is reproduced.
  2. Export of used symbols (with data) from QuoteManager in .qmd archive.
  3. The exported scripts with all dependent functions that are used on the workspace.
  4. The screenshots demonstrating the issue.
  5. Step-by-step instruction on how to reproduce the issue and the time when Simulated Trading is started from.