hi... is there any way to open only one order in OnTick() function without using OrdersTotal () OR ExpertRemove()?
- Automatically end backtests/optimizations early?
- Coding help
- trailing stop problem
Marco vd Heijden:
Yes you have to count the amount of orders for the chart symbol use the search function.
hi marco thank you for the reply i just want to open one order if i do that if the order reaches its stop or tp the same order will be opened again .... for example if you open an order in Onint() function the order will be opened only once regardless of it hitiing sl or tp it wont open again...i want to do the same thing in OnTick()
Yes you have to count the amount of orders for the chart symbol use the search function.
saman89200:
hi marco thank you for the reply i just want to open one order if i do that if the order reaches its stop or tp the same order will be opened again .... for example if you open an order in Onint() function the order will be opened only once regardless of it hitiing sl or tp it wont open again...i want to do the same thing in OnTick()
because i want to use trailing stop on that order and i cant use trailing stop in Oninit so it has to be in Ontick
hi marco thank you for the reply i just want to open one order if i do that if the order reaches its stop or tp the same order will be opened again .... for example if you open an order in Onint() function the order will be opened only once regardless of it hitiing sl or tp it wont open again...i want to do the same thing in OnTick()
Those are two separate things.
One order only and trailingstop.
You can set a boolean flag upon opening the order and reset it through the returnvalue of OrderClose(..
![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