Hello all you gurus out there!!
Is there anyone out there that might be able to tell me why the following code works only one time and then will not work after the EA is reinitialzed.
//----check for successful trade
for(cnt = OrdersTotal(); cnt >= 0; cnt--)
{
if (OrderSelect(cnt,SELECT_BY_POS,MODE_HISTORY))
{
if (OrderSymbol() == Symbol() && OrderMagicNumber() == MAGIC)
{
if (TimeDayOfWeek(OrderCloseTime()) == TimeDayOfWeek(TimeCurrent()))
{
if (OrderProfit()/Point >= Int_Target)
{
Comment ("\n\n Closed Order = ",OrderProfit());
return(0);
}
}
}
}
}
I am trying to find a way to shut down an EA after a successful trade. But then it starts up again the next day, this portion of code seems to be ingnored. Any suggestions as to why and what I can do to make it work?
Thanks
Is there anyone out there that might be able to tell me why the following code works only one time and then will not work after the EA is reinitialzed.
//----check for successful trade
for(cnt = OrdersTotal(); cnt >= 0; cnt--)
{
if (OrderSelect(cnt,SELECT_BY_POS,MODE_HISTORY))
{
if (OrderSymbol() == Symbol() && OrderMagicNumber() == MAGIC)
{
if (TimeDayOfWeek(OrderCloseTime()) == TimeDayOfWeek(TimeCurrent()))
{
if (OrderProfit()/Point >= Int_Target)
{
Comment ("\n\n Closed Order = ",OrderProfit());
return(0);
}
}
}
}
}
I am trying to find a way to shut down an EA after a successful trade. But then it starts up again the next day, this portion of code seems to be ingnored. Any suggestions as to why and what I can do to make it work?
Thanks