Link two EA's together

 

Hello everyone,

I have been trying to call a second EA from my main EA. I have tried to use #include <KeyBoard.mq4> which causes an error "Can't Open D:\xxx\xxx\xxx". I would like know the correct way to make this possible.

 

The reference of the editor tells you about #include (slightly modified):

The preprocessor replaces the line #include <WinUser32.mqh> with the content of the file WinUser32.mqh.
Angle brackets indicate that the WinUser32.mqh file will be taken from the standard directory (usually it is terminal_installation_directory\MQL4\Include).

The current directory is not included in the search.
If the file name is enclosed in quotation marks, the search is made in the current directory (which contains the main source file). The standard directory is not included in the search.

Try: #include "KeyBoard.mq4"

 
Carl Schreiber:

The reference of the editor tells you about #include (slightly modified):

Try: #include "KeyBoard.mq4"

Thanks Carl,

That works fine. I found that OnInit() had to be removed from KeyBoard.mq4 otherwise I get an error that it already exists. The reason I want the second EA is that I don't want to have to look at this all the time.

#define KEY_LEFT  37 //
#define KEY_UP    38 //
#define KEY_RIGHT 39 //
#define KEY_DOWN  40 //

#define KEY_0 48 //
#define KEY_1 49 //
#define KEY_2 50 //
#define KEY_3 51 //
#define KEY_4 52 //
#define KEY_5 53 //
#define KEY_6 54 //
#define KEY_7 55 //
#define KEY_8 56 //
#define KEY_9 57 //

#define KEY_A 65 //
#define KEY_B 66 //
#define KEY_C 67 //
#define KEY_D 68 //
#define KEY_E 69 //
#define KEY_F 70 //
#define KEY_G 71 //
#define KEY_H 72 //
#define KEY_I 73 //
#define KEY_J 74 //
#define KEY_K 75 //
#define KEY_L 76 //
#define KEY_M 77 //
#define KEY_N 78 //
#define KEY_O 79 //
#define KEY_P 80 //
#define KEY_Q 81 //
#define KEY_R 82 //
#define KEY_S 83 //
#define KEY_T 84 //
#define KEY_U 85 //
#define KEY_V 86 //
#define KEY_W 87 //
#define KEY_X 88 //
#define KEY_Y 89 //
#define KEY_Z 90 //

#define KEY_a 97 //
#define KEY_b 98 //
#define KEY_c 99 //
#define KEY_d 100 //
#define KEY_e 101 //
#define KEY_f 102 //
#define KEY_g 103 //
#define KEY_h 104 //
#define KEY_i 105 //
#define KEY_j 106 //
#define KEY_k 107 //
#define KEY_l 108 //
#define KEY_m 109 //
#define KEY_n 110 //
#define KEY_o 111 //
#define KEY_p 112 //
#define KEY_q 113 //
#define KEY_r 114 //
#define KEY_s 115 //
#define KEY_t 116 //
#define KEY_u 117 //
#define KEY_v 118 //
#define KEY_w 119 //
#define KEY_x 120 //
#define KEY_y 121 //
#define KEY_z 122 //
 

Hello everyone,

This might look a little strange.

#include "KeyBoard.mq4"
#include "Variables.mq4"
#include "Button.mq4"

I can't comply the code with any of these mq4's in focus (I hope that I've used the term "in focus" correctly)

After I played around a bit, the code appears to be easier to find errors and debug.

 

Hello everyone,

Just two more questions please. How do I include an Indicator to my EA? How do I get the Indicator to fire a start trade operation?

Reason: