Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 372
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
Maxim, good day! Thanks for the variant, mine is almost the same, it also works, butAlekseu Fedotov suggested it and I wrote that there is an idea how to correct it?
If you don't mind redrawing (for example, you will recalculate it anyway, like now) - return from the OnCalculate function the place from which you want to recalculate it, in your case - the bar of the previous hour.
return rates_total-iBarShift(_Symbol,_Period,time[0]-TimeMinute(time[0])*60-TimeSeconds(time[0])-1 ); // about this, written "out of hand and not checked", to demonstrate the approach.
Bottom old, top new
The chart timeframe used is the one where the indicator - zeros stand
Can you please tell me how to reset the buffer when a new bar appears, but so that the previous data is not erased and is displayed on the chart. For some reason I can't reset the buffer to zero and whena new barappears, new data is overlaid on the old accumulated data. What am I wrong in my code? Thanks for the clarification.
When a new bar appears, the terminal adds new null elements to the buffers. In lines 3 ... ... 6 are exactly zeroed. All other elements are preserved
Why do the bars in the histogram grow immediately with the appearance of a new bar and continue to grow, but the next bar grows when the next bar appears and the previous one does?
Why do the bars in the histogram immediately after the appearance of a new bar have the growth of the previous bar, and then continue to grow, and the next bar has, at the appearance of the next bar, the growth of the previous one?
Bottom old, top new
The timeframe of the chart used is the one where the indicator - zeros stand
Greetings all, can't figure it out myself,
This makes it easier to find the error:
But I think before OrderSelect() it should be tiket_order=(correct_ticket)Hello all, I can not understand myself, some sort of poltergeist, although I may be inattentiveIn such a combination in the strategy tester, the error incorrect ticket (OrderModify()), and on the n-th order, not on the first or second, I do not know what to blame, maybe in OrderModify(), or OrderSelect ticket is passed by reference and it somehow changes?