Login Page - Create Account

Support Board


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



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

[2013-06-02 18:13:07]
fhvtrading2 - Posts: 11
Hi.
I have a working auto strategy which will flatten somewhere on friday afternoon. How do I make sure it will not enter a new trade after that in case I can not manually turn off autotrading?

I tried using the following code, but am not sure if the sc.SendOrdersToTradeService = false; works. Currently I turn it on as a study setting. I prefer to keep that switch instead of turning it to true inside the strategy.

Hope you have a pointer. Thanks.

example code:

sc.SendOrdersToTradeService = SendOrdersToService.GetYesNo();

SCDateTime SCDateTimeVariable = sc.BaseDateTimeIn[sc.Index];
  
  if (SCDateTimeVariable.GetDayOfWeek() == FRIDAY && sc.BaseDateTimeIn[sc.Index].GetHour() == 16 && sc.BaseDateTimeIn[sc.Index].GetMinute() == 00 && PositionData.WorkingOrdersExist)
  {
    sc.FlattenAndCancelAllOrders();
      
  }
  else if (SCDateTimeVariable.GetDayOfWeek() == FRIDAY && sc.BaseDateTimeIn[sc.Index].GetHour() == 16)
  {
    sc.SendOrdersToTradeService = false;
  }