Login Page - Create Account

Support Board


Date/Time: Tue, 14 May 2024 02:21:50 +0000



Post From: Count set to 0 every tick

[2020-06-17 09:43:05]
gfx2trade - Posts: 48
Hi,
I want to use a counter in my studiy so that the order generation only starts after a few bars.
I use a count with ...
int periodCount;
and then

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);
  }


issue it that periodCount gets reset to 0 a every tick. Therefore it never exceeds 1.
Can you please help ?
Thks