If there are no contraindicatons of a general character, control is passed to order accounting block. In such a case an EA must terminate operation preliminarily informing a user about it and reporting about the reason of termination. For example, if there are not enough bars in a window (bars necessary for calculating parameters of technical indicators), an EA will not be able to operate adequately. In this block some general parameters can be analyzed. How the EA built on the bases of the offered scheme will operate can be easily understood simply looking on the scheme and orienting upon block names and relations arrays (control passing) between them.Īfter program start control is passed to the block of preliminary processing. At the same time the algorithm of a program is to a great extent formed. On the following EA development stage there is no program code yet. Structural scheme of a simple Expert Advisor. Structure of a Simple Expert Advisorīelow is a structural scheme of a simple Expert Advisor constructed on the basis of several functional blocks, in each block a certain detached part of calculations.įig. Analyzing errors that may occur in the execution of trade operation allows, on the one side, to repeat a trade request and, on the other hand, to inform a user about a possible conflict situation. For convenience, the program part responsible for the calculation of trading criteria should be written in a separate block.Ī trading Expert Advisor must necessarily contain error processing block. For example, an Expert Advisor can analyze combination of technical indicator values, time of important news releases, current time, values of some price levels, etc. When calculating trade criteria a program can (and must) take into account all information that can be useful. The success of the whole program depends on the correctness of detecting trade criteria in the program. Trade decisions should be made in a program on the bases of trade criteria. An EA must also calculate order prices depending on a user's desire. An Expert Advisor can form a trade request to open a new pending or market order, close or modify any of existing orders or perform no actions at all. Code part responsible for trade orders formation is better written in a separate block. First of all a program must contain a block of orders accounting which is among the first to be executed.ĭuring an EA execution trading decisions should be made, the implementation of which leads to the execution of trade operations. Before a trade decision is made in a program, it is necessary to know what trading orders have already been opened or placed. When using any strategy, trade decisions should be made taking into account the current situation. Generally, if a trading strategy allows, several orders can be open in a terminal at the same time, though their number should be reasonably limited. Some of trading strategies allow only one unidirectional order. One of the most important data in the formation of trade orders is the information about orders that already exist in a client terminal. To create an algorithm of a trading Expert Advisor, let's analyze what an operating program should do. The most convenient program is the one that consists of functional blocks, each of which is responsible for its part of calculations. To be able to easily understand the program in future, it must be created in accordance with a well-thought and easy-to-understand scheme (it is especially important if a program will be further improved by another programmer). However, once having created a program, a programmer usually continues to improve it. There are no strict program creating rules. Create a trading Expert Advisor.īefore starting to program a trading Expert Advisor, it is necessary to define general principles of a future program. This section dwells on the principles of creating a simple trading Expert Advisor.
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |