Login Page - Create Account

Support Board


Date/Time: Sun, 24 Nov 2024 13:33:36 +0000



[Programming Help] - 'SendOrdersToTradeService' is not consistent with 'Trade Simulation Mode On'

View Count: 711

[2023-03-15 19:54:28]
tecman240 - Posts: 16
I have a custom study that send buy/sell stop entry orders when enabled by a control button.
Sometimes it works but sometimes I get this error in the Trade Log:
MESM23_FUT_CME[M] Rev. 6t #2 | SendOrdersToTradeService is not consistent with 'Trade >> Trade Simulation Mode On' setting. Order action ignored. | 2023-03-15 13:59:08.002

Each time this has happened, I've checked the following and everything seems to be right for sending orders to Teton:
Trade >> Trade Simulation Mode (Unchecked)
Chart Trade Window is displaying my account number, not "Sim1".
Trade >>Auto trading enabled Global (Checked)
and on the chart: Trade >> Auto trading enabled Chart (Checked)

Sometimes (but not always) I can real orders to be submitted by toggling Trade>>Trade Simulation Mode from 'Unchecked' to 'Checked', then back to 'Unchecked'.
My study has SendOrdersToTradeService=true in SetDefaults, and does not use an input to control this variable.

thanks.
[2023-03-22 14:01:24]
tecman240 - Posts: 16
Please respond,
thank you.
[2023-03-22 17:59:34]
ondafringe - Posts: 284
My study has SendOrdersToTradeService=true in SetDefaults, and does not use an input to control this variable.

But are you trying to manipulate the value of "SendOrdersToTradeService" by some other means, anywhere else in your code?
[2023-03-22 18:05:36]
tecman240 - Posts: 16
No, not in code.
The only thing I'm doing is manually checking & unchecking "Trade>>Trade Simulation Mode On" to alternate between real and simulated trading.
[2023-03-22 18:09:38]
ondafringe - Posts: 284
You can't just change "Trade Simulation Mode On" without also changing "SendOrdersToTradeService" to a matching value.
[2023-03-22 18:15:59]
tecman240 - Posts: 16
oh ok, I thought the "Trade Simulation Mode" over rode the code setting.
Is there a way that for the code to read the current "Trade Simulation Mode" setting so the code matches it's current state? That way I can change from sim to real orders without having to set a study input each time.

thanks.
[2023-03-22 18:25:11]
ondafringe - Posts: 284
I haven't done this myself, but you *should* be able to check SIM mode by checking the value of "sc.GlobalTradeSimulationIsOn," and depending on that value, you could then set the value of "SendOrdersToTradeService" to match.

And when I say *match," I don't mean they both have to be true or both have to be false. I mean they both have to indicate the same thing -- either SIM or non-SIM. It may be counterintuitive, but to indicate the same thing, they actually have to be set to opposite values. So if SIM is true, the other has to be set to false and vice versa.
Date Time Of Last Edit: 2023-03-23 17:32:58
[2024-05-26 22:13:41]
kam2001 - Posts: 79
This helped me => sc.SendOrdersToTradeService = !sc.GlobalTradeSimulationIsOn;

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account