I have this ea that has a magic number, everytime I atach it to my chart I have to change the magic number, but it has an extern bool called Hibernation that I can put it true or false. When it is set to false and the ea reached the take profit it starts again placing a new order, and goes 24/7, I love it. But there is a problem, If I close the order manually before it reaches its tp, the ea wont reinitialize, wont restart as it does when it close the order itself.
How can I make it keep going even if I close its order manually without changing the magic number or reataching to the chart? My guess is that the ea doesn't "see" the order close unless it is closed by itself.
This is the code that I think has something to do with it:
extern int MagicNumber=21784; // Magic number: for identifying the EA's orders
extern bool Hibernation=true;
/+------------------------------------------------------------------+
int simpleMagicGenerator()
{
return (MagicNumber);
}
//+------------------------------------------------------------------+
bool orderBelongsToMe()
{
if (OrderSymbol()==Symbol() && OrderMagicNumber()==simpleMagicGenerator() )
return (true);
else
return (false);
}
//+------------------------------------------------------------------+
bool newOrderPermitted(int simpleOrderType)
{
if (Hibernation)
{
if (historyWinLoss[0]==(2))
{ onScreenComment(41); return (false); }
}
if (TimeEntry)
{
if (!(Hour()==EntryHour && Minute()>=EntryMinute) && progressing()==false)
{ onScreenComment(42); return (false); }
}
if (PriceEntry)
{
if (Ask!=Price && progressing()==false)
{ onScreenComment(43); return (false); }
}
How can I make it keep going even if I close its order manually without changing the magic number or reataching to the chart? My guess is that the ea doesn't "see" the order close unless it is closed by itself.
This is the code that I think has something to do with it:
extern int MagicNumber=21784; // Magic number: for identifying the EA's orders
extern bool Hibernation=true;
/+------------------------------------------------------------------+
int simpleMagicGenerator()
{
return (MagicNumber);
}
//+------------------------------------------------------------------+
bool orderBelongsToMe()
{
if (OrderSymbol()==Symbol() && OrderMagicNumber()==simpleMagicGenerator() )
return (true);
else
return (false);
}
//+------------------------------------------------------------------+
bool newOrderPermitted(int simpleOrderType)
{
if (Hibernation)
{
if (historyWinLoss[0]==(2))
{ onScreenComment(41); return (false); }
}
if (TimeEntry)
{
if (!(Hour()==EntryHour && Minute()>=EntryMinute) && progressing()==false)
{ onScreenComment(42); return (false); }
}
if (PriceEntry)
{
if (Ask!=Price && progressing()==false)
{ onScreenComment(43); return (false); }
}