Questions from Beginners MQL4 MT4 MetaTrader 4 - page 212
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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 is even better to make a structure
don't forget to zero out the elements before you start using them
and then increase the count where needed
then compare
You have now made a loop around the previous 10 candles on each new cand le. This is not rational. You should always get rid of unnecessary cycles by remembering the results of the calculations of the previous values. In your case, when a new candle arrives, just increase the count when the condition is fulfilled, and if the condition is not fulfilled, then subtract it. And check if there is no excess. Your cycle for 10 elements is not needed, only the main one.Aleksei, tried to do it, but it still doesn't work right:
does not add one to the count.up
You need to remove from the loop
because at each iteration you are zeroing out the previous values. Write it before the loop.
You need to remove from the loop
because at each iteration you are zeroing out the previous values. Write it before the loop
Thanks a lot now it works!
However, it's weird, I was doing the same thing without the structure, but just with normal values like
and it would start plusing every tick))
The structure will also be ticking. To work only at the start of a new candle, the time of that candle must be tracked
What is the easiest way to get rid of the year (2020) and minutes in the line? TimeToStr has no other output formats yet?
Good afternoon!
What is the easiest way to get rid of the year (2020) and minutes in the line? TimeToStr has no other output formats yet?
tm=(string)Hour();
Thank you!
Can you give me a hint? I have user-defined functions in separate .mqh files and I have them written through #include. I call them at start and when start goes to one function, the program needs to call another .mqh file (for example, to get a value of order volume) and that doesn't happen. If I write everything in one sheet, it works or if I write the formula to calculate the lot directly in the order opening parameters. I looked through the MQL4 lessons and read the program documentation but did not find anything. I don't really understand why one .mqh function cannot interact with another .mqh function within calculations. Or, should we make the program return to start if we faced such a necessity - it would return the result to start and then start with this calculation would go back to the function opening an .mqh order? This is something rubbish... Or maybe we should somehow declare all of the existing functions in a different way so that they interact together? Thanks
Refer to functions, not files, from functions, if you have connected via an inline. If I understand you correctly, of course.