Dear all, I just started learning MQL4 language to support my trades but I have a little question on how to run this very very simple script:
The purpose of the script is to place a market order and set SL and TP.
My problem is that I attached it to a chart and it starter sending orders, it didn't stop after firtst run and it executes 12 order on my real account before I stopped it!!!
How can I run it only once?
Thank you in advance,
Probably you compiled it as an Expert Advisor. All the scripts run only once. It only can open several orders if you send them inside a loop, but in that code there's no any loop. Therefore, the only option is that you compiled it as an Expert.
Please go to MetaEditor, and click on New, and then choose Script. Then copy that code and click on Compile. It should appear at Scripts folder inside MT4 Explorer.
Then, attach it to a chart.
Thank you very very much!
The first time I opened the file and compiled directly.
Now I created a NEW SCRIPT file, cut & paste code inside it, then compiled and it works as expected!