A bug in the OrderSend() function ? - page 4

 
hoz:
Well, yes, I do it in visual mode and look... And what it may not show correctly? After all, if you roll the TS on the watch or on H4 on a demo, it may overwinter for a few years :) ..... :) That's a bummer.

Well, the visualizer seems to show, but may miss something, in general, you can not trust it or not for all algorithms it accurately paints a picture of what is happening, it is better to observe in parallel on the demo, the grail is not born in a day ...

P.S. I'm writing all my ideas mainly for H1 but it's faster on the demo than solving tester's puzzles ...

 
hoz:

Already done. I also increased the indent variable a little bit and there we go.... I guess it's not always possible to tell by eye.

I wonder, what else does lastBarTime variable globalization have effect on, besides performance? Its type is static, which means that the variable stores its value during the entire life of the program...

There is one more interesting thing. If I still use the wand in various functions, was it right that I declared it at once in the start? Or it's not very reasonable to get values on every tick, because of resource consumption?


Alocal variable is a variable declared within a function. The scope of local variables is the body of the function, in which this variable is declared. A local variable can be initialized by a constant or expression, corresponding to its type.

A global variable is a variable declared outside all functions. The scope of global variables is the entire program. A global variable is not localized at any level. A global variable can be initialized only by a constant corresponding to its type (but not by an expression). Global variables are initialized once before special functions are executed.

If control in a program is inside a function, the values of local variables declared in another function are not available. The value of any global variable is available from any special and user function.

 
It's simpler than that. Static does not work in MQL4.
 
tara:
It's simpler than that. Static does not work in MQL4.

How long ago?
 
Sorry, it's not working at all. From the C of the beginning:(
 
tara:
Sorry, it's not working at all. From the C of the beginning:(
Any other programmers who can confirm this? One vote won't be enough.
 
tara:
It's simpler than that. Static does not work in MQL4.
How many codes written by professionals I've seen, and their static is often present. But you said that it does not work. What should I believe now? :(
 
hoz:
How many codes have I seen written by professionals, and they often have static. And you say it doesn't work. Who's to believe now? :(
You can't trust anyone.
 
tara:
Sorry, not working at all. From the C of the beginning:(

Personally, I've never encountered a statik that didn't work.

here's an example of an expert, you want to check it on a graph:

//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
   return(0);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
   static int cc=20;
   Print("cc = ",cc);
   cc++;
   
   return(0);
  }
 

The static works 100%. Here's the test:

int start()
  {
   static int i=0;
   while(i<3) {Print("K=",test());i++;}
   return(0);
  }
int test()
 {
  static int k=0;
  k++;
  return(k);
 }

And the results:

Static

Reason: