Evgeny Zhdan - Expert advisor for MT4 for one evening

Здесь есть возможность читать онлайн «Evgeny Zhdan - Expert advisor for MT4 for one evening» — ознакомительный отрывок электронной книги совершенно бесплатно, а после прочтения отрывка купить полную версию. В некоторых случаях можно слушать аудио, скачать через торрент в формате fb2 и присутствует краткое содержание. ISBN: , Жанр: russian_contemporary, на английском языке. Описание произведения, (предисловие) а так же отзывы посетителей доступны на портале библиотеки ЛибКат.

Expert advisor for MT4 for one evening: краткое содержание, описание и аннотация

Предлагаем к чтению аннотацию, описание, краткое содержание или предисловие (зависит от того, что написал сам автор книги «Expert advisor for MT4 for one evening»). Если вы не нашли необходимую информацию о книге — напишите в комментариях, мы постараемся отыскать её.

The reader along with the author will independently write an advisor for the MetaTrader-4 trading terminal. The book describes the basic actions that are performed when developing 95% of trade experts. Thanks to the knowledge gained, immediately after reading the book the reader will be able to write a simple expert himself.

Expert advisor for MT4 for one evening — читать онлайн ознакомительный отрывок

Ниже представлен текст книги, разбитый по страницам. Система сохранения места последней прочитанной страницы, позволяет с удобством читать онлайн бесплатно книгу «Expert advisor for MT4 for one evening», без необходимости каждый раз заново искать на чём Вы остановились. Поставьте закладку, и сможете в любой момент перейти на страницу, на которой закончили чтение.

Тёмная тема
Сбросить

Интервал:

Закладка:

Сделать

Expert advisor for MT4 for one evening

Evgeny Zhdan

© Evgeny Zhdan, 2018

ISBN 978-5-4493-1046-0

Created with Ridero smart publishing system

INTRODUCTION

The FOREX market, like the securities exchange, attracts more and more people by the day. It’s par for the course, everyone wants to make money from the thin air. But, it’s not all that simple.

The notion that the traders who make profitamount to no more than 5% is widely known. The life earnings of remaining 95% get divided between the first 5% and the brokers/dealing centers.

To join with the successful traders, you need to have a clear strategy and ironclad nerves. In principle, there are many profitable trading strategies and methods. The main problem lies in the psychology of the trader. As a rule, almost all traders start with a steady success. A soon after, they have to deal with a gradual or sudden collapse.

The fact is that when they’re starting to trade, the traders fulfill the conditions of their trading strategy. After a series of successful transactions, the latter relaxes, secure in his conviction that he has hit the jackpot and guaranteed himself a comfortable life. Here comes the excessive confidence in actions and the trader begins to deviate from the trading strategy. The transactions begin to be opened not by the system, but “on a hunch”. While swimming in euphoria from a series of successfully closed orders, the trader increases the trading lot. And not a long after this one is also being sent to those 95% of traders, who’re losing money.

You can solve the problem of the psychological side of trading with its automation – the use of a trading expert(adviser, trade bot), which will work with the account of the trader without the intervention of the human – the owner of the account.

The trading bot is devoid of emotions and is able to monotonously execute its algorithm with the arrival of each new price value. Of course, sometimes a trader will have to prohibit its actions, for example, during extremely important instances of financial and political news, when volatility increases exponentially. The example of such events in the recent past can be British Exit – the Brexit – a campaign of supporters of Britain’s withdrawal from the EU, the election of US and French presidents, an accident at the Fukushima-1 nuclear power plant, which provoked a collapse of the Japanese national currency, etc. You get the idea.

In this book, we will learn how to make the trading bots for the most common and most convenient MetaTrader4 trading terminal by MetaQuotes. To be more precise, in this book we will step-by-step create an Expert Advisor, completely ready for “use”. Naturally, I do not promise you the profitability of the final product, it is only important for us to learn how to make them.

After studying this book, you will be able to bring to life your boldest trading ideas by yourself without resorting to the services of mql coders. Also, you will be able to earn money by programming customized advisers.

Perhaps, half-way through this book, you will deviate from it and make your own upgrades to the adviser we are creating. This is as it should be. Let’s get going.

A LITTLE BIT OF THEORY

Types of data

The trading expert manipulates data. It works with incoming prices, price values of indicators, keeps counting the open orders, writes to the trading terminal log.

In mql4, the following data types exist:

Basic data types:

– integers (char, short, int, long, uchar, ushort, uint, ulong)

– logicals (bool)

– literals (ushort)

– strings (string)

– floating-point numbers (double, float)

– colors (color)

– date and time (datetime)

– enumerations (enum)

Complex data types:

– structures;

– classes.

At first, you will not need 70% of the above. Let’s consider only those we will need for the development of our trading expert.

Int type – integers, i.e., 1, 2, 5, 100, 1425…

Double type – numbers with a fractional part (with a decimal point): 1.0254, 0.0547…

Bool type – it only has 2 values – true and false.

String type – string variables, i.e. words: “word”, “four-word sentence”…

Variables

Variables are letter symbols that contain values of some type. Variables are like kegs with something inside.

The bool type is the same – for example, the variable bool b = true means that the keg with the name b contains true inside.

Before creating a variable for later use you must assign its type so that the - фото 1

Before creating a variable for later use, you must assign its type, so that the MetaEditor’s compiler (the one where we will create our bot) knew what will be stored inside this variable. The variable names can not begin with a digit.

You can only assign a variable once. Later we will examine where they can be assigned and how it affects our subsequent actions.

The if-else conditional operators

The if-else conditional operators can be used left and right. If – means “if” clause, else – “if not, then”.

For example:

if (x

{

Do something here, for example, open an order. Or close another order, do anything you like!

} else // And if x is not less than y, do the task put in braces below

{

Do something here.

}

the use of the else operator is not must-have, it all depends on the specific task.

Two slashes – // – mean comments in the advisor code, right after the symbol.When you compile your Expert Advisor (turn your code into machine code, understandable for your computer), the comments will be ignored. If possible, you should write the comments for yourself, so as not to forget what has been done and why.

The blocks of comments are done like this:

/* this

is the commentary

block */

Anything put between the /* and */symbols is also ignored by the compiler.

Cycles

There are for and while cycles in mql4. The for is used more often, but while is also popular.

for (int i=0; i <100; i++)

{

count something 100 times.

}

int i = 0 – assign a variable to work within this cycle; i <100 – the cycle runs 100 times, from 0 to 99; i ++ (increment) means that with each run (iteration) of the cycle, the variable i will be incremented by 1.

bool x = false; // assign value false for a variable x of bool type

while (x==false) // while x is false. Two equal symbols – == – mean comparison

{

/*

some conditions will come true here.

As soon as x is true, the cycle will stop.

*/

//for example

x = true;// set x to true after the first run

//and thus the cycle stops

}

In the process of writing an adviser, we will use both of these cycles, and you will puzzle them out easily.

DESIGN SPECIFICATION

Let’s describe what our future adviser should do and when:

The trading signals will be generated by two standard indicators – the Envelopes and ZigZag. These indicators are built into MetaTrader4 and you do not need to download them separately. I chose these two indicators because their values are being requested in different ways. In case of Envelopes – by using the standard iEnvelopes function, and in case of ZigZag – by the iCustom function – you need to research it yourself (it sounds dramatic, I know) so that sometime later you’ll be able to request the data of almost any non-standardindicators of MetaTrader4.

Читать дальше
Тёмная тема
Сбросить

Интервал:

Закладка:

Сделать

Похожие книги на «Expert advisor for MT4 for one evening»

Представляем Вашему вниманию похожие книги на «Expert advisor for MT4 for one evening» списком для выбора. Мы отобрали схожую по названию и смыслу литературу в надежде предоставить читателям больше вариантов отыскать новые, интересные, ещё непрочитанные произведения.


Отзывы о книге «Expert advisor for MT4 for one evening»

Обсуждение, отзывы о книге «Expert advisor for MT4 for one evening» и просто собственные мнения читателей. Оставьте ваши комментарии, напишите, что Вы думаете о произведении, его смысле или главных героях. Укажите что конкретно понравилось, а что нет, и почему Вы так считаете.

x