View previous topicGo downView next topic
VIP user
VIP user
Number of messages : 1454
Points : 3176
Date of Entry : 2014-06-26
Year : 37

Executable files in MQL4 (scripts, advisors, indicators)

on Tue May 12, 2015 9:21 pm
There are three types of independently executable files; each of them is carries out its own task. With the same reason, each of these types is located in its own directory; scripts are in the folder ….MetaTrader4expertsscripts, indicators in the folder ….MetaTrader4expertsindicators and advisors in the folder ….MetaTrader4experts, which consists of the folders ….scripts and ….indicators. This is made for the purpose to determine the file type on its location, because they have the same extension – *.mq4.

Each of these files executes only its own functions. In that way, only indicators are the easiest and economic way to display at chart different curves, but with the help of scripts and advisors the deals can be hold. Here we can make a small digression: it seems that the assertion about impossibility to draw from advisors and scripts can be denied – create and mark the graphic objects (vertical, level and trend lines (in the form of beam), icons of the different styles and colors) can be done from scripts and advisors. But if you change the time-frame of the chart – and everything should be started again, because the graphic objects have the time and price reference, and at another time-frame it will be needed to delete all objects and to draw new.

Indicators, scripts and advisors are also objects. The advisor, which will in its code request to one or several indicators can be attached at the chart, script is also not limited in the indicators calls (user or standard). The indicator, which is based on the meanings of another indicator and that by-turn calls the other indicator for calculation, can be also attached. All these things in terminals of the object-oriented programming (OOP) can be characterized in this way. An object-chart contains an object-advisor, which encloses objects-indicators. Let display this presentation in two ways, standard and in the form of diagram. Open the chart EURUSD, time-frame H1. Attach to the chart the advisor MACD Sample from the standard delivery of MetaTrader4, enable it to trade. Also attach the standard indicator Stochastic Oscillator (5, 5, 5), the standard indicator Fractals and the user indicator Zigzag (also from the standard delivery of MetaTrader4). We will have the picture given below:

We have three indicators (two standard and one user); each of them works independently from the other. Moreover, the advisor is executed. The work of each requires the computer time (processor’s resources) and layout in the main memory (storage budgets). And let have a look on this from the other side: chart EURUSD, H1 represents itself the object-window of the chart, in which three more objects-indicators and one object-expert are embedded (these objects are called subclasses). The object-chart gets resources of the computer and distributes it between its subclasses. If we look at the expert’s code, then we can see that there is the call of standard indicator MACD with option settings 12, 26, 9. The calling from advisor to indicator creates in the expert one more indicator MACD (12, 29, 9), which we do not see at chart, but, nevertheless, this indicator object also exists.

Moreover, there are indicators, which also in their calculations request to the setting of other indicators (standard or user – does not matter). Besides the objects, which we see at chart, other objects can exist – invisible for us. But these objects also require the computer’s resources (processor and main storage). In such way, actually we have not four objects (three indicators and one advisor), but five – three indicators and one advisor, containing one indicator.

At fact, there are often more than three indicators at chart, and advisors are applied, which use callings of more than one indicator and all these objects deploy resources of the terminal (MetaTrader4). Besides, at indicator and advisor’s testing in one terminal there are 10 or more charts, each of them contains indicators and advisor. That is why the correct writing of executable files and economical work algorithm of advisors, scripts and indicators have high priority. Finally, I will show the screenshort of my terminal on weekends (the market does not work and quotations do not arrive). There are opened 19 window-charts, each consist of 4 indicators.

Processor resources are almost not used, but the memory took more than 70 megabytes for the terminal work.

View previous topicBack to topView next topic
Permissions in this forum:
You cannot reply to topics in this forum