Tester Interval Issue.

 

I am currently testing an EA that contains a custom indicator. The custom indicator has a 0 value for the time interval so that it computes off of the active chart. I currently have a 15 minute chart open with the custom indicator on the chart. When I ran the EA through the tester, I ran a number of variables to the journal for review. In the journal I noted that the tester utilized data from the M1 time interval even though I have a 15 minute chart open. Can someone help me with why the EA did not utilize the chart time interval or the time interval specified in the custom indicator in the EA? In other words, as stated above, my custom indicator has a 0 value for the time interval. I expected to see the custom indicator pick up the time interval specified in the EA which was 15 minutes. In other words the EA uses the custom indicator with a 15 minute parameter in the indicator formula.

-EA Code-

Print(MktAmt,"***",DoubleToStr(iCustom(NULL,15,"PLDot",3,0,0),5),"***",DoubleToStr(iClose(NULL,15,0),5),"***",buysig,"***",cbuysig,"***",sellsig,"***",csellsig);


-Indicator Code-

#property indicator_chart_window

#property indicator_buffers 3       
#property indicator_color1 Gray    
#property indicator_color2 Red 
#property indicator_color3 Blue    

double MovingBuffer[5000];
double UpperBuffer[5000];
double LowerBuffer[5000];
double TempBuffer[5000];
double ResBuffer[5000];
double SupBuffer[5000];            
//--------------------------------------------------------------------
int init()                         
  {
   IndicatorBuffers(6);
   
   IndicatorDigits(Digits+5);
//--------------------------------------------------------------------
   IndicatorShortName("PLDot");
//--------------------------------------------------------------------
   SetIndexBuffer(0,MovingBuffer);        
   SetIndexStyle (0,DRAW_LINE,STYLE_SOLID,1);
   SetIndexDrawBegin(0,0);
//--------------------------------------------------------------------
   SetIndexBuffer(1,UpperBuffer);         
   SetIndexStyle (1,DRAW_LINE,STYLE_SOLID,1);
   SetIndexDrawBegin(1,0);
//--------------------------------------------------------------------
   SetIndexBuffer(2,LowerBuffer);         
   SetIndexStyle (2,DRAW_LINE,STYLE_SOLID,1);
   SetIndexDrawBegin(2,0);
//--------------------------------------------------------------------
   SetIndexBuffer(3,ResBuffer);
   SetIndexBuffer(4,SupBuffer);
   SetIndexBuffer(5,TempBuffer);
   
   SetIndexShift(0,1);
   SetIndexShift(1,1);
   SetIndexShift(2,1);   

//--------------------------------------------------------------------
   return;                         
  }
//--------------------------------------------------------------------
int start()                        
  {
   int i,                           
       Counted_bars;               
//--------------------------------------------------------------------
   ArraySetAsSeries(MovingBuffer,true);
   ArraySetAsSeries(UpperBuffer,true);
   ArraySetAsSeries(LowerBuffer,true);
   ArraySetAsSeries(ResBuffer,true);
   ArraySetAsSeries(SupBuffer,true);
   ArraySetAsSeries(TempBuffer,true);   
   
   Counted_bars=IndicatorCounted(); 
   int    counted_bars=IndicatorCounted();
   int limit1, limit2;
   limit1 = Bars - counted_bars - 1;
   if (limit1>1) 
      {
      limit1=Bars-4;
      limit2=limit1-3;
      }

   for(i=limit1;i>=0;i--)          
      {            
      TempBuffer[i] = (((iClose(NULL,0,i)+iLow(NULL,0,i)+iHigh(NULL,0,i))/3) + ((iClose(NULL,0,i+1)+iLow(NULL,0,i+1)+iHigh(NULL,0,i+1))/3) + ((iClose(NULL,0,i+2)+iLow(NULL,0,i+2)+iHigh(NULL,0,i+2))/3))/3;
      ResBuffer[i] = ((TempBuffer[i]*2.0)-High[i]);
      SupBuffer[i] = ((TempBuffer[i]*2.0)-Low[i]);
      }
      
   for(i=limit2;i>=0;i--)          
      {            
      MovingBuffer[i]=TempBuffer[i];
      UpperBuffer[i]=iMAOnArray(ResBuffer,0,3,0,MODE_SMA,i);
      LowerBuffer[i]=iMAOnArray(SupBuffer,0,3,0,MODE_SMA,i);
      }
      
   return(0);                         
  }
//-------------------------------------------------------------------
 
In your call of the Indicator what is the 3 value in this iCustom(NULL,15,"PLDot",3,0,0)
 

RaptorUK,

This is a passed parameter of the averaging period for the indicator. It though is not an external parameter though. Does this make a difference?

ForexSurfr

 
ForexSurfr:

RaptorUK,

This is a passed parameter of the averaging period for the indicator. It though is not an external parameter though. Does this make a difference?

ForexSurfr

Yup . . . as far as I know you can only pass externs and read from buffers.
 
  1. There are NO external variables in the indicator, therefor your call is BOGUS. Drop the 3
  2. SetIndexBuffer(0,MovingBuffer);
    SetIndexBuffer(1,UpperBuffer);
    SetIndexBuffer(2,LowerBuffer);
    SetIndexBuffer(3,ResBuffer);
    SetIndexBuffer(4,SupBuffer);
    SetIndexBuffer(5,TempBuffer);
    Document your calls
    #define PLDOT_MOVING 0
    #define PLDOT_UPPER  1
    #define PLDOT_LOWER  2
    #define PLDOT_RES    3
    #define PLDOT_SUP    4
    #define PLDOT_TEMP   5
    ... iCustom(NULL,15,"PLDot", PLDOT_MOVING, 0)
    

  3.    ArraySetAsSeries(MovingBuffer,true);
       ArraySetAsSeries(UpperBuffer,true);
       ArraySetAsSeries(LowerBuffer,true);
       ArraySetAsSeries(ResBuffer,true);
       ArraySetAsSeries(SupBuffer,true);
       ArraySetAsSeries(TempBuffer,true);   
    Unnecessary
  4. (iClose(NULL,0,i)+iLow(NULL,0,i)+iHigh(NULL,0,i))/3) 
    Why use function calls when you can use the simple arrays
    (Close[i]+Low[i]+High[i])/3) 

 
WHRoeder:
  1. There are NO external variables in the indicator, therefor your call is BOGUS. Drop the 3
  2. Document your calls
  3. Unnecessary
  4. Why use function calls when you can use the simple arrays


WHRoeder & RaptorUK,

Thank you for your comments. I will make these suggested changes.

Reason: