Building EAs and MQL 101

mforexx

Newbie
Messages
2
Likes
0
Hi

I am interested in learning MQL coding I have read the documentation provided and need clarification.

Can someone go over the essentials of EA and Indicator coding. I am enrolling in a C# class at present.

To get some idea of the structure of a standard Expert Advisor, let us take a look at the description given below:

1. Initializing variables

2. Initial data checks

check the chart, number of bars on the chart

check the values of external variables: Lots, S/L, T/P, T/S

3. Setting the internal variables for quick data access

4. Checking the trading terminal – is it void? If yes, then:

checks: availability of funds on the account etc...

is it possible to take a long position (BUY)?

open a long position and exit

is it possible to take a short position (SELL)?

open a short position and exit

exiting the Expert Advisor...

5. Control of the positions previously opened in the cycle

if it is a long position

should it be closed?

should the trailing stop be reset?

if it is a short position

should it be closed?

should the trailing stop be reset?

It turns out to be quite simple (loloolol ok), only 4 main blocks.
 
Top