Login Page - Create Account

Support Board


Date/Time: Tue, 26 Nov 2024 04:43:00 +0000



Post From: Liquidation ACSIL

[2024-01-03 19:39:04]
User373245 - Posts: 42
is something off with how I built the time variables ...they show up in the log the same....like my trade will execute at say 02:38:00 and my liquidation time reads in the log as 19:00:00 but the trade liquidates immediately as it opens. Hence I tried building it a couple ways. I built it without the milliseconds becuase I thought it was throwing it off. But I have played around with a bunch of variations...if I remove the if for flattening at the time...the script performs perfectly as it should but when I try to ad any variation for flattening trades it flattens as soon as it opens no matter what variation I use.


int Hour = 19;
  int Minute = 0;
  int Second = 0;
  int MilliSecond = 0;
  SCDateTime liquidationTime = SCDateTime(Hour, Minute, Second, MilliSecond);
  
// Create another SCDateTime object for comparison without milliseconds
  int hour2 = liquidationTime.GetHour();
  int minute2 = liquidationTime.GetMinute();
  int second2 = liquidationTime.GetSecond();

SCDateTime liquidatoinTime2;
liquidatoinTime2.SetTimeHMS(hour2, minute2, second2);

  
// Current Time

SCDateTime currentDateTime = sc.GetCurrentDateTime();
int Hour1 = 0;
int Minute1 = 0;
int Second1 = 0;
currentDateTime.GetTimeHMS(Hour1, Minute1, Second1);



if(currentDateTime >= liquidationTime){
sc.FlattenAndCancelAllOrders()
}