Support Board
Date/Time: Sun, 24 Nov 2024 08:19:24 +0000
[Programming Help] - Is there a way to make the Study wait in ACSIL ?
View Count: 249
[2024-06-18 11:01:55] |
User61576 - Posts: 443 |
While sending orders we get error message saying message rate limit exceeded so I want the code to "wait" for 0.5 second and send the order again But if I add "wait" using this code SC gets unresponsive sc.UpdateAlways is True and sc.AutoLoop set to 1 by default in the code This is how I tried to implement the wait sc.UpdateAlways=false; sc.AutoLoop=0; sc.AddMessageToLog("Waiting for 500 ms", 1); std::this_thread::sleep_for(std::chrono::milliseconds(500)); sc.AddMessageToLog("500 ms passed", 1); sc.AutoLoop=1; sc.UpdateAlways=true; Is there any better way to solve this issue ? |
[2024-06-18 11:16:12] |
User907968 - Posts: 823 |
std::this_thread::sleep_for(std::chrono::milliseconds(500)); Will pause execution on the main thread, so nothing can happen at all, hence the unresponsive. Is there any better way to solve this issue? Yes. Return from the function and execute the trade on a subsequent call. You can use persistent datetime variable(s) to control the length of delay. All you need do then is store some data relevant to your trade so that it is available next time the function is called. 0.5 seconds delay may not be enough either, you need to check with broker/FCM. For example, one firm I know of has (had) a limit of 35 message per second and 250 per 10 seconds. Date Time Of Last Edit: 2024-06-18 11:16:34
|
To post a message in this thread, you need to log in with your Sierra Chart account: