Login Page - Create Account

Support Board


Date/Time: Tue, 14 May 2024 13:13:31 +0000



Post From: Count set to 0 every tick

[2020-06-22 15:26:43]
gfx2trade - Posts: 48
hello,
thks for helping.
I do have
sc.AutoLoop = 1;
and ...


  // *************************************************************************************************************
  // Data Processing
  // *************************************************************************************************************
  
  if (sc.GetBarHasClosedStatus() == BHCS_BAR_HAS_CLOSED) {
  
      ServiceLogStr = "";
      ServiceLogStr.Format(" # of period since start up : %i", periodCount );
      sc.AddMessageToTradeServiceLog(ServiceLogStr, 0);
      periodCount++;
      ServiceLogStr.Format(" # of period since start up : %i", periodCount );
      sc.AddMessageToTradeServiceLog(ServiceLogStr, 0);
  }

  if (periodCount < 10) {
    
    ServiceLogStr.Format(" Period count is lower than 10 : %i", periodCount );
    sc.AddMessageToTradeServiceLog(ServiceLogStr, 0);
    periodCount++;
    ServiceLogStr.Format(" After ++ Period count is lower than 10 : %i", periodCount );
    sc.AddMessageToTradeServiceLog(ServiceLogStr, 0);
    IsTradeAllowed = false;
    sc.AddMessageToTradeServiceLog("-------------------- Pending further market data prior to activation --------------------", 0);
    // return;
  }


In the end ... result is ...


# of period since start up : 0 | 2020-06-22 17:23:01.264
# of period since start up : 1 | 2020-06-22 17:23:01.264
Period count is lower than 10 : 1 | 2020-06-22 17:23:01.264
After ++ Period count is lower than 10 : 2 | 2020-06-22 17:23:01.264
-------------------- Pending further market data prior to activation -------------------- | 2020-06-22 17:23:01.264
Period count is lower than 10 : 1 | 2020-06-22 17:23:01.264
After ++ Period count is lower than 10 : 2 | 2020-06-22 17:23:01.264
-------------------- Pending further market data prior to activation -------------------- | 2020-06-22 17:23:01.264
Period count is lower than 10 : 0 | 2020-06-22 17:23:01.440
After ++ Period count is lower than 10 : 1 | 2020-06-22 17:23:01.440
-------------------- Pending further market data prior to activation -------------------- | 2020-06-22 17:23:01.440
Period count is lower than 10 : 0 | 2020-06-22 17:23:03.258
After ++ Period count is lower than 10 : 1 | 2020-06-22 17:23:03.258
-------------------- Pending further market data prior to activation -------------------- | 2020-06-22 17:23:03.258
Period count is lower than 10 : 0 | 2020-06-22 17:23:03.493
After ++ Period count is lower than 10 : 1 | 2020-06-22 17:23:03.493
-------------------- Pending further market data prior to activation -------------------- | 2020-06-22 17:23:03.493


it is like it is reset to 0 @ eack new tick.

definition is ...
int periodCount; // Gestion d'un seuil minimum de bar avant activation.

it is outside
if (sc.SetDefaults)

if inside, I get the following error message . 'error: 'periodCount' was not declared in this scope'