History Base: Not Enough Memory - page 3

 
forexCoder:
Open the mql4 file as WHRoeder suggested, check the insides of start() function like I told you.

I found the start() function but there was nothing like ArrayResize(array_name, new_size) there.
 
Ok. Care to share the file with the rest of us? We don't see the future or read from cards and stuff like that, posting the code, would help us help you.
 
forexCoder:
Ok. Care to share the file with the rest of us? We don't see the future or read from cards and stuff like that, posting the code, would help us help you.

//+------------------------------------------------------------------+
//|                                                       STD_MA.mq4 |
//|                                        Forex-Expert-Builders.com |
//|                             http://www.forex-expert-builders.com |
//+------------------------------------------------------------------+
#property copyright "Forex-Expert-Builders.com"
#property link      "http://www.forex-expert-builders.com"

extern int MagicNumber= 1234;
extern double Risk= 1;
extern int ATR_PERIOD= 14;
extern int MA_PERIOD= 14;
extern int MA_MODE= MODE_EMA;
extern int MA_PRICE= PRICE_TYPICAL;
extern double MinSlope= 1;
extern int STD_PERIOD= 14;
extern int STD_MA_MODE= MODE_EMA;
extern int STD_PRICE= PRICE_TYPICAL;
extern double STD_MinSlope= 1;

int GetNumberOfOpenTrades()
{
   int cnt;
      
   int orders= 0;
   
   for(cnt=0;cnt<OrdersTotal();cnt++)   
   {
     if(OrderSelect(cnt, SELECT_BY_POS))
          if (OrderMagicNumber()==MagicNumber)                                  
             orders++;    
   }   
   
   return(orders);
}   
bool CloseAllTrades(int op_type)
{
   int rc= true;
   int cnt;
   for(cnt=OrdersTotal()-1;cnt>=0;cnt--)
        {
          if(OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES))
          if (OrderMagicNumber()==MagicNumber && OrderType()==op_type) 
          {
             rc= rc && OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), 
                MarketInfo(OrderSymbol(),MODE_SPREAD), Yellow);     
          }
        }
        return(rc);
}

double CalcLots(double risk, double SL1, int opType)
{
   double PointValueDollar;   
   double SLDiffPoints;
   double vol;
   
   double TICK_VALUE= MarketInfo(Symbol(), MODE_TICKVALUE);
   
   if(opType==OP_BUY)
      SLDiffPoints= (Ask-SL1)/Point;
   else if(opType==OP_SELL)
      SLDiffPoints= (SL1-Bid)/Point;
   
   
   SLDiffPoints= SLDiffPoints;
   if(0!=SLDiffPoints)
   {
      PointValueDollar = (AccountEquity() * (risk / 100) / (SLDiffPoints)) ;
      vol= PointValueDollar/TICK_VALUE;
   //Log("PointValueDollar="+PointValueDollar+", vol="+vol, LOG_TRACE);
      double lotStep= MarketInfo(Symbol(), MODE_LOTSTEP);
      int n= vol/lotStep;
      vol= NormalizeDouble(n*lotStep, 2);
      if(vol<MarketInfo(Symbol(),MODE_MINLOT))
         vol= MarketInfo(Symbol(),MODE_MINLOT);                  
   }
   else 
      vol= MarketInfo(Symbol(),MODE_MINLOT);
   return(vol);
}  


//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
//----
   double valMAColorsBuy= iCustom(Symbol(),0,"MAColors",MA_PERIOD,
      MA_MODE,
      MA_PRICE,
      MinSlope,
      1, 1);
   double valMAColorsSell= iCustom(Symbol(),0,"MAColors",MA_PERIOD,
      MA_MODE,
      MA_PRICE,
      MinSlope,
      2, 1);

   double valSTDColors= iCustom(Symbol(),0,"STDColors",STD_PERIOD,
      STD_MA_MODE,
      STD_PRICE,
      STD_MinSlope,
      1, 1);
   
   if(valMAColorsSell!=EMPTY_VALUE)
      CloseAllTrades(OP_BUY);
   if(valMAColorsBuy!=EMPTY_VALUE)
      CloseAllTrades(OP_SELL);
   
   if(valSTDColors!=EMPTY_VALUE)
   if(GetNumberOfOpenTrades()==0)
   {      
      if(valMAColorsBuy!=EMPTY_VALUE)
      OrderSend(Symbol(), OP_BUY, CalcLots(Risk, Ask-iATR(Symbol(),0,ATR_PERIOD,0),OP_BUY), Ask, MarketInfo(Symbol(), MODE_SPREAD), 0,
         0, WindowExpertName(), MagicNumber, 0, Green);
      if(valMAColorsSell!=EMPTY_VALUE)
      OrderSend(Symbol(), OP_SELL, CalcLots(Risk, Bid+iATR(Symbol(),0,ATR_PERIOD,0),OP_SELL), Bid, MarketInfo(Symbol(), MODE_SPREAD), 0,
               0, WindowExpertName(), MagicNumber, 0, Red); 
   }

   
//----
   return(0);
  }
//+------------------------------------------------------------------+
 
2019.02.05 09:39:07.203 Not enough memory for 7198038 bars for indicator MACD (EURUSD,M1)
Have the above message at MT4, anybody know how fix it?
Reason: