Login Page - Create Account

Support Board


Date/Time: Thu, 02 May 2024 00:49:34 +0000



[Programming Help] - Order modification after some time

View Count: 485

[2019-09-27 15:33:28]
User634719 - Posts: 4
Hi,

My goal is to modify placed order after N minutes.
I've tested on AAPL symbol.
I use this approach:


SCDateTime TimeToCheckFor;

int CurrentDate = sc.BaseDateTimeIn[sc.Index].GetDate();
int CurrentTime = sc.BaseDateTimeIn[sc.Index].GetTime();


TimeToCheckFor.SetDate(CurrentDate);

TimeToCheckFor.SetTime(CurrentTime);


// TimeToCheckFor is then saved in persistent storage


and then at some point I check:



if (sc.IsDateTimeContainedInBarIndex(TimeToCheckFor, sc.Index))
{

//perform the action here

}


And the condition is TRUE on the first check, because if I output seconds (GetTimeInSeconds()), for example:
- CurentDateTime is 64800; maybe it's time of the bar open; I guess bar "duration" is 2 hours;
- if I add 120 seconds (2 min) it will be 64920;
- current time at the moment when condition is checked 71250.

If I use sc.ArraySize - 1 instead of sc.Index it won't work as well.
I can use GetCurrentDateTime() but I guess it won't work if I apply my study to the replay.

And my question is how can I do any action (e.g. modify order) after some time after I've placed the order (live stream and replay)?

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

Login

Login Page - Create Account