Hello,
I would like to have the open price and the current price of my open position but when I have a trade the posCurrent and posOpen are always equal to 0.0
Can you help me ?
Thank you very much
You have the same variables declared twice. First time in the global scope, and you use them for Comment, and another time in your loop where you get the position's parameters. So, for MT they are different variables, even though for you they are the same :).
Start with printing / logging directly from your loop.
Remove the first declaration, from the global scope. It really makes no sense.
You have the same variables declared twice. First time in the global scope, and you use them for Comment, and another time in your loop where you get the position's parameters. So, for MT they are different variables, even though for you they are the same :).
Start with printing / logging directly from your loop.
Remove the first declaration, from the global scope. It really makes no sense.
Andrey Barinov is right.
Just a quick tip- the compiler will issue a warning for this sort of cases,
So next time just pay attention to that, and you should be fine.
In a different matter-
You also have a 'bug' in your 'count open position' loop.
You iterate thru the open positions, and get their ticket number,
But you never actually select the order,
So your loop keeps counting the same order you've selected previously in your code.
Hope I am clear enough.
I am not a native English speaker.
Cheers mate.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello,
I would like to have the open price and the current price of my open position but when I have a trade the posCurrent and posOpen are always equal to 0.0
Can you help me ?
Thank you very much