Tuesday, February 24, 2009

Writing Experts for MetaTrader. Questions & Answers


13.1. Question - Answer

"In the process of writing experts often necessary to save the variables in the current moment, in a separate file. In describing the language of these points are not very clearly described. Bolshaya please tell about the possibility of retaining more detail."

Working with files is a separate topic of the lesson, talk about it in the next release. All the same I want something to say on this issue. Declaring variables in a section var, we ask them first value (the value of variables in the very first time you run an expert). Once the expert is performed (this is usually less than 1 second, with an average nominee, and the average car), there is a way out of an expert, but the values of all variables remain. At the next prevention expert runs again, but the variables may have had different values than in parentheses after the name of a variable in a section var.

"How can I make a custom indicator of the 3 lines?"

At this point in the MT can create indicators with only two arrays of data, ie each indicator may have a maximum of two lines. In fact, the problem of acute only when the indicator of the more than two lines should have been on the same scale under the schedule of prices. If the indicator should be located in one window with the prices, then the easiest way is detailed algorithm for the more custom indicators.

"Is there a possibility to separate the MT in open positions of the hands positions open expert in one instrument."

No such special opportunities provided by the MT. It is possible to distinguish the position of, for example, the size of the position (number of lots) or in the footsteps. By trelingu transaction can not be identified. If the roots of the opportunity to test several experts on the same account, then the most convenient and simplest solution is to open multiple demo accounts and run multiple MT.

1. The possibility of an expert "monitor" the market, ie, alternately test for the opening of trading on a given list of instruments. (For example:: EUR/USDM30, EUR/USDH1, USD/CHFM30, GBP/USDH1). If the condition of the opening is done, then open a position and to work further with it. After closing the position once again turn to the "monitoring".
2.To the same as in point 1, just after the opening position on odomu of the tools and work on it, continue to "monitor", and in fulfilling the conditions for the opening of another instrument, the open position and to continue parallel processing 2 position. "

For monitoring, each instrument must be perekreplyat expert. Each of them can set the condition at the beginning of the code.

If TotalTrades> 0 then exit;

The idea is that if for any pair will open stance, no longer the expert will not be able to enter the market. Is worth to remember that in order to expert, for example, EUR/USDM30 and EUR/USDH1 this one character, but different schedules, with all the consequences.

"I have a question. I can not enter on the F4 key in the editor in MT to write an expert. I downloaded MT from the internet. If you can explain ..."

The problem I had before, now that there is not any, it is a bug MT. Restarting the machine helps to perfect.

"Why are not visible outside of the indicator variables, like I wrote it right."

Do not forget that in the experts section external variables that defines, and displays it in user inputs and does not need to confuse them.

"Why not open the expert position if the condition is now?"

The functions SetOrder the fourth parameter is the maximum allowable proskalzavanie at the opening of the transaction, it appears you are not very high, and the market at the time the test was rapid.

"What if I want to attach to one instrument, several experts?"

You can open multiple charts with a single instrument, and each time to attach several different experts.

"Why are MPs from the user's own indicator of manufacturing is very much hindered?"

MT has such a problem to solve the indicator is not drawn to all stories and quotes, for example, for the last 500 bars. The number of bars for drawing the indicator can be done in a custom variable.

"Is it possible to somehow add to the MT some additional technical tools such as Fibonacci lines?"

This can be done only by the developers of MT. I think the next issue will be practical, be sure to write if you have questions or suggestions.




On the questions of the readers responded:
Halhalyan Arthur
artur@fxtest.ru

No comments: