Indicator problem

 

Hi,

I have a problem with indicator called 'HAS55'. When I put it on the chart it keeps producing messages in the 'experts' tab, almost every second there are few messages. Is that normal? Does it slow down MT4?

I've tried to compile mq4 code, but there are some warnings: 'improper enumerator cannot be used'.


Attached mq4 file, maybe someone can help.


Thank you

P.

Files:
has55.mq4  6 kb
 

I notice within the init function, you are making multiple calls to the same function with the same exact values.  Not sure that calling them twice like this in the same section of the program is doing any good, unless the SetIndexDrawBegin(0,5); function call changes the buffer values so that you need to set them back again.

//---- indicators
   IndicatorBuffers(8);

   SetIndexStyle(0,DRAW_HISTOGRAM, 0);
   SetIndexBuffer(0, ExtMapBuffer1);
   SetIndexStyle(1,DRAW_HISTOGRAM, 0);
   SetIndexBuffer(1, ExtMapBuffer2);
   SetIndexStyle(2,DRAW_HISTOGRAM, 0);
   SetIndexBuffer(2, ExtMapBuffer3);
   SetIndexStyle(3,DRAW_HISTOGRAM, 0);
   SetIndexBuffer(3, ExtMapBuffer4);
//----
   SetIndexDrawBegin(0,5);
//---- indicator buffers mapping
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexBuffer(1,ExtMapBuffer2);
   SetIndexBuffer(2,ExtMapBuffer3);
   SetIndexBuffer(3,ExtMapBuffer4);
   SetIndexBuffer(4,ExtMapBuffer5);
   SetIndexBuffer(5,ExtMapBuffer6);
   SetIndexBuffer(6,ExtMapBuffer7);
   SetIndexBuffer(7,ExtMapBuffer8);


As far as your warnings, the compiler tells you specifically what and where as well.

   while(pos>=0)
     {
      maOpen=iMA(NULL,0,MaPeriod,0,MaMetod,MODE_OPEN,pos);
      maClose=iMA(NULL,0,MaPeriod,0,MaMetod,MODE_CLOSE,pos);
      maLow=iMA(NULL,0,MaPeriod,0,MaMetod,MODE_LOW,pos);
      maHigh=iMA(NULL,0,MaPeriod,0,MaMetod,MODE_HIGH,pos);


There is no easy way to see what column it is in when using metaeditor, so had to count columns over.  But warnings are not errors, they will not necessarily halt the program from operating properly.

 
JD4:

I notice within the init function, you are making multiple calls to the same function with the same exact values.  Not sure that calling them twice like this in the same section of the program is doing any good, unless the SetIndexDrawBegin(0,5); function call changes the buffer values so that you need to set them back again.


As far as your warnings, the compiler tells you specifically what and where as well.


There is no easy way to see what column it is in when using metaeditor, so had to count columns over.  But warnings are not errors, they will not necessarily halt the program from operating properly.

      maOpen=iMA(NULL,0,MaPeriod,0,MaMetod,PRICE_OPEN,pos);
      maClose=iMA(NULL,0,MaPeriod,0,MaMetod,PRICE_CLOSE,pos);
      maLow=iMA(NULL,0,MaPeriod,0,MaMetod,PRICE_LOW,pos);
      maHigh=iMA(NULL,0,MaPeriod,0,MaMetod,PRICE_HIGH,pos);

 To the OP, these are the correct enumerations

 

There is no easy way to see what column it is in when using metaeditor, so had to count columns over.  But warnings are not errors, they will not necessarily halt the program from operating properly. 

 Double click on the report line and the cursor is moved to the specific line and column in the code

 
Print(Crossed (ExtMapBuffer1[0],ExtMapBuffer2[0]));
This line will keep printing in the Expert tab. Remove it.
 
GumRai:
This line will keep printing in the Expert tab. Remove it.

Thank you very much, now it works nicely : )


P.