Login Page - Create Account

Support Board


Date/Time: Wed, 27 Nov 2024 10:36:17 +0000



Post From: ASCIL Different OrderIDs for Same Order

[2023-08-21 13:34:13]
User431178 - Posts: 544
If the logic is correct and the setting of the ShortOrderId can only happen when a new sell order has been sent, how can the ShortOrderId change in the same bar of the original sell order.

It's not changing, on the next call into the study function you are reading the value of an uninitialized variable.
This is undefined behavior and the value could essentially be anything.

If you want the values to be available between function calls, then you need to use persistent variables.
Persistent Variable Functions

Ultimately, the intent of capturing the LongOrderId and ShortOrderId is to track the elapsed time of the order and if at some threshold and not filled to cancel.
See link above.

For further information about the scope / lifetime of variables, please see - https://en.cppreference.com/w/cpp/language/scope
Date Time Of Last Edit: 2023-08-21 13:37:37