Questions from Beginners MQL5 MT5 MetaTrader 5 - page 1566
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
Good day!
Thank you very much for your reply!
Here is the code
int pos = PositionsTotal();
double swap = 0.0,
profit = 0.0;
for(int i = 0; i < pos; i++)
{
if(PositionGetSymbol(i) == _Symbol &&(PositionGetInteger(POSITION_MAGIC) == InpMagic))
{
PositionGetDouble(POSITION_PROFIT, profit);
ResetLastError();
if(!PositionGetDouble(POSITION_SWAP, swap))
{ {
Print(__FUNCTION__,"....ERROR swap. ",GetLastError());
return;
}
}
}
....and alas, it does not output swap and does not enter an error.
...profit outputs.
maybe it is connected with the data of the broker, ...rannforex , if anything ....
oops...
rookie mistake...when calculating in OnTick - did not count, put it in a separate function - it counts....
thanks again!
Help me understand the logic of MT5. I select orders in the history:
I get:
GR 0 20:16:50.551 HAVAL (XAUUSD,M5) total orders in history19
DI 0 20:16:50.551 HAVAL (XAUUSD,M5) #ticket 1225250047 (non-string passed) 0.1 XAUUSD at 0 was set up at 2024.10.08 19:19 => done at 2024.10.08 19:19, pos ID=1225250047
HR 0 20:16:50.551 HAVAL (XAUUSD,M5) #ticket 1225250049 (non-string passed) 0.1 XAUUSD at 0 was set up at 2024.10.08 19:19 => done at 2024.10.08 19:19, pos ID=1225250049
NL 0 20:16:50.551 HAVAL (XAUUSD,M5) #ticket 1225250054 (non-string passed) 0.1 XAUUSD at 0 was set up at 2024.10.08 19:19 => done at 2024.10.08 19:19, pos ID=1225250047
FI 0 20:16:50.551 HAVAL (XAUUSD,M5) #ticket 1225250146 (non-string passed) 0.1 XAUUSD at 0 was set up at 2024.10.08 19:21 => done at 2024.10.08 19:21, pos ID=1225250049
DR 0 20:16:50.551 HAVAL (XAUUSD,M5) #ticket 1225250188 (non-string passed) 0.1 XAUUSD at 0 was set up at 2024.10.08 19:23 => done at 2024.10.08 19:23, pos ID=1225250188
HL 0 20:16:50.551 HAVAL (XAUUSD,M5) #ticket 1225250221 (non-string passed) 0.01 XAUUSD at 0 was set up at 2024.10.08 19:25 => done at 2024.10.08 19:25, pos ID=1225250221
RK 0 20:16:50.552 HAVAL (XAUUSD,M5) #ticket 1225250237 (non-string passed) 0.01 XAUUSD at 2614.83 was set up at 2024.10.08 19:26 => done at 2024.10.08 19:26, pos ID=1225250221
QP 0 20:16:50.552 HAVAL (XAUUSD,M5) #ticket 1225250806 (non-string passed) 0.01 XAUUSD at 0 was set up at 2024.10.08 19:35 => done at 2024.10.08 19:35, pos ID=1225250806
JO 0 20:16:50.552 HAVAL (XAUUSD,M5) #ticket 1225251596 (non-string passed) 0.02 XAUUSD at 0 was set up at 2024.10.08 19:50 => done at 2024.10.08 19:50, pos ID=1225251596
OD 0 20:16:50.552 HAVAL (XAUUSD,M5) #ticket 1225252808 (non-string passed) 0.02 XAUUSD at 2610.16 was set up at 2024.10.08 19:56 => done at 2024.10.08 19:56, pos ID=1225251596
RS 0 20:16:50.552 HAVAL (XAUUSD,M5) #ticket 1225252956 (non-string passed) 0.02 XAUUSD at 0 was set up at 2024.10.08 20:00 => done at 2024.10.08 20:00, pos ID=1225252956
CN 0 20:16:50.552 HAVAL (XAUUSD,M5) #ticket 1225253906 (non-string passed) 0.03 XAUUSD at 0 was set up at 2024.10.08 20:05 => done at 2024.10.08 20:05, pos ID=1225253906
JE 0 20:16:50.552 HAVAL (XAUUSD,M5) #ticket 1225254139 (non-string passed) 0.03 XAUUSD at 2607.03 was set up at 2024.10.08 20:06 => done at 2024.10.08 20:06, pos ID=1225253906
MS 0 20:16:50.552 HAVAL (XAUUSD,M5) #ticket 1225254819 (non-string passed) 0.02 XAUUSD at 2610.26 was set up at 2024.10.08 20:08 => done at 2024.10.08 20:08, pos ID=1225252956
RH 0 20:16:50.552 HAVAL (XAUUSD,M5) #ticket 1225254887 (non-string passed) 0.02 XAUUSD at 0 was set up at 2024.10.08 20:10 => done at 2024.10.08 20:10, pos ID=1225254887
MF 0 20:16:50.552 HAVAL (XAUUSD,M5) #ticket 1225254980 (non-string passed) 0.02 XAUUSD at 2613.27 was set up at 2024.10.08 20:11 => done at 2024.10.08 20:11, pos ID=1225254887
IL 0 20:16:50.552 HAVAL (XAUUSD,M5) #ticket 1225255101 (non-string passed) 0.01 XAUUSD at 2614.17 was set up at 2024.10.08 20:11 => done at 2024.10.08 20:11, pos ID=1225250806
IK 0 20:16:50.552 HAVAL (XAUUSD,M5) #ticket 1225255635 (non-string passed) 0.01 XAUUSD at 0 was set up at 2024.10.08 20:15 => done at 2024.10.08 20:15, pos ID=1225255635
PP 0 20:16:50.552 HAVAL (XAUUSD,M5) #ticket 1225255684 (non-string passed) 0.01 XAUUSD at 2614.26 was set up at 2024.10.08 20:16 => done at 2024.10.08 20:16, pos ID=1225255635
although in the history
What is wrong?
What is wrong?
In printf() compare the specified and passed types of parameters
I have a question, why 19 orders in the history by brute force, but less in the terminal history and why the tickets in the terminal history do not coincide with the tickets in the cache.
I have a question, why by brute force 19 orders in the history, but in the terminal in the history less and why the tickets in the history of the terminal do not coincide with the tickets in the cache
I have a question, why by brute force 19 orders in the history, but in the terminal in the history less and why the tickets in the history of the terminal do not coincide with the tickets in the cache
Because the terminal does not show orders.
Help me understand the logic of MT5. I select orders in the history:
What is wrong?
In the tester right-click to select orders, you must be looking at the history of trades
The test was great... I saw all the results. Now I am using it on a demo account.
But in the app I only see orders.... and where the price should be, there is only the text "placed"... and no new stuff in the History tab.
I know this might be a very stupid question..... But I would be happy if someone could help me.
Thanks indeed!
Bless you :)