Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1577
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
OnTradeTransaction will be triggered when any stop order on the server is triggered.
How about through?
no
there is a very good example of OnTradeTransaction in the docs
But the function has to be prescribed?
If you add a function specifically for this purpose, it would be handy. Why not...?
But there is no need to track stop crossings in it, because the server will do that and send a signal toOnTradeTransaction.
If you add a function specifically for this purpose, it would be handy. Why not...?
But it is not necessary to trace the crossing of stops in it, because it will be done by the server and it will send a signal toOnTradeTransaction.
Misha, I am not really good at mql5, I am just at the beginning,
but I think we should first write something like.
If I'm wrong, I would be glad to correct it
Misha, I'm not very good at mql5, I'm just starting to get into it,
but I think you should first write something like...
If I'm wrong, I'd be glad to correct you.
OnTradeTransaction is such an event handler. Therefore, all processing code should be in it. Or processing function if you want. See the description in the documentation at the link.
Are we talking about the same thing?
How about this? I found one from mql4
not in mql5
Are we talking about the same thing?
No. You are going to call the handler in the condition (if). But you don't need to call it anywhere. Simply write the processing code inOnTradeTransaction and that is all. Look at parameters that are passed toOnTradeTransaction when a stop is triggered.
Although, you must know what events and event handlers are, what events there are in MQL. Then you will begin to understand it all.
Here is a link to what Event Hand lers arehttps://www.mql5.com/ru/docs/basis/function/events#ontradetransaction.
They are often just called event handlers to avoid confusion. For example, as you have confusedOnTradeTransaction with an ordinary function that is called in if.
How about this? I found one from mql4
Try this (I haven't tested it)