How to back test EA which uses DLL function

 

I wrote an EA shell which uses a DLL function in start() function - and it works OK while in forward test mode, but is no any sign while I try to back test on historical data.

and i have also check the options

MYDLL's size is 208Kb,

it is work well for indicators called this dll with icustom in diffent timeframe,

also it is work well for ea running for demo account.

myea call my base indicators, my base indicators call dll.

but I found that ea is not work while I try to back test on historical data. specially, when i change some function in indicators ,it is maybe work well for only one time.

it does not work with nexttime without any code change in mt4 and dll.

can any one give me some advice?

 

my ea code

my ea code
   int a1=iCustom(NULL,0, "FXJ_TTT_base",6043,0,0, 0,1);
   int a2=iCustom(NULL,0, "FXJ_TTT_base",6044,0,0, 0,1);
   int a3=iCustom(NULL,0, "FXJ_TTT_base",6045,0,0, 0,1);    
   bool buyflag=a1>0.5 || a2>0.5 || a3>0.5;
   bool sellflag=a1<-1 || a2<-1 || a3<-1; 
   Print("=============================================buyflag : " ,buyflag," sellflag ",sellflag); 
my base indicators code

#include <fxj.mqh>

#property indicator_separate_window
#property indicator_buffers 4
#property indicator_color1 Lime
#property indicator_color2 DarkViolet
#property indicator_color3 DarkGoldenrod
#property indicator_color4 Red

extern int param1=6043;
extern int param2=0;
extern int param3=0;

double Tii5[];

double S5[];


int init()
  {
   string short_name;  
   IndicatorBuffers(4);
   SetIndexStyle(0, DRAW_LINE);   
   SetIndexBuffer(0, Tii5);
   short_name="FXJ_TTT_base";
   IndicatorShortName(short_name);
   SetIndexLabel(0,"Tii5");
   return(0);
  }
int start()
  {
   int counted_bars = IndicatorCounted(); 
   double rates[][6];
   ArrayResize(S5,Bars);  
   ArrayCopyRates(rates);
   ArrayResize(S5,Bars);
   ArrayResize(S7,Bars);
   ArrayResize(S17,Bars);
   ArrayResize(S31,Bars);     
   CreateAndBack(rates,Bars, counted_bars,Symbol(),param1,param2,param3,S5,Tii5);
   return(0);
  }

myinclude code
#import "fxj.dll"
int CreateAndBack(double rates[][6],int ,int ,string ,int ,int ,int ,double& temp[],double& TiiBuffer[]);
#import

mydll code
__declspec(dllexport) int __stdcall CreateAndBack(const RateInfo* rates,const int bars,const int rates_count,const char* name,
                                                                                                  const int param1,const int param2,
                                                                                                  const int param3,double *tempGroup,double *ar_TII)
{
    if(rates_count == 0)   // just the first time to enter the pro
    {
                for(i=0;i<bars;i++){
                        if(i%2==0)
                                ar_TII[i]=1;
                        else{
                                ar_TII[i]=0;
                        }
    }else{
                for(i=rates_count-1;i<bars;i++){
                        if(i%2==0)
                                ar_TII[i]=1;
                        else{
                                ar_TII[i]=0;
                        }
    }
}
in facts,dll is more code than this ,so it's size is 208KB.

 

log

10:33:02 MyWaveEA EURUSD,M30: loaded successfully

10:33:02 FXJ_TTT_base EURUSD,M30: removed

10:33:02 FXJ_TTT_base EURUSD,M30: removed

10:33:02 FXJ_TTT_base EURUSD,M30: removed

10:33:02 MyWaveEA inputs: lStopLoss=370; sStopLoss=350; lTakeProfit=800; sTakeProfit=750; lTrailingStop=300; sTrailingStop=300; Slippage=4; Lots=1;

10:33:02 2012.01.02 02:00 MyWaveEA EURUSD,M30: ==================ret===================ret : 0

10:33:02 2012.01.02 02:00 FXJ_TTT_base EURUSD,M30: loaded successfully

10:33:02 2012.01.02 02:00 FXJ_TTT_base EURUSD,M30: bars less than 1001002

10:33:57 2012.01.02 02:00 FXJ_TTT_base EURUSD,M30: loaded successfully

10:33:57 2012.01.02 02:00 FXJ_TTT_base EURUSD,M30: bars less than 1001002

10:33:57 2012.01.02 02:00 FXJ_TTT_base EURUSD,M30: loaded successfully

10:33:57 2012.01.02 02:00 FXJ_TTT_base EURUSD,M30: bars less than 1001002

10:33:57 2012.01.02 02:00 MyWaveEA EURUSD,M30: =============================================buyflag : 0 sellflag 0

it is always

10:33:57 2012.01.02 02:00 MyWaveEA EURUSD,M30: =============================================buyflag : 0 sellflag 0

when it is no effect

 

sorry to all

    if(rates_count == 0)   // just the first time to enter the pro
    {
                for(i=0;i<bars;i++){
                        if(i%2==0)
                                ar_TII[i]=1;
                        else{
                                ar_TII[i]=0;
                        }
    }else{
                for(i=rates_count-1;i<bars;i++){
                        if(i%2==0)
                                ar_TII[i]=1;
                        else{
                                ar_TII[i]=0;
                        } 

}

with this code,it is ok.

so the problem may ablout my dll

 
it is my bug in dll. now,i have fix it . thanks for all kids
Reason: