In a recent post, see "ea runs on my broker but not on another", I posted my code for a program that automatically sets the stoploss given the lots opened on a trade and a predetermined risk level inputted to an extern variable. It would not run, so it seemed, on two different brokers. It turns out this was not the problem at all. The program runs beautifully for its purpose. A discussion was started that it might have to do with the decimal point used by the broker. It had nothing to do with that. The problem occurs because in the original code I tried to automatically generate the ticket for the existing trade. All of the problems are solved if I manually enter the ticket number at the beginning to an extern variable. Here is the code:
However, as suggested by others, I have tried to convert this to a script. I have never used a script before. I created a script template in the editor and copied the code above as follows:
But this script does not run when I invoke it. What an I doing wrong?

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
In a recent post, see "ea runs on my broker but not on another", I posted my code for a program that automatically sets the stoploss given the lots opened on a trade and a predetermined risk level inputted to an extern variable. It would not run, so it seemed, on two different brokers. It turns out this was not the problem at all. The program runs beautifully for its purpose. A discussion was started that it might have to do with the decimal point used by the broker. It had nothing to do with that. The problem occurs because in the original code I tried to automatically generate the ticket for the existing trade. All of the problems are solved if I manually enter the ticket number at the beginning to an extern variable. Here is the code:
However, as suggested by others, I have tried to convert this to a script. I have never used a script before. I created a script template in the editor and copied the code above as follows:
But this script does not run when I invoke it. What an I doing wrong?