Разная работа функции в эксперте и в скрипте

 
Доброго все времени суток!
У меня возникла такая проблема.

Есть класс код которого представлен ниже

class TestClass
{
   private :
     datetime start;
     datetime finish;
     int handle;
     
   public:
   void TestClass();  
   bool Init();   
   void PrintResult(); 

};
//-----------------------------------------------------------------
TestClass::TestClass(void)
{
     start = D'2011.03.18 11:50';
     finish = D'2011.03.18 20:15';
}
//-----------------------------------------------------------------
bool TestClass::Init()
{
   bool result = true;
   handle = iBands(Symbol(),PERIOD_H4,20,0,2, PRICE_HIGH);
   if( handle == INVALID_HANDLE )
      result = false;
  return result;    
}
//-----------------------------------------------------------------
void TestClass::PrintResult()
{
   double arr[];
   datetime times[];
   int count_tick = CopyBuffer(handle, BASE_LINE, start, finish, arr); 
   printf("Bands count tick = %s", IntegerToString(count_tick));
   
   count_tick = CopyTime(Symbol(), PERIOD_H4, start, finish, times);
   printf("Time count tick = %s", IntegerToString(count_tick));

}

Это класс я использую и в скрипте и в эксперте

Код скрипта :

#include <TestClass.mqh>
//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
//---
   TestClass test;
   if(!test.Init())
   {     
      printf("Error");
   }
   test.PrintResult();
  }
//+------------------------------------------------------------------+

Результат работы скрипта  на графике GBPUSD ,M15 :

2011.09.16 14:36:15    TestClassScript (GBPUSD,M15)    Time count tick = 3
2011.09.16 14:36:15    TestClassScript (GBPUSD,M15)    Bands count tick = 3


Код эксперта :

#include <TestClass.mqh>
 
bool flag;
TestClass test;
MqlTick  tick;
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//---
   int result = 0;
   if(!test.Init())
   {
      result= -1;
   }
   flag = true;
//---

   return(result);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//---

//---  
  }
void OnTick()
{
  datetime finish_1 = D'2011.03.25 00:00';
   SymbolInfoTick(Symbol(),tick);
   if( flag && tick.time > finish_1 ) 
   {
      printf("---   OnTick   ---");
      test.PrintResult();
      flag = false;
   }
}
//+------------------------------------------------------------------+
double OnTester()
{
   printf("---   OnTester   ---");
   test.PrintResult();   
   return 0.0;
}

Результат работы эксперта:

JQ    0    Tester    14:30:19    MetaTester 5 build 496 (25 Aug 2011)
DP    0    Server    14:30:19    MetaTester 5 started on 127.0.0.1:3000
EI    0    Startup    14:30:19    initialization finished
FM    0    127.0.0.1    14:30:19    login (build 496)
FE    0    Network    14:30:19    3768 bytes of group info loaded
NP    0    Network    14:30:19    1478 bytes of tester parameters loaded
RD    0    Network    14:30:19    184 bytes of input parameters loaded
DL    0    Network    14:30:19    182 bytes of selected symbols loaded
DE    0    Tester    14:30:19    expert file added: Experts\Own\Trash\TestClassExpert.ex5. 4695 bytes loaded
KL    0    Tester    14:30:19    initial deposit 5000.00 USD, leverage 1:100
NE    0    Tester    14:30:19    successfully initialized
EP    0    Network    14:30:19    11 Kb of total initialization data received
QG    0    Tester    14:30:19    Intel Core2 Duo  E6550 @ 2.33GHz, 2046 MB
GS    0    Symbols    14:30:19    GBPUSD: symbol synchronized, 3304 bytes of symbol info received
EE    0    History    14:30:19    GBPUSD: load 27 bytes of history data to synchronize
EN    0    History    14:30:19    GBPUSD: history synchronized from 2010.01.03 to 2011.08.31
OS    0    History    14:30:20    GBPUSD: contains 274507 M1 records of beginning data from 2010.01.03 23:00 to 2011.02.28 23:59
HF    0    History    14:30:20    GBPUSD,M15: history cache reserved for estimated 31131 bars
HF    0    History    14:30:20    GBPUSD,M15: history begins from 2010.01.03 23:00
RO    0    Tester    14:30:20    GBPUSD,M15 (Masterforex-Demo): every tick generating
DK    0    Tester    14:30:20    GBPUSD,M15: testing of Experts\Own\Trash\TestSAR.ex5 from 2011.03.01 00:00 to 2011.03.31 00:00 started
MH    0    History    14:30:20    GBPUSD: contains 274508 M1 records of beginning data from 2010.01.03 23:00 to 2011.03.01 00:00
QK    0    History    14:30:20    GBPUSD,H4: history cache reserved for estimated 1945 bars
PP    0    History    14:30:20    GBPUSD,H4: history begins from 2010.01.03 20:00
OF    0    TestSAR (GBPUSD,M15)    14:30:21    2011.03.25 00:00:03   ---   OnTick   ---
DN    0    TestSAR (GBPUSD,M15)    14:30:21    2011.03.25 00:00:03   Bands count tick = 2
PN    0    TestSAR (GBPUSD,M15)    14:30:21    2011.03.25 00:00:03   Time count tick = 3
EH    0    TestSAR (GBPUSD,M15)    14:30:21    2011.03.30 23:59:59   ---   OnTester   ---
RL    0    TestSAR (GBPUSD,M15)    14:30:21    2011.03.30 23:59:59   Bands count tick = 2
FH    0    TestSAR (GBPUSD,M15)    14:30:21    2011.03.30 23:59:59   Time count tick = 3

GI    0    Tester    14:30:21    OnTester result 0

RD    0    Tester    14:30:21    GBPUSD,M15: 419166 ticks (2096 bars) generated within 561 ms (total bars in history 24168, total time 1451 ms)


У меня вопрос почету функция

 CopyBuffer(handle, BASE_LINE, start, finish, arr); 

в эксперте возвращает 2 значения , а при вызове в скрипте 3. Причем заметил что в эксперте не возвращается значение на  время start

 
Где Вы гуру МТ5? Нечего ответить?

 
Спасибо за сообщение, проверим.

Причина обращения: