![]() After the execution of the program head part, init() will be started for execution. That is why it cannot be declared inside a function, it must be declared outside the function's description, that is in the head part as a result, the value of the global variable Count will be available from any program part.)Ģ. It should be noted here that the algorithm used in the previous example program requires declaration of the variable Count as global. (Local and global variables are analyzed in detail in Types of variables. In this line,the global variable Count is declared and initialized with a value of zero. The program execution starts from the head part. At the moment when a program is attached to a chart, the client terminal passes control to the program, and as a result, the program starts its execution. In accordance with program execution rules (see Program structure and Special functions), this EA will work the following way:ġ. deinit()Īlert ( "Function deinit() triggered at deinitialization") // Alert return // Exit deinit() start()Ĭount++ // Tick counter Alert( "New tick ",Count, " Price = ",Price) // Alert return // Exit start() init()Īlert ( "Function init() triggered at start") // Alert return // Exit init() - int Count= 0 // Global variable //- int init() // Spec. - // simple.mq4 // To be used as an example in MQL4 book.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |