Auto trading in replay - positions don't reverse
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?
- TJ
- Posts: 7775
- Joined: Aug 29 2006
- Location: Global Citizen
- Has thanked: 1036 times
- Been thanked: 2233 times
This is a coding issue.
Please post your codes.
Please post your codes.
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;
It is as simple as Sell Short Contract count x 1. This will immediately Reverse.Should be as simple as sell short contract count x 2, rather than x 1.
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).
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.
- Polly MultiCharts
- Posts: 282
- Joined: Jul 20 2022
- Has thanked: 2 times
- Been thanked: 68 times
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:
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:
- The workspace where the issue is reproduced.
- Export of used symbols (with data) from QuoteManager in .qmd archive.
- The exported scripts with all dependent functions that are used on the workspace.
- The screenshots demonstrating the issue.
- Step-by-step instruction on how to reproduce the issue and the time when Simulated Trading is started from.