Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 149

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
hoz:
It's the same as:
I can't figure out how to implement the logic with the least amount of effort.
If(...) set a stop order;
If(the order's lifetime>time) withdraw the order, and if(...) set a new order;
The difficulty is that there may be several positions which are already open, and how do we fight them all? What is the easiest way?
Thank you!
This is passing the parameter by reference.
No one is stopping you from calling init() where you want it, according to your condition.
Then again we must solve the issue of control of this moment. After all, in order to know "where it should be", you need to know it. And you can find it out through a flag, for example. It turns out, for example, that flag will be in global:
gInitTrue = false;
In init(), assign a value at the very end of the function:
gInitTrue = true;
And we will control the start at the very beginning of the function:
Am I understanding this correctly? Or is there something else to consider?But more to the point? It's been discussed that INIT can fail in case of, for example, disconnects or other similar situations. Because it does not re-initialise the data itself afterwards, in case of contingencies, and it only runs once! So, this is not quite a correct way of doing it.
how should the code be correctly written so that if the specified stop loss or take profit is less than the minimum stop, then make them equal and use the stops as the minimum stop. ?
Can you tell me a little code? Opened file.... Which function can be used to write a recording, save it and then close it...
https://docs.mql4.com/ru/files
Can you tell me a little code? Opened file.... What functions can be used to write a record, save it, and then close it...