Questions from Beginners MQL5 MT5 MetaTrader 5 - page 1124
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
Thanks,ndd is what?
Didn't follow, didn't replace everything. It's a macro.
Didn't keep track, didn't replace everything. It's a macro.
Please advise how to find out the last open position by magic number, maybe there is a function that returns the lot value of the last open position? I need it on mql5
There are several ways, so make it clear: is the trading account type hedge or netting, in which case do you need to know about the position: does the advisor open a position and does he need to know the parameters of his last open position?
Can you please tell me how to know the last open position by magic number, maybe there is a function that returns the lot value of the last open position? I need it on mql5
Example #1:
In OnTradeTransaction we catch a transaction with the type
TRADE_TRANSACTION_DEAL_ADD
Add the transaction to the history. This is done as a result of order execution or account balance transactions.
make sure it is our symbol and our magic:
if(deal_symbol==m_symbol.Name() && deal_magic==InpMagic)
Look for a BUY or SELL deal:
make sure that this trade is
DEAL_ENTRY_IN.
Market entry
Please advise how to find out the last position opened by magic number, maybe there is a function that returns the lot value of the last position opened? I need it on mql5
Option #2 - bypass the item list:
Go through the list of positions
look for the longest position open time in milliseconds
TimeMsc
Getsthe time of opening a position in milliseconds since 01.01.1970
if(m_position.TimeMsc()>last_time) { last_time=m_position.TimeMsc(); last_volume=m_position.Volume(); }
check - if the volume is higher than "0.0" - the position has been found:
For loss size, here is the function
Simply replace SL with TP
Example #1:
In OnTradeTransaction we catch a transaction with the type
TRADE_TRANSACTION_DEAL_ADD
Add the transaction to the history. This is done as a result of order execution or account balance transactions.
make sure it is our symbol and our magic:
look at whether it is a BUY or SELL trade:
make sure that this trade is
DEAL_ENTRY_IN.
entering the market
Apparently, this is double risk as a percentage of available funds. How do I set a specific amount of profit in money, e.g. 1.5?
Well, here's the line
Just put a number instead of a formula and ...How to convert, mouse position, during, but without throwing?
ChartTimeOnDropped