MetaTrader 4 Build 529 beta released with new compiler - page 3

 

can't figure out how to connect the include files now ...

The following error message can't open "E:\Terminal\MQL4\include\Commentary.mqh" include file 21 11

 
Barbarian:
what timer and what looping?

int OnInit()
  {
//--- create timer
   EventSetMillisecondTimer(500);
      
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//--- destroy timer
   EventKillTimer();
      
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
//---
   
  }
//+------------------------------------------------------------------+
//| Timer function                                                   |
//+------------------------------------------------------------------+
void OnTimer()
  {
    static int Count = 1;
    RefreshRates();
    Comment("\n\n","Ask = ", Ask, "\nBid = ", Bid, "\nCount = ", Count);
    Count++;
  }
//+------------------------------------------------------------------+
//| Trade function                                                   |
//+------------------------------------------------------------------+
void OnTrade()
  {
//---
   
  }
//+------------------------------------------------------------------+
//| Tester function                                                  |
//+------------------------------------------------------------------+
double OnTester()
  {
//---
   double ret=0.0;
//---

//---
   return(ret);
  }
//+------------------------------------------------------------------+
//| ChartEvent function                                              |
//+------------------------------------------------------------------+
void OnChartEvent(const int id,
                  const long &lparam,
                  const double &dparam,
                  const string &sparam)
  {
    Print(
      "id = ", id,
      ";   lparam = ", lparam,
      ";   dparam = ", dparam,
      ";   sparam = ", sparam
    );
   
  }


By the way, OnChartEvent() works too, in particular onMouseMove and onClick.

 
VOLDEMAR:

can't figure out how to connect the include files now ...

The following error message can't open "E:\Terminal\MQL4\include\Commentary.mqh" include file 21 11


I re-created and compiled the code - everything is fine.
 

After starting the Expert Advisor in the tester, the terminal window closes.

The reason is in this line ( function OnInit() ):

if(Bars<250) {Alert("ERROR HISTORY BARS<250"); return(INIT_FAILED);}

After launching on the chart, the Expert Advisor generates error"ERROR HISTORY BARS<250".

Print(Bars);
It shows 0. There are 16387 bars in the window.
 
Fonts like Wingdings have gone missing in graphical applications. The new MT4 must be unicode... But that's just in the heat of the moment. Perhaps the problem is something else.
 

I cannot understand why this code returns 00 00 00 00

string TimeS(string txt)
{
string d,h,m,s,n; 
d=DoubleToStr(Day()    ,0); if (StringLen(d)<2) d="0"+d;
h=DoubleToStr(Hour()   ,0); if (StringLen(h)<2) h="0"+h;
m=DoubleToStr(Minute() ,0); if (StringLen(m)<2) m="0"+m;
s=DoubleToStr(Seconds(),0); if (StringLen(s)<2) s="0"+s;
if (StringLen(txt)==6)
n =txt+d+" "+h+"."+m+"."+s+" ";
else
n =txt+d+" "+h+":"+m+":"+s+" ";
return(n);
}
 
nasdaq:

After starting the Expert Advisor in the tester, the terminal window closes.

The reason is in this line ( function OnInit() ):

After launching on the chart, the Expert Advisor generates error"ERROR HISTORY BARS<250".

It shows 0. There are 16387 bars in the window.

Yes, we will fix this error - there will be an update tomorrow.
 
VOLDEMAR:

I can't understand why this code returns 00 00 00 00

Try using a more compact construction in each line that converts a number to a string for starters:

d = LeadZero(Day());

string LeadZero(int value)
{
   if (value > 9)
      return (DoubleToStr(value, 0));

   return ("0" + DoubleToStr(value, 0));
}
 
To ensure that updates to other terminals are not affected, simply delete the directory C:\ProgramData\MetaQuotes\WebInstall after successfully updating a test terminal.
 
Scriptong:

Try using a more compact construction in each line that converts a number to a string to start with:


Even like this

Comment(Day());

Draw 0 ...

Reason: