Something like this :
if (iBarShift(NULL,0,OrderOpenTime())>=RequeredNumberOfBars)
{
// add code to close the order here
}vibarco:
Hi all,
Hi all,
¿do you have some code to close trades after a number of bars?.
Regards.Thanks mladen,
do i have to filter the order that i want to close before de conditional?.
Best,
Vince.
Yes
That code snippet should be applied to already selected order
vibarco:
Thanks mladen,
Thanks mladen,
do i have to filter the order that i want to close before de conditional?.
Best,
Vince.![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
Hi all,
¿do you have some code to close trades after a number of bars?.
Regards.