Indicator (Trix) doesn't work with 99% modeling quality

To add comments, please log in or register
Budzzza
26
Budzzza  

Hi everyone. Recently I have been trying to use 99% modeling quality with my expert advisor using custom indicator called Trix. Before that I have been using 90% modeling quality.
I got a problem while using 99% modeling quality, where my indicator would not show any signals.

I thought that there might be a problem in the code or there might be a problem with the application that I am using. I am new to all of this and have never written an indicator (so I apologize if this is a stupid question), so I was wondering if someone who understands this would be able to explain to me what is my problem with not getting any signals with 99% modeling quality.
I am attaching the code for Trix and also 2 pictures of how different it is between 90% and 99% modeling quality.

Thank you.

#property  indicator_separate_window
#property  indicator_buffers 6
//----
#property  indicator_color1 Crimson
#property  indicator_color2 Green
#property  indicator_color3 Red
#property  indicator_color4 Aqua
#property  indicator_color5 DarkGray
#property  indicator_color6 DarkGray
#property  indicator_width1 1
#property  indicator_width2 1
#property  indicator_width3 0
#property  indicator_width4 0
#property  indicator_width5 1
#property  indicator_width6 1
#property  indicator_style1 STYLE_SOLID
#property  indicator_style2 STYLE_DOT
#property  indicator_style3 STYLE_SOLID
#property  indicator_style4 STYLE_SOLID
#property  indicator_style5 STYLE_SOLID
#property  indicator_style6 STYLE_SOLID
#property  indicator_level1 0
//---- indicator parameters
extern int  TRIX_Period    =13;
extern int  Signal_Period  =8;
extern bool Signals        =true;
extern int  CountBars      =1500;
//---- indicator buffers
double      ind_buffer1[];
double      ind_buffer2[];
double      ind_buffer3[];
double      ind_buffer4[];
double      ind_buffer5[];
double      ind_buffer6[];
double      ind_buffer7[];
//---- variables
static bool TurnedUp=false;
static bool TurnedDown=false;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- drawing settings
   IndicatorBuffers(7);
   SetIndexStyle(0,DRAW_LINE);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexStyle(2,DRAW_ARROW);
   SetIndexArrow(2,233);
   SetIndexStyle(3,DRAW_ARROW);
   SetIndexArrow(3,234);
   SetIndexStyle(4,DRAW_LINE);
   SetIndexStyle(5,DRAW_HISTOGRAM);
//---- indicator buffers mapping
   SetIndexBuffer(0,ind_buffer1);
   SetIndexBuffer(1,ind_buffer2);
   SetIndexBuffer(2,ind_buffer3);
   SetIndexBuffer(3,ind_buffer4);
   SetIndexBuffer(4,ind_buffer5);
   SetIndexBuffer(5,ind_buffer6);
   SetIndexBuffer(6,ind_buffer7);
//---- name for DataWindow and indicator subwindow label
   IndicatorShortName("TRIX index | Period: "+TRIX_Period+", Signal Period: "+Signal_Period+" | ");
   SetIndexLabel(0,"TRIX");
   SetIndexLabel(1,"Signal");
//---- initialization done
   return(0);
  }
//+------------------------------------------------------------------+
//| TRIX                                                             |
//+------------------------------------------------------------------+
int start()
  {
   if (TRIX_Period==Signal_Period) return(0);
   int i, limit=CountBars;
   if (limit>Bars) limit=Bars-1;
//---- trix 
   for(i=0; i<limit; i++) ind_buffer1[i]=iMA(NULL,0,TRIX_Period,0,MODE_SMMA,PRICE_CLOSE,i);
   for(i=0; i<limit; i++) ind_buffer2[i]=iMAOnArray(ind_buffer1,0,TRIX_Period,0,MODE_SMMA,i);
   for(i=0; i<limit; i++) ind_buffer7[i]=iMAOnArray(ind_buffer2,0,TRIX_Period,0,MODE_EMA,i);
   //
   for(i=0; i<limit-1; i++) ind_buffer1[i]=(ind_buffer7[i]-ind_buffer7[i+1])/ind_buffer7[i+1];
   for(i=0; i<limit-1; i++) ind_buffer2[i]=iMAOnArray(ind_buffer1,0,Signal_Period,0,MODE_EMA,i);
   for(i=0; i<limit-1; i++) {ind_buffer5[i]=ind_buffer1[i]-ind_buffer2[i]; ind_buffer6[i]=ind_buffer5[i];}
//---- signals
   i=limit-1;
   while(i>=0)
     {
      if (Signals==true)
        {
         if (ind_buffer2[i]<ind_buffer1[i] && ind_buffer2[i+1]>=ind_buffer1[i+1]) ind_buffer3[i]=ind_buffer2[i]-0.0001;
         if (ind_buffer2[i]>ind_buffer1[i] && ind_buffer2[i+1]<=ind_buffer1[i+1]) ind_buffer4[i]=ind_buffer2[i]+0.0001;
         if (ind_buffer3[0]==ind_buffer2[0]-0.0001 && TurnedUp==false)
           {
            Alert("Trix Buy:  ",Symbol()," - ",Period(),"  at  ", Close[0],"  -  ", TimeToStr(CurTime(),TIME_SECONDS));
            TurnedDown=false;
            TurnedUp=true;
           }
         if (ind_buffer4[0]==ind_buffer2[0]+0.0001 && TurnedDown==false)
           {
            Alert("Trix SELL:  ",Symbol()," - ",Period(),"  at  ", Close[0],"  -  ", TimeToStr(CurTime(),TIME_SECONDS));
            TurnedUp=false;
            TurnedDown=true;
           }
        }
      i--;
     }
     Alert("buffer 3(up): "+ind_buffer3[0]+"     buffer 4(down): "+ind_buffer4[0]+"    buffer 2(mid): "+ind_buffer2[0]);
//---- done
   return(0);
  }

90%99%



Fernando Carreiro
4997
Fernando Carreiro  
Budzzza: Recently I have been trying to use 99% modeling quality with my expert advisor using custom indicator called Trix. Before that I have been using 90% modeling quality. I got a problem while using 99% modeling quality, where my indicator would not show any signals.


I thought that there might be a problem in the code or there might be a problem with the application that I am using. I am new to all of this and have never written an indicator (so I apologize if this is a stupid question), so I was wondering if someone who understands this would be able to explain to me what is my problem with not getting any signals with 99% modeling quality. I am attaching the code for Trix and also 2 pictures of how different it is between 90% and 99% modeling quality.

If you look closely at the reports, the following would have given you a clue. For your test 90% test you have 2078 bars (306509 ticks), but for your 99% test you only have 1228 bars (293823 ticks).

I am assuming you are generating your FXT files with 3rd Party tools for the 99% quality, so you must generate more data prior to the starting date of the test in order for the Indicator and EA to have enough bars before the start date in order to calculate properly. That is why you get that "strange" ramp effect in the beginning of the 99% test. You must also set an explicit date for the test, taking the above into account, and not just test over the entire data set range.

Budzzza
26
Budzzza  
Fernando Carreiro:

If you look closely at the reports, the following would have given you a clue. For your test 90% test you have 2078 bars (306509 ticks), but for your 99% test you only have 1228 bars (293823 ticks).

I am assuming you are generating your FXT files with 3rd Party tools for the 99% quality, so you must generate more data prior to the starting date of the test in order for the Indicator and EA to have enough bars before the start date in order to calculate properly. That is why you get that "strange" ramp effect in the beginning of the 99% test. You must also set an explicit date for the test, taking the above into account, and not just test over the entire data set range.

I highly appreciate your help. I will look into this and will try to fix this. Thank you.

To add comments, please log in or register