Help with Overtrading EAs
Question Already Answered
Newdigital already answered the timefilter question in this post:
https://www.mql5.com/en/forum/175806
Thanks Newdigital
I use the following custom functions to monitor open positions, feel free to use them:
int openPos(int type = 0, int magic = 0) {
int amount=0;
for(int i=0; i<OrdersTotal(); i++) {
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) {
if((OrderMagicNumber() == magic || magic == 0) && OrderSymbol() == Symbol()) {
if(OrderType()==type || type==0)
amount++;
}
}
}
return(amount);
}
int longPos() {
return(openPos(OP_BUY));
}
int shortPos() {
return(openPos(OP_SELL));
}
you can use longPos() to get amount of long positions open and shortPos() to get amount of short positions open. To get all open positions use openPos()
openPos can be used for given magic number too.
Thanks
I use the following custom functions to monitor open positions, feel free to use them:
int openPos(int type = 0, int magic = 0) {
int amount=0;
for(int i=0; i<OrdersTotal(); i++) {
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) {
if((OrderMagicNumber() == magic || magic == 0) && OrderSymbol() == Symbol()) {
if(OrderType()==type || type==0)
amount++;
}
}
}
return(amount);
}
int longPos() {
return(openPos(OP_BUY));
}
int shortPos() {
return(openPos(OP_SELL));
}
you can use longPos() to get amount of long positions open and shortPos() to get amount of short positions open. To get all open positions use openPos()
openPos can be used for given magic number too.Where would I post that into my code?
Thanks,
khari123
Hi All,
I've created this post because I need programming help with my EAs. I think I've created a couple profitable ones, but they quickly tank because of overtrading. Usually the first trade of the day is profitable, but because conditions of the EA are still there, it opens more trades until the conditions of the EA are not there. Can someone add a during during the euro session function or trade once a day function to this EA?
Thanks a Bunch