Questions from Beginners MQL5 MT5 MetaTrader 5 - page 743

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
Hello all! Question about MQL5.
I would like to insert comments into the function of closing a position in a ticket.
So far I've used CTrade class, but it does not provide such an opportunity.
I.e. I need to use OrderSend, right?
Here I don't understand: https://www.mql5.com/ru/docs/constants/tradingconstants/enum_trade_request_actions#trade_action_deal in the example the OnStart function is written. Or may I write everything in custom function and call it when necessary?
Is it necessary to add something to OnInit?
And won't there be conflicts if I write the closing through OrderSend and leave opening and modifications on the basis of CTrade class?
Thank you!
Roughly speaking - read carefully what I wrote to you and drop the infinite loop from your code.
Are you sure that putting the Expert Advisor into an infinite loop is the right solution?
Firstly, this is not a solution, but an example to demonstrate the essence of what I am talking about.
Secondly, it's not an infinite loop, it will correctly and safely terminate when the program ends.
And thirdly, you're writing to me about solving a completely different thing, for which I can think of a million ways.
So you consider my loop to be a stumbling block to my situation? Really?
Anyway, I get it. I had a bad trip into this thread...
But thanks anyway!
Firstly, this is not a solution, but an example to show the essence of what I am talking about.
Secondly, it's not an infinite loop, it will correctly and safely terminate when the program ends.
And thirdly, you're writing me about solving a completely different thing, for which I can think of a million ways.
So you consider my loop to be a stumbling block to my situation? Really?
Anyway, I get it. I had a bad trip into this thread...
But thanks anyway!
At the end of the program, yes, it will be interrupted.
Make some really heavy calculation then, and try to interrupt it when the settings window is called.
I looked at how your code works - it doesn't respond to a change of variable in settings - it is prevented by infinite loop, which can only be interrupted by removing the EA, and it will not start again - you deleted it from the chart...
Try to keep track of the heavy calculation via timer. Although I'm not sure if the timer will be called at the moment of calculation.
But in any case, looping to emulate a long calculation is not a good solution.
Hello. Can you please tell me how to set an array in the input parameters of a function?
Pass an array to a function?
It goes something like this:
Well ... variations on the theme ...
When you terminate the program, yes, it will.
Then make some really heavy calculation and try to interrupt it when the settings window is called.
I looked how your code works - it doesn't react to variable changes in settings - it is not allowed to do so by infinite loop, which can only be interrupted by removing EA, and it will not start again - you deleted it from the chart...
Try tracking a heavy calculation with a timer. I'm not sure if the timer will be called at the time of the calculation though.
But in any case, looping to emulate a long calculation is not a good solution.
Thanks!
Understood. But unfortunately there is a reasonable need.
But in any case, looping to emulate a long calculation is not a good solution.
There are situations, when for example it is necessary to write to a big file or read from a big file or all together. If you stretch your imagination, you can get a lot of batshit crazy, and the pain is squared when you implement it :)
I find it strange, that the possibility to trace an interrupt with _StopFlag is there, but there is no change of input parameters :(
hello, i have a question. is it possible to change the angle of the comment on the chart?????
No.
Unless you create a graphic label OBJ_LABEL yourself and change its property
OBJPROP_ANGLE
using the function:ObjectSetDouble
Guys, help me figure out the indicator