![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
The memory class of "static" defines a static variable. The specifier "static" is declared before a data type.
Example:
Static variables are stored in the permanent memory, their values do not get lost when the function is exited. Any variables in a block, except for formal parameters of the function, can be defined as static. The static variable can be initialized by a constant of the corresponded type, unlike a simple local variable which can be initialized by any expression. If there is no explicit initialization, the static variable is initialized with zero. Static variables are initialized only once before calling of the "init()" function, that is at exit from the function inside which the static variable is declared, the value of this variable not getting lost.
change
limit=Bars-counted_bars;
to:
It’s funny. Some days ago I was checking this indicator again and I realize that it was working well only for the past. When I plot it in real time data the result is irregular and incorrect in the present data.
All already changed the “static” variable like zzuegg suggested, I also tried to transform the Upshift variable to Buffer.
When I did such modifications I only got the reverse result – Past calculus wrong, present calculus correct.
I’m a little bit confused at this moment. Anyone knows what is happening?