Hi,
I just started coding for MT5. I am able to open a position, close it through take profit and stop loss, but I can't seem to get the code to close the open position if, say, it is after 5.00pm.
Are there any suggestions I may be aware of? Or could you simply let me know how an open position can be closed after a certain time?
Many thanks in advance,
Hi,
You can use this way.
Happy coding :)
Hi,
I just started coding for MT5. I am able to open a position, close it through take profit and stop loss, but I can't seem to get the code to close the open position if, say, it is after 5.00pm.
Are there any suggestions I may be aware of? Or could you simply let me know how an open position can be closed after a certain time?
Many thanks in advance,
What difficulties?
#include <Trade\Trade.mqh> ... CTrade trade; ... MqlDateTime time; TimeCurrent(time); if (time.day_of_week==5 && time.hour>=17 && time.min>=15) trade.PositionClose(...);
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi,
I just started coding for MT5. I am able to open a position, close it through take profit and stop loss, but I can't seem to get the code to close the open position if, say, it is after 5.00pm.
Are there any suggestions I may be aware of? Or could you simply let me know how an open position can be closed after a certain time?
Many thanks in advance,