Are all your charts of different symbol? If yes, you could use this:
if(OrdersTotal()!=0)
{
for(int i=0;i<OrdersTotal();i++)
{
if(OrderSelect(i,SELECT_BY_POS)==true)
{
if(OrderSymbol()==Symbol() && (OrderType()==0 || OrderType()==1))
{
//do what you should do if there's not duplicate order
}
}
}
}
it checks if any other order of the same symbol is open and if not, it execute the code it should. there are more elegant way to do it but this one should help. if you have two charts with the same symbol, make use of comment to differentiate between them (ex: chart 1, chart 2).
Brian Sans Souci:
Thanks for the quick reply. I will need time to reflect on this...

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Would anyone help me with this?
This is the code I did:
//limit number of trades for the account
int accounttotaltrade=OrdersTotal();
double accounttradelimit=equity/500;
//my execution (part of my argument)
if(accounttotaltrade<accounttradelimit) … etc.
For example, the accouttradelimit returns a value of 7, and I have several charts opened in my MT4 using an EA. I only want to allow one trade per chart and the rest of the 6 can be used by the other charts. The problem is that 1 chart executes more than 1 trade.
Please share a code to complement this. Thanks.