indicator only compiles if there are comment characters at a certain position

 

Hi,

I am trying to create my first indicator. I copied an indicator from the MQL4 book (see below). This indicator compiles without any errors. However, when I remove the string "//" from this file, I get this error:

(1,1)  : error 356: event handling function not found

How is it possible for an mql4 file to not compile if comment characters are deleted?

Might this be an encoding problem?

#property indicator_chart_window                                                                                                                   
#property indicator_buffers 2                                                                                                                      
#property indicator_color1 Blue                                                                                                                    
#property indicator_color2 Red //                                                                                                                  
                                                                                                                                                   
double Buf_0[];                                                                                                                                    
double Buf_1[];                                                                                                                                    
                                                                                                                                                   
                                                                                                                                                   
int init() {                                                                                                                                       
                                                                                                                                                   
  SetIndexBuffer(0, Buf_0);                                                                                                                        
  SetIndexStyle(0, DRAW_LINE,STYLE_SOLID, 2);                                                                                                       
  SetIndexBuffer(1, Buf_1);                                                                                                                        
  SetIndexStyle(1, DRAW_LINE,STYLE_DOT, 1);                                                                                                         
  return(0);                                                                                                                                       
}                                                                                                                                                  
                                                                                                                                                   
                                                                                                                                                   
int start() {                                                                                                                                      
                                                                                                                                                   
  int i;                                                                                                                                           
  int Counted_bars;                                                                                                                                
                                                                                                                                                   
  Counted_bars=IndicatorCounted();                                                                                                                 
  i=Bars-Counted_bars-1;                                                                                                                           
                                                                                                                                                   
  while (i >= 0) {                                                                                                                                 
      Buf_0[i] = High[i];                                                                                                                            
      Buf_1[i] = Low[i];                                                                                                                             
      i--;                                                                                                                                         
  }                                                                                                                                                
  return(0);                                                                                                                                       
}                                                                                                                                                  
 
 
tarandus:

Hi,

I am trying to create my first indicator. I copied an indicator from the MQL4 book (see below). This indicator compiles without any errors. However, when I remove the string "//" from this file, I get this error:

(1,1)  : error 356: event handling function not found

How is it possible for an mql4 file to not compile if comment characters are deleted?

Might this be an encoding problem?

Can you attach the mq4 file, not a copy and paste.
 
O.k. It is attached to this post.
Files:
 
tarandus:
O.k. It is attached to this post.
I can't reproduce your problem.
 

You are talking about if you remove this?

#property indicator_color2 Red //

 No problem with my editor (Build 1035)

 
GumRai:

You are talking about if you remove this?

 No problem with my editor (Build 1035)

Yes, I am talking about removing this.

Maybe the problem is that I compile the file with mql.exe (build 916).

 
tarandus:

Yes, I am talking about removing this.

Maybe the problem is that I compile the file with mql.exe (build 916).

Unfortunately using a graphical program such as Metaeditor is not an option for me. I do not create and compile mql4 programs manually.
 
tarandus:
Unfortunately using a graphical program such as Metaeditor is not an option for me. I do not create and compile mql4 programs manually.

Maybe you can say this from the start, so we don't have to lost time.

Which editor and encoding are you using ?

 
angevoyageur:

Maybe you can say this from the start, so we don't have to lost time.

Which editor and encoding are you using ?

Sorry for not being more specific. I was expecting that mql.exe would behave in the same way as Metaeditor.

In the program I am developing I do not use an editor. The program creates the indicator and ea files with encoding ascii.

I just found out the source of my problems: I created my sample programs with Emacs under cygwin. The encoding (ascii) wasn't the problem. The problem was the that Emacs does not add a \r at the and of lines, but only a \n. And, obviously, mql.exe does not understand \n as "end of line".

Thanks for you help.

By the way: Will mql.exe be available in the future? Without it or some alternative non-graphical program, it would be very difficult for me to continue my project.

 
Why not using MetaEditor?
 
deysmacro:
Why not using MetaEditor?
Is there a way to call MetaEditor from a shell and have it compile an mql4 file?
Reason: