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
I want to put a stock (futures) into MT5 to test mine, how?
No way. look for a brokerage house with this futures
%))) There is no DC with this fuchs))) It has to be glued together...
It's a pity, it's a pity, and it all started so beautifully...
Greetings all!
I am trying to implement two functions in my EA, the first defines profit of the last trade, the second defines lot of the last trade.
I searched through this site from A to Z and made several functions, following the examples in articles and other EAs, but no result - both functions always return 0.00.
Here seems to me to be the closest to the correct variant but the result is always 0:
I try to get the lot size in the same way:
And nothing works, the values are always zero.
I myself have just started migration from mql4 to mql5. Implementation of such functions in mql4 was not very difficult, but here is a deadlock.
Please advise me a real, working solution.
...
Please suggest a real, working solution.
Use HistoryDealGetTicket() and HistoryDealsTotal().
And do the validation:
tol64 thank you very much! Everything is working.
Here is a 100% working solution - the function returns the profit of the last closed position in terminal history:
By analogy we get the lot size of the last trade:
tol64 thank you very much! It's all working.
...
If you also press Ctrl+ in the editor, you will get neatly formatted code. This is especially important before uploading the example to the forum (better readability). ))
Good day! I have recently started to learn MQL5. I have a problem with position closing. In code: if(!m_Trade.PositionClose(_Symbol,100))//--- close position by current symbol. The result is that the position is reversed! I would be very grateful for a hint, how can I close a position?
EA log after the bar has closed below the stop level. Long position = 1 lot, short position = 1 lot)