Help! Disk Space Being Gobbled UP!!!

 

Hello everyone,

Could someone help me with this issue?

I've been using my EA's for years and this has only recently showed up. Every now and then my disk space is suddenly used up to about 99 per cent of its capacity. It goes away when I delete my mt4 demo account. This has happened 3 times already and the solution has been to delete my demo account. As soon as I do this, my disk space returns to normal.

I talked to my broker and they said its because my ea is automatically logging and it is filling up my disk space. I don't know about that, I have never had this problem before. I ran a full virus scan and no viruses or worms were detected. Could it have something to do with the 409 build?

If it is caused by logging, is there a way I can prevent my EA from filling up the logs?

Thanks for anyone who can help me with this problem.

 
Take a look in the experts/logs folder if you have some big files in there then your EA or Indicators or Scripts are Printing stuff . . . edit them or configure them so they stop.
 
RaptorUK:
Take a look in the experts/logs folder if you have some big files in there then your EA or Indicators or Scripts are Printing stuff . . . edit them or configure them so they stop.

Here is the EA I was running at the time. I can't see how the logging occurs. If it is automatic, can I prevent it in the EA?
extern int ticket_number = 0; 
extern double take_profit_amount = 20.00; 
extern double exit_amount = -50; 

double order_profit = 0.0;       
         
int enable_owl_hoot = 0;
         
int init()
  {

   return(0);
  }

int deinit()
  {

   return(0);
  }

int start()
  
   
   {   
        
      if(OrderSelect(ticket_number,SELECT_BY_TICKET)== true) 
        {
         order_profit = OrderProfit(); 
        }
        
        
        if(order_profit > take_profit_amount)
         
          {
           while(OrdersTotal()>0)
            {
             if(OrderSelect(ticket_number,SELECT_BY_TICKET)== true)
              { 
               
                OrderClose(OrderTicket(),OrderLots(),Ask,3,Gray);
                enable_owl_hoot = 1;  
               }  
             }  
           }
          
      if(order_profit < exit_amount)
         
          {
           while(OrdersTotal()>0)
            {
             if(OrderSelect(ticket_number,SELECT_BY_TICKET)== true)
              { 
               
                OrderClose(OrderTicket(),OrderLots(),Ask,3,Gray);
                 
               }  
             }  
           }
    
    if(enable_owl_hoot == 1)
       {
        PlaySound("great grey owl");
        Sleep(3000);
        }
   
                                 
   return(0);
  
  }
 
OK, no Print in there . . . did you check the logs folder ? also check the logs folder in the root MT4 folder
 
RaptorUK:
OK, no Print in there . . . did you check the logs folder ? also check the logs folder in the root MT4 folder


The last time this problem occured-- this morning-- I wasn't aware of the logging issue. I just found out about it today after talking with my broker. So, I didn't check any of my log files before I deleted my demo.

It must be related to the log files because my disk space came back after deleting the demo.

I will check my log file next time, but how could the logging occur if I have no print or log code in my EA? None of my EA's have a logging function. As you can see in the above code, there is nothing.

My broker said the EA's log automatically. Is this true?

 
forestmyopia:


The last time this problem occured-- this morning-- I wasn't aware of the logging issue. I just found out about it today after talking with my broker. So, I didn't check any of my log files before I deleted my demo.

It must be related to the log files because my disk space came back after deleting the demo.

I will check my log file next time, but how could the logging occur if I have no print or log code in my EA? None of my EA's have a logging function. As you can see in the above code, there is nothing.

My broker said the EA's log automatically. Is this true?


I found the source of my problem. I ran my EA again and after it closed, the expert log filled up with the message: unknown ticket for the OrderCloseFunction. It seems as if the EA is still trying to close the trade. I tried to fix it by adding some code as below, but to no avail.
extern int ticket_number = 0; 
extern double take_profit_amount = 20.00; 
extern double exit_amount = -500; 

double order_profit = 0.0;       
         
int enable_owl_hoot = 0;
int close_order = 1;
         
         
int init()
  {

   return(0);
  }

int deinit()
  {

   return(0);
  }

int start()
  
   
   {   
        
      if(OrderSelect(ticket_number,SELECT_BY_TICKET)== true) 
        {
         order_profit = OrderProfit(); 
        }
        
        
       
       if(close_order == 1) HERE IS THE FIX THAT DOESN'T WORK
        {
         if(order_profit > take_profit_amount)
         
          {
           while(OrdersTotal()>0)
            {
             if(OrderSelect(ticket_number,SELECT_BY_TICKET)== true)
              { 
               
                OrderClose(OrderTicket(),OrderLots(),Ask,3,Gray);
                close_order = 0; THE FIX THAT DOESN'T WORK
                enable_owl_hoot = 1;  
               }  
             }  
           }
         }
         
          
     if(close_order == 1)
      {
       if(order_profit < exit_amount)
         
          {
           while(OrdersTotal()>0)
            {
             if(OrderSelect(ticket_number,SELECT_BY_TICKET)== true)
              { 
               
                OrderClose(OrderTicket(),OrderLots(),Ask,3,Gray);
                close_order = 0; 
               }  
             }  
           }
        }
    
    if(enable_owl_hoot == 1)
       {
        PlaySound("great grey owl");
        Sleep(3000);
        }
   
                                 
   return(0);
  
  }
 

The problem is that you are selecting by Ticket, even when the order is closed it still exists with that ticket number but in the History pool. You need too check if the Order is open or closed . . . for a quick and dirty fix edit your OrderClose like this . . .

if ( OrderCloseTime() == 0 )  OrderClose(OrderTicket(),OrderLots(),Ask,3,Gray);
 
RaptorUK:

The problem is that you are selecting by Ticket, even when the order is closed it still exists with that ticket number but in the History pool. You need too check if the Order is open or closed . . . for a quick and dirty fix edit your OrderClose like this . . .


Ok. I will try it out. Thanks for the help.
 
I presumed the Order was placed manually and this "EA" was a trade minder/closer type of EA. Only closes Sell orders too ;-)
 
dabbler:

There's some very nasty code in there :-(

You are selecting by ticket_number and yet that is not changed anywhere in the program.

Changed here:

extern int ticket_number = 0; 

;-)

 

Gentlemen! Thanks for the input, but the problem is fixed. I used RaptorUK's suggestion (my thanks and my hat off to you Mr. RaptorUK) to check for close time as a filter: if ( OrderCloseTime() == 0 )

And that cured the problem.

I know my code is bad, very bad. It's so bad that if you look up bad code in Encyclopedia Britanica, you will see a picture of my coding and an ink drawing of myself under atrocious programmer.

But I use general programming principles more as a ... guidline, as Jack Sparrow's pirates would say.