Not referenced

 
 

It is excluded from the compiled file because it is not used (the compiled file includes only what is needed).

To get it included you have to call the function datestart() somewhere.

 
 

for instance modify the start function, but instead of calling date_start I would rather include the code in it, because I guess that you want that the EA is not executed if the date has passed the limit and this function date start() returns 0 in both cases.

Furthermore the function CurTime() is not used anymore

So remove datestart completely

and modify the start function

//+------------------------------------------------------------------+

//| Start function |

//+------------------------------------------------------------------+

void start()

{

string expire_date = "2004.31.06"; //<-- hard coded datetime

datetime e_d = StrToTime(expire_date);

if (TimeCurrent() >= e_d)

{

Alert ("The trial version has been expired!");

return(0);

}

//---- check for history and trading

if(Bars<100 || IsTradeAllowed()==false) return;

//---- calculate open orders by current symbol

if(CalculateCurrentOrders(Symbol())==0) CheckForOpen();

else CheckForClose();

//----

}

 

I tried to put this date-code in another ea which has

int init

int deinit

int start

If i put datecheck-code in int init I got the alert-box with trial version expired, but the ea still put in the orders. How do i do to get the ea to stop executing?

And how would the code be if placed in int start section?

//+------------------------------------------------------------------+

//| Start function |

//+------------------------------------------------------------------+

void start()

{

string expire_date = "2004.31.06"; //<-- hard coded datetime

datetime e_d = StrToTime(expire_date);

if (TimeCurrent() >= e_d)

{

Alert ("The trial version has been expired!");

return(0);

}

Reason: