cuallito:
If you do it immediately after sending close order then the position probably didn't close yet. You should wait for the position to really close before requesting a new volume.Okay I know I can use PositionGetDouble(POSITION_VOLUME) to get the current order's position, and that works fine, but when I close the order it still returns the volume of the last position? Shouldn't it return 0?
Hi, thanks for the reply. I have the command in the OnTick function of an EA and it still gives me the last volume of the position well after it's closed every tick.
cuallito:
Hi, thanks for the reply. I have the command in the OnTick function of an EA and it still gives me the last volume of the position well after it's closed every tick.
Wait, if the position is closed, how was you able to select it at all?Hi, thanks for the reply. I have the command in the OnTick function of an EA and it still gives me the last volume of the position well after it's closed every tick.
I have something like
int OnInit() { PositionSelect(_Symbol); } int OnTick() { Print(PositionGetDouble(POSITION_VOLUME)); }
The output I get is something like (time goes from bottom to top):
......end
0.1
0.1
0.1
0.1 <-----close position
0.1
0.1
0.1
0.1 <----buy here
0
0
0
start.....
Shouldn't it return zero after I closed the position?
Thanks again!
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
Okay I know I can use PositionGetDouble(POSITION_VOLUME) to get the current order's position, and that works fine, but when I close the order it still returns the volume of the last position? Shouldn't it return 0?