How do i make the program to open only one trade, and if a trade is open, not to open another one?
That is a simple matter of telling the platform to open your trade only once.
Check to see if the trade has been opened and if it has then stop execution.
OrdersTotal() will be greater than 0 if there are open or pending trades.
Test that and do something.
// Take a new trade?
if(OrdersTotal() != 0)) ... don't open a new trade...
maybe there is a function which returns the amount of open orders.
maybe if this function returns more than 0, that there is already an open order.
maybe RTFM is useful.
It's slightly more complex than that if msbusinessil means that there should only be one trade from his/her EA, rather than one trade in total. But it's still a question which has already been asked and answered 9,432 times on this forum.
i think the help you need cant given to you in this forum.
phy has already told you the function, as kindly as he is.
dont trade, dont program is the best advice i can give to you
yes, if you run multiple instances of EAs on different charts.
but i dont think that such a nonprogrammer try to programm an multi-instance-capable EA.
What if he/she has already bought a commercial EA and is now trying to write one of his/her own to run alongside it? There are many reasons why "one order at a time" might not mean "OrdersTotal() == 0".
What if he/she has already bought a commercial EA and is now trying to write one of his/her own to run alongside it?
that would be like i buy a VW Golf and try to make a Mercedes from it.
without knowing how to weld, how a combustion engine works and so on...
Please enable the necessary setting in your browser, otherwise you will not be able to log in.