[WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. - page 82

 
goldtrader >> :

A function returns only ONE value at all,

and the one described as void returns none, i.e. it returns nothing.

.

Alternatively, you can assign these values to global variables within a function.

Global - are they declared outside of special functions? Variable flag10 is declared at the beginning of the EA - along with external variables.

if (tiket!= -1) 
                  {  
          Order_Modifi_Sell ();
          taim_open = Taim0;
           flag10=0;
                  }     
              
         }
            return(taim_open,flag10);

So there is no need to send the flag10 specifically to the outside - it will get there anyway?

 
Figar0 >> :

All true. But there are solutions, "peasant" : modification in function/procedure of global variables of program, "civilized" : transfer of variables to function by reference.

Can you give me an example? Because I don't really understand it.

 
Figar0 >> :

All true. But there are solutions, "peasant" : modification in function/procedure of global variables of program, "civilized" : transfer of variables to function by reference.

In this thread imho it is better to start with "peasant" )

 
locol91 >> :

Global are those declared outside of special functions?

Outside any functions.

Usually they are declared right after external variables before init, deinit and start functions.

 
locol91 писал(а) >>

So there's no need to send flag10 outwards on purpose - it will get there anyway?

Yes. If it is not redeclared in the function again, the global variable will be modified.

 
int start()
{
   int A=1;
   func( A);
   Print( A); // Должно получиться 2:)

}

void func (int & var)
{
  var++;
}
Example of parameter transfer by reference, in this case it is not a variable that is transferred, but a link to the memory area where it is stored. You get full autonomy of the function without reference to the global variables of the program (you can easily transfer from one program to another), but the "peasant" variant also has the right to life at our level of programming:)
 
goldtrader >> :

Outside any functions.

Usually they are declared immediately after the external variables before the init, deinit and start functions.

One more question. What are the global variables that are declared from the terminal with F3? And thank you all for the clarification.

 
locol91 писал(а) >>

Then there is an additional question. What are the global variables that are declared from the terminal with the F3 key? And thank you all for the clarification.

You're in over your head).

There are 3 levels in total:

-global variables of the terminal, scope of all programs running in the terminal (this is called by F3)

-Global variables of the program (entire program, all its functions are visible)

-Local variables (scope of function where it is declared);

 
locol91 >> :

Then there is an additional question. What global variables are declared from the terminal by pressing F3? And thank you all for the clarifications.

These are the terminal's global variables.

They can be accessed by any expert, script that works in this terminal.

Not to be confused with the global variables of the script/advisor.

 
Figar0 >> :

You're in over your head.)

There are 3 levels in total:

-global variables of the terminal, scope of all programs running in the terminal (this is called by F3)

-Global variables of the program (entire program, all its functions are visible)

-Local variables (scope of function where it is declared);

Yeah, porridge! I'd even say pilaf :-) . But you still have to sort it all out.

Reason: