On the Internet, there are resources that publish any statistics on the stock market. Typically, this information shall be submitted as soon as finished figures and accompanying analytical information and conclusions. The benefits of such statements can be long debated, but you can try to get to the roots of analysts trying to compile their own statistics for a particular market.
To help in doing so, we will be able to MetaTrader'a experts. Many experts perceive MetaTrader'a as a tool that allows you to just write mechanical trading system - the program who can sell themselves, or to check on historical trading tactics. But if we look at the work of the experts on the other hand, it becomes clear that in the process of testing, where the expert runs on all available historical data, it can also serve to collect statistics on the market.
With the help of experts can be found, for example, the average volatility of a currency pair, so it is possible to collect data that will be talking about the average activity of the market: on weekdays, by month, by time of day. Yes There is even information about what the market wishes us to find out. Everything, even the most improbable such ideas (in the context of available data, of course) can be implemented with the help of experts from the trade terminal MetaTrader.
We propose to consider the example of an expert, it turns out the market activity for the day of the week.
A few comments about this expert:
Expert to assess the activity of the market takes the volume of transactions, it may not be always correct assessment - it all depends on the reporting tool. I think that in the FOREX market, it would be better not to take into account the amount of sold currency and the amount of ticks, ie, the number of transactions, but these data can be obtained only with a live trade. If we experience such a need, you should be, making the source code of the expert, some changes concerning the calculation of the amount of leave an expert in real-commerce for a long time.
It should be remembered that earlier this week in many foreign countries are not considered to be Monday and Tuesday, which is why our nominee variable "Monday" is set to "2".
Also, it must be noted that, if historical data is too much, then the variables that accumulate the total amount may be "up the". Let's try to figure out what this means and what it involves: in the computer memory for each variable, given a certain place. At the very beginning, when we created a variable, we clearly indicated that the variables with the suffix _activity we are going to store numbers with fractional part. To this end, in the initialization of variables, we identified not only the value of "0", and indicated a fractional part - "0.0". In MQL II to store numbers with fractional part of type double. Thus, for the storage of variables _activity in our program at compile time has been allocated a place. When this place is filled to capacity, the program can begin to give unexpected results. When writing a sustainable program, should be inserted in the code checks to achieve the maximum value of variables, but this code is omitted in order to facilitate the perception of an example. Moreover, the very large number, is stored in a variable of type double, to reach, indeed, very difficult.
The program also should be added to test for temporal instrument - agreed, it would be wrong to launch this week an expert on the charts, because they lack sufficient information on the day of the week for the correct algorithm.
And the last thing I would like to note - do not necessarily show the data obtained on the screen. If the program does not imply any final numbers but the data has to be periodically recorded in the record, they can be saved in a separate file. Or using discussed in previous issues of the magazine articles about the debugging methods (functions of print () and SetDebugMode ()) "discard" information in the so-called log-file.
Ability to gather statistics about the market is not limited to example, and we are confident that the reader will be able to find a lot of applications of the proposed options using expert MetaTrader'a.
Alexander Ivanov
No comments:
Post a Comment