Login Page - Create Account

Support Board


Date/Time: Mon, 25 Nov 2024 06:24:30 +0000



Post From: Turn off auto trading in acsil on Friday afternoon

[2014-01-11 15:31:08]
fhvtrading2 - Posts: 11
The following is what works for me.

// flatten and turning off orders to trade service when its friday 1600
  sc.SendOrdersToTradeService = SendOrdersToService.GetYesNo();

  SCDateTime SCDateTimeVariable = sc.BaseDateTimeIn[sc.Index];

  if (sc.SendOrdersToTradeService == 1 && SCDateTimeVariable.GetDayOfWeek() == FRIDAY && sc.BaseDateTimeIn[sc.Index].GetHour() == 16)
  {

    if(PositionData.WorkingOrdersExist) sc.FlattenAndCancelAllOrders();
    
    SendOrdersToService.SetYesNo(false);
  }
  
  // turning it back on in case we forget to manually set it back on Monday
  if (sc.SendOrdersToTradeService == 0 && SCDateTimeVariable.GetDayOfWeek() != FRIDAY)
  {
    SendOrdersToService.SetYesNo(true);
  }