Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 567
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
It's still kicking out.
you have[i+1], you need to check +2 more
In general, you should do something like this
Because the check is fundamentally wrong. Let's say Bars returns 1000 and cb also returns 1000. Then in the loop on the first iteration i gets the value 1000. In the first condition of the loop body:
two exits outside the array at once : accessing a bar with index 1000 and one with index 1001. For if the chart has 1000 bars, the first bar has index 0 and the last one has index 999.
Further on through the loop body there is a reference to the even more distant bars in the history:
All of this needs to be taken into account in the initial check.
For a proper check, see the example of the IndicatorCounted() function in MQL4 Reference. Only now, IndicatorCounted() should be replaced by sharing rates_total (this is Bars) and prev_calculated (this is IndicatorCounted()).
Thanks, Found it,
What should I compare it to? in the example it starts withlimit
limit=Bars-counted_bars;
What should i compare this "cb" with?
Thank you, Found it,
What do I compare it to? In the example, it starts withlimit.
what should i compare this "cb" with?
If you want to limit the number of bars on which the indicator data is displayed, you'd better do it this way:
Use as follows:
The total value is the index of the deepest bar in the history, which can be accessed based on the values of the indicator's settings.you have[i+1], you need to check +2 more
In general, you should do something like this
I did it that way, but it says ...array out of range in 'HiLo.mq4' (122,15)
what should I check by +2 more?
If you want to limit the number of bars on which the indicator data is displayed, it is better to do so:
Use as follows:
The value of total is the index of the deepest bar in the history, which can be called based on the values of the indicator settings.The compiler swears.
'InitializeBuffers' - function not defined HiLo.mq4 161 7
The compiler complains about
'InitializeBuffers' - function not defined HiLo.mq4 161 7
I wrote in the comment that this is a function that should initialize all the indicator buffers. It is a custom function. I have it like this:
You will have a different one as the buffers are different. In case the indicator works with graphical objects, you need to remove all of them here, because the initial drawing of the readings is to be done.
I wrote in the comment that this is the function that should initialise all the indicator buffers. It is a custom function. I have it like this:
You will have a different one, as the buffers are different. In case the indicatorworks with graphical objects, you have to delete all of them here, as the initial drawing of the readings is to be done.
Thanks, but nothing has changed ...array out of range in 'HiLo.mq4' (130,15)
. What is wrong?
Thank you, but nothing has changed. What's wrong?
Of course, the result will not change. After all, you haven't removed the main reason (the cb loop). This loop is organized incorrectly:
It should be removed and replaced with the limit loop. In both places.
Of course, the result will not change. After all, you haven't removed the main reason (the cb loop). This loop is organized incorrectly:
It should be removed and replaced with the limit loop. In both places.
There are 3 such loops. I replaced them and the terminal hung.
I did it, it doesn't freeze or crash, but there are 3 values in the first buffer (fx2): price, 0.0 and 164874239.218492.
If value sell_1_B!=EMPTY_VALUE and sell_1_B!=0 it does not mean there is a price.
How do I get a signal?