Jan: But I have no idea how to programm the EA so that he can trade more than one time but only one trade at the same time!
|
On a new tick, do a OrderSelect loop and see if you already have an open order. Don't open another if you do.
Using OrdersTotal directly and/or no Magic number filtering on your
OrderSelect loop means your code is incompatible with every EA (including
itself on other charts and manual trading.) Symbol Doesn't equal
Ordersymbol when another currency is added to another seperate chart . - MQL4
forum
|
how to programm the EA so that he can trade more than one time but only one trade at the same time!
You are not being very clear.
bool can_trade=true;
for(int i=OrdersTotal()-1;i>=0;i--)
{
if(OrderSelect(i,SELECT_BY_POS) && OrderSymbol()==Symbol() && OrderMagicNumber()==MagicNumber)
if(OrderOpenTime()>=Time[0])
{
can_trade=false;
break;
}
}
if(can_trade)
{
//Check conditions to place trade
}

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
Hey Guys,
I want to make a backtest but for that I need to programm my EA so that it is possible to execute more than only one trade?
At the moment I have programmed it so that the EA can only trade once. But I have no idea how to programm the EA so that he can trade more than one time but only one trade at the same time!
How is that possible? - Any idea?
Greetings and Thank you!