Questions from Beginners MQL5 MT5 MetaTrader 5 - page 1469
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
For example MA5, average of 5 bars, set to display 100 bars. Then the indicator will calculate from the 104th to the 100th bar and will start drawing the line from the 100th bar. Then rates_total=5, or 100, or 104?
So the calculation will be done on the last 100 bars.
In essence rates_total and Bars() are the same thing, onlyBars() is a function, so calling it will cost more in terms of execution time than reading the value of the rates_total variable.
Thank you, that's very clear.
What do you think I wrote wrong? Justify it, please.
What is the limit and where the loop will come from in my and your example.
Well, then Buffer0 should be indexed as in the time series ArraySetAsSeries(Buffer0,true); otherwise the example is not clear.
In general, it's like this. I think that it is not very correct to calculate indicators from the zero bar to the past.
I always calculate them from the past to the present. Here, let's draw a line on Close:
Specifying the number of bars to be counted:
Specifying the number of bars to be counted:
Thank you. That's a great detailed answer!
It goes like this. I think it is not very correct to calculate indicators from the zero bar back in time.
You are confusing beginners again)
In MQL5 indicators, until you reverse the indexing, the zero bar is the past.
P.S. Artem is right again. I used the wrong term, instead of "zero bar" I should have written "zero index".
Thank you. That's a great detailed answer!
You're confusing the newbies again)
In MQL5 indicators , until you reverse the indexing, the zero bar is the past.
I think I gave an exhaustive answer. I attached two indicators that are slightly different. A newcomer who has seen the meaning will grow into a normal old-timer, and then he will give hints himself. And who will be confused - well, it means "what is it necessary?".
I have all buffers, their indexing, deployed. And the zero bar is on the chart. In the indicator, in its drawn buffer (and in the calculated one too) there can be only a zero array index. I prefer that the zero bar on the chart coincides with the zero index of the indicator buffer array - so that beginners do not get confused.
I tried to describe the code, I hope it is correct. Maybe it will help someone else too, if it is correct.
I really dislike the rollover of buffer indexing. That's why I decided to show an alternative variant of the indicator
Good afternoon!
Could you please tell me how to copy daily prices from the future in the strategy tester.
Let's say the robot finished its work on day D. I need to download daily prices for days D+1, D+2, ..., D+60 (of course, all these days are in the past).
I would like to use something like:
MqlRates DayRate[]; // Will contain prices, volumes and spread for each daily bar
ArraySetAsSeries(DayRate,true);
CopyRates(_Symbol,PERIOD_D1,60,60,DayRate); // Get historical monthly data for 60 days in the future
Regards, Alexander