Hi,
I am trying to write a Martingale type EA.
The problem I have is that I can't find the correct way to create a variable that gets a value at the beginning of the script (the order size) and then gets altered based on orders closing in a win or in a loss.
What I though it would be logical is to declare the variable in the init() section of the program, but if I do that, the script won't compile because it says that order_size is not initialized.
If I initialize and set the initial value for the variable in the start() section, what happens is that it is reset all the time and it places all the orders of the same size.
Any help would be appreciated! Thanks!
Regards,
Marius
GlobalVariableGet, GlobalVariableSet
with these functions, variable values are stored in a persistent way. The values are always available even when you exit from the terminal
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi,
I am trying to write a Martingale type EA.
The problem I have is that I can't find the correct way to create a variable that gets a value at the beginning of the script (the order size) and then gets altered based on orders closing in a win or in a loss.
What I though it would be logical is to declare the variable in the init() section of the program, but if I do that, the script won't compile because it says that order_size is not initialized.
If I initialize and set the initial value for the variable in the start() section, what happens is that it is reset all the time and it places all the orders of the same size.
Any help would be appreciated! Thanks!
Regards,
Marius