- many related problems with New MetaTrader 4 Platform build 1045 - MQL4 and MetaTrader 4 - MQL4 programming forum
- This is a user's forum not Metaquotes.
- Can someone please advise where I send a Request for Support to Metaquotes. - MQL4 forum
- Get in touch with developers using Service Desk! - MQL5 forum
- Report it to the service desk. 'MQL5.community - User Memo' - an article about the algorithmic/automated trading in MetaTrader
- Report it to the Service Desk, not us users.
- many related problems with New MetaTrader 4 Platform build 1045 - MQL4 and MetaTrader 4 - MQL4 programming forum
- This is a user's forum not Metaquotes.
- Can someone please advise where I send a Request for Support to Metaquotes. - MQL4 forum
- Get in touch with developers using Service Desk! - MQL5 forum
- Report it to the service desk. 'MQL5.community - User Memo' - an article about the algorithmic/automated trading in MetaTrader
- Report it to the Service Desk, not us users.
- Your problem may be related to the other problems with that build.
- Report it so it gets fixed.
- Your problem may be related to the other problems with that build.
- Report it so it gets fixed.
No. I fixed it. I was able to track it down to a memory limitation on my system. When I keep what's running on the pc to a minimum; I don't get the error. But if I do something else that's memory intensive (Visual Studio installer, not installing, just loaded); I get the error.
I don't believe it is a problem with the build at all.
No. I fixed it. I was able to track it down to a memory limitation on my system. When I keep what's running on the pc to a minimum; I don't get the error. But if I do something else that's memory intensive (Visual Studio installer, not installing, just loaded); I get the error.
I don't believe it is a problem with the build at all.
But is it Build 1045?
You shouldn't need to drop max bars to 1000 under normal circumstances.
- Your problem may be related to the other problems with that build.
- Report it so it gets fixed.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
In the code below, the error comes up on ChartOpen. Now, despite the error; the chart still opens.
After going through a few things, I actually found out the problem. MT4 using too much memory. I made the following changes:
Somehow after I installed MT4, I forgot to change the Max bars property. 1000 is too much too for me. I don't see why anyone would need more than that.
Here's the code:
//| ChartHelp.mqh |
//| Nondisclosure. |
//| https://no.link.yet |
//+------------------------------------------------------------------+
#property copyright "Copyright 2016, MetaQuotes Software Corp."
#property link "https://www.mql5.com"
#property strict
input bool bPrefix=false; //Is there a prfix?
input string sPrefix=""; //..And if so, what is it?
input bool bSuffix=false; //Is there a suffix?
input string sSuffix=""; //..And if so, what is it?
input string sTemplate="Defalt";//What chart template should we use?
string Pairs[13]=
{
"EURUSD","EURAUD","EURCAD","EURJPY","EURNZD","EURGBP","EURCHF",
"GBPUSD","GBPAUD","GBPCAD","GBPJPY","GBPNZD","GBPCHF"
};
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
void SetupCharts()
{
if(bPrefix || bSuffix)
{
ResetPairs();
}
int tf=PERIOD_H1;
OpenThem(tf,StringConcatenate(sTemplate,".tpl"));
tf=PERIOD_D1;
OpenThem(tf,StringConcatenate(sTemplate,".tpl"));
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
void ResetPairs()
{
if(bPrefix)
{
for(int i=0;i<ArraySize(Pairs);i++)
{
Pairs[i]=StringConcatenate(sSuffix,Pairs[i]);
}
}
if(bSuffix)
{
for(int i=0;i<ArraySize(Pairs);i++)
{
Pairs[i]=StringConcatenate(Pairs[i],sSuffix);
}
}
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
void OpenThem(int tf,string tpl)
{
long IDs;
bool isOpen=false;
for(int i=0;i<ArraySize(Pairs);i++)
{
isOpen=funcIsOpen(Pairs[i],tf);
if(!isOpen)
{
IDs=ChartOpen(Pairs[i],tf);
if(IDs==0)
{
Print("Error on Chart Open! Template: ",tpl,". Error: ",GetLastError());
}
else
{
ChartApplyTemplate(IDs,tpl);
}
}
Sleep(100);
}
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
bool funcIsOpen(string sym,int tf)
{
bool isFound=false;
long chartID;
chartID=ChartFirst();
string chartSymbol;
int chartTimeframe=0;
while(chartID!=-1)
{
chartSymbol=ChartSymbol(chartID);
chartTimeframe=ChartPeriod(chartID);
if(chartSymbol==sym && chartTimeframe==tf)
{
isFound=true;
}
//Comment("Chart id:",chartID,"\n","Symbol: ",ChartSymbol(chartID),"\n","Timeframe: ",ChartPeriod(chartID));
chartID=ChartNext(chartID);
}
return(isFound);
}
//+------------------------------------------------------------------+
//| defines |
//+------------------------------------------------------------------+
// #define MacrosHello "Hello, world!"
// #define MacrosYear 2010
//+------------------------------------------------------------------+
//| DLL imports |
//+------------------------------------------------------------------+
// #import "user32.dll"
// int SendMessageA(int hWnd,int Msg,int wParam,int lParam);
// #import "my_expert.dll"
// int ExpertRecalculate(int wParam,int lParam);
// #import
//+------------------------------------------------------------------+
//| EX5 imports |
//+------------------------------------------------------------------+
// #import "stdlib.ex5"
// string ErrorDescription(int error_code);
// #import
//+------------------------------------------------------------------+