Login Page - Create Account

Support Board


Date/Time: Wed, 08 May 2024 13:45:22 +0000



[Programming Help] - Next order id

View Count: 1431

[2018-03-11 18:13:23]
User79074 - Posts: 105
Is there a way to get the next order id before making an order?

For example when starting Sierra Chart I have my orders and positions all cleared. Say the next order I make will be 1029. Is there are way to know that will be the next order so I don't have to start looping from 0?
[2018-03-11 21:05:35]
Sierra Chart Engineering - Posts: 104368
You should instead be using this function:
Automated Trading From an Advanced Custom Study: sc.GetOrderByIndex
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
[2018-03-12 06:29:11]
User79074 - Posts: 105
Problem with GetOrderByIndex is it will return orders only for the current instrument. I would like to be able to access orders not depending on the instrument

Also, GetOrderByIndex will not be able to tell me what the next order number will be if all the positions have been cleared.
Date Time Of Last Edit: 2018-03-12 06:30:02
[2018-03-12 18:49:50]
Sierra Chart Engineering - Posts: 104368
I would like to be able to access orders not depending on the instrument
We will add this capability.


Also, GetOrderByIndex will not be able to tell me what the next order number will be if all the positions have been cleared.
Why do you need to know? There should not be a reliance on this.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
[2018-03-13 19:57:28]
User79074 - Posts: 105
Can you make a function that will return the next order ID that will be used?
[2018-03-13 23:55:16]
Sierra Chart Engineering - Posts: 104368
No. That is not something we would do.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
[2018-03-14 05:48:47]
User79074 - Posts: 105
Could you explain why you would not do that?
[2018-03-14 20:20:32]
Sierra Chart Engineering - Posts: 104368
In the latest version we added this function for you to obtain orders for any symbol and Trade Account:

GetOrderForSymbolAndAccountByIndex)(const char* Symbol, const char* TradeAccount, int OrderIndex, s_SCTradeOrder& ACSOrderDetails);

The Symbol and TradeAccount need to be set to "" in this case.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
Date Time Of Last Edit: 2018-03-14 20:20:47
[2018-03-15 07:02:11]
User79074 - Posts: 105
OK, so here's a situation

1. In NON Simulation placed orders 1, 2
2. In Simulation placed orders 3, 4
3. In NON Simulation placed orders 5, 6

Now I clear Trade Simulation Orders & Data, which will effectively clear orders 3, 4 since they were placed in Simulation mode

Will GetOrderForSymbolAndAccountByIndex return at

Index 0: Order 1
Index 1: Order 2
Index 2: Order 5
Index 3: Order 6

??
[2018-03-15 08:08:14]
Sierra Chart Engineering - Posts: 104368
In general the answer is yes. Sorting can affect the particular ordering, but certainly those would be the returned orders.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
[2018-03-16 13:02:09]
User79074 - Posts: 105
Is it possible for gaps to exist, for example

Index 0: Order 1
Index 1: NO ORDER
Index 2: Order 3
Index 3: Order 4
[2018-03-16 18:57:05]
Sierra Chart Engineering - Posts: 104368
No. Never.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
[2018-03-17 12:24:27]
User79074 - Posts: 105
Thank you.

Is it possible to know the last index, so to know the last order that was made? Is there perhaps a size function for this array?
[2018-03-17 21:51:52]
Sierra Chart Engineering - Posts: 104368
There is no need for that. Just continue to call the function with an incrementing Index until it returns an error. This is the most efficient way.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
[2018-03-19 13:07:20]
User79074 - Posts: 105
Yes, but if there if the array is empty, there is no way of telling what the last order id number was.
[2019-05-17 12:05:52]
TedMar - Posts: 189
Yes, but if there if the array is empty, there is no way of telling what the last order id number was.

im looking for answer this problem too.

i hope SC hope to find resolution and maybe write down an example.
[2019-05-22 14:17:20]
Sierra Chart Engineering - Posts: 104368
Last order ID of what?
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing

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

Login

Login Page - Create Account