[Archive!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Couldn't go anywhere without you - 2. - page 34
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Thanks again drknn and granit77! !!!! #MTF_MovingAverage.mq4 - if this is an EA, it is not put on the chart for some reason... :-(,
The question is exactly about the plotting...
I need to draw M5 (144) on M1 chart. i.e. it turns out I need M1 (144*5=720), right?
But what should I do if the following TFs do not coincide by their multiplicity? - I would like to automatically calculate the MA when changing TF. Is there such a function for determining the TF?
You should understand that any function that is in a programming language is built according to some principles, or by some formula. If you cannot find what you need in the language, but your need is described by a formula, it is easier to make the code yourself than to look for a ready-made one.
Now let's look at your problem. You need automatic determination of the averaging period of the moving average depending on the timeframe. You can get the value of timeframe by means of the language. And you can calculate the period of moving average, moreover, you already have a calculation formula. Using iMA() we can get values of moving average. Your task can be solved by the code.
I gave you the formula and its logic reasoning. What more do you need? You have a complete set of tools and materials at your fingertips, so you can apply your hands to manufacture your product. You just need to try and try until you get it right. Nobody is going to do the job for you.
It can easily be done if needed.
Please, if possible, give at least a hint... to a built-in function, if there is one!
And "It is possible to get the value of the timeframe by means of the language. " Can't find...., maybe evening cretinism?
Don't mind me asking...!!!
Please, if possible, give at least a hint... to a built-in function, if there is one!
There are no built-in functions, you just need to write your own wizard with calculation period depending on the timeframe
I made an indicator (let's call it ind 1) using iCustom function, i.e. with a link to another custom indicator (ind 2). What is the question, if I want to use ind 1 value in an Expert Advisor, also via iCustom, will it work? Or it is not a daisy chain, I should make a link from EA to the original indicator, ind 2? Thank you
This function retrieves the value of the indicator buffer. If the indicator has it, you can extract its values using iCustom(). If the indicator doesn't have any indicator buffer (it happens as well), iCustom() will not help. The question, how it can be done without any buffers? It is very simple - there are indicators that follow their own principles of price changes and introduce objects on the chart, for example, labels with automatically generated content.
This function retrieves the value of the specified indicator buffer. If the indicator has it, you may use iCustom() to extract its values. If the indicator doesn't have any indicator buffer (it also happens), iCustom() will not help. The question, how it can be done without any buffers? There are indicators that track price changes on their own principles and display objects on the chart, for example, labels with automatically generated content.
Ind 1 has a buffer, yes. But its value is calculated through the reference to another indicator, ind 2. It means that Expert Advisor wants to take the value of Ind 1 - but it in its turn is calculated via reference to Ind 2. Thus, we get a chain: EA - request of ind 1 buffer value - request of ind 2 buffer value - ind 2 returns value to ind 1 - ind 1 returns value to EA. Will this chain work?
Yes. No problem.
Programmers in general do not trust anyone (I'm not a programmer :)) ), so when it comes to the use of indicators they are divided into dull-pointed and sharp-pointed.
Some believe that the algorithms transferred directly from the indicator to the Expert Advisor are the fastest.
Others say that the difference is not so significant as to complicate the code. And sometimes, the introduction of calculations into the Expert Advisor even slows down the testing.
There are experts who are very skillful in optimizing the speed of the code, and there are not so many of them, even among the professionals.
Read articles in the Tester and other sections, it will be interesting.
But it's more convenient for the simple country boy to keep everything in the indicator and send signals to the Expert Advisor from there. This allows to easily modify the system, change and rewrite indicators, use several indicators simultaneously, etc. It is noteworthy that one of the most experienced forum programmers is of the same opinion.