Hi guys,
need some help here.
I made an momentum based EA (nothing exciting, I know). When take profit has occurred, The EA is supposed to wait for a fresh bar to enter the next trade. So here is my code at the begining of the start()
bool CanTrade = True;
int OHTotal = OrdersHistoryTotal();
for (int hi = 0; hi < OHTotal; hi ++) {
bool hasclosedtrade = OrderSelect(hi, SELECT_BY_POS, MODE_HISTORY);
if(hasclosedtrade && OrderCloseTime() >= Time[0] && OrderMagicNumber() == MagicNumber) {
CanTrade = False;
}
return 0;
}
It does not work. What have I done wrong?