Errors, bugs, questions - page 991

 
costy_:

When I call it up I get

2013.05.31 13:08:41 temp (AUDUSD,M5) TERMINAL_COMPANY = MetaQuotes Software Corp.

It should be different broker, or something is wrong, thanks.

 AccountInfoString(ACCOUNT_SERVER)

terminal belongs to MetaQuotes Software Corp.

brokerAccountInfoString(ACCOUNT_SERVER)

 
pako:

terminal belongs to MetaQuotes Software Corp.

brokerAccountInfoString(ACCOUNT_SERVER)

Thanks, I lost it after all.
 

Good afternoon!

I am writing a multicurrency indicator. When I change the code again, it compiles well, but when I try to put an indicator on a chart, I get "invalid ex5 file". I tried to re-save it under a different name - the same thing. It turns out that the problem is in the code, but compilation is fine.

//+------------------------------------------------------------------+
//|                                                      Therm02.mq5 |
//|                        Copyright 2013, MetaQuotes Software Corp. |
//|                                              http://www.mql5.com |
//+------------------------------------------------------------------+

#include <ST_ServicesAndAbstracts.mqh>

#property copyright "Copyright 2013, MetaQuotes Software Corp."
#property link      "http://www.mql5.com"
#property version   "1.00"
#property indicator_separate_window
#property indicator_minimum 0
#property indicator_maximum 120
#property indicator_buffers 1
#property indicator_plots   2
//--- plot Label1
#property  indicator_label1  "Label1"
#property  indicator_type1   DRAW_LINE
#property  indicator_color1  clrBlack
#property  indicator_style1  STYLE_SOLID
#property  indicator_width1  1
//--- indicator buffers
double         gThermB[];

double         gEURThermB[];
double         gCHFThermB[];

CRangeManager  *gEURRM, *gCHFRM;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- indicator buffers mapping
   SetIndexBuffer(0,gEURThermB,INDICATOR_DATA);
   SetIndexBuffer(0,gCHFThermB,INDICATOR_DATA);
   gEURRM = new CRangeManager(1,0.2,20,"EURUSD");
   gCHFRM = new CRangeManager(1,0.2,20,"USDCHF");
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate (const int rates_total,      // size of input time series
                 const int prev_calculated,  // bars handled in previous call
                 const datetime& time[],     // Time
                 const double& open[],       // Open
                 const double& high[],       // High
                 const double& low[],        // Low
                 const double& close[],      // Close
                 const long& tick_volume[],  // Tick Volume
                 const long& volume[],       // Real Volume
                 const int& spread[]         // Spread
   )

  {
//---
   double lEUR[], lCHF[];
   int copied;
   copied=CopyClose("EURUSD",PERIOD_CURRENT,0,5000,lEUR); 
   if (copied==-1){Print("Ждите...EUR");return(0);}
   copied=CopyClose("USDCHF",PERIOD_CURRENT,0,5000,lCHF); 
   if (copied==-1){Print("Ждите...CHF");return(0);}


   sThermometer lT;
   for(int i=prev_calculated;i<rates_total;i++)
      {
         lT = gEURRM.getState(lEUR[i]);
         gEURThermB[i] = lT.currentT; 
         
         lT = gEURRM.getState(lCHF[i]);
         gEURThermB[i] = lT.currentT; 
      }
//--- return value of prev_calculated for next call
   return(rates_total);
  }
//+------------------------------------------------------------------+
//| TradeTransaction function                                        |
//+------------------------------------------------------------------+
void OnTradeTransaction(const MqlTradeTransaction& trans,
                        const MqlTradeRequest& request,
                        const MqlTradeResult& result)
  {
//---
   
  }
//+------------------------------------------------------------------+

How can I help?

Thank you!

 
ns_k:

Good afternoon!

I am writing a multicurrency indicator. When I change the code again, it compiles well, but when I try to put an indicator on a chart, I get "invalid ex5 file". I tried to re-save it under a different name - the same thing. It turns out that the problem is in the code, but compilation is fine.

How can I help?

Thank you!

Does the compilation go through without any errors or warnings? Is it accurate?
 
tol64:
Does the compilation go through without errors or warnings? Are you sure?
There are no errors, there are warnings, mostly harmless ones like unused values. But there is this indicator buffers amount is less than needed. I'll try to dig here

 
ns_k:
There are no errors, there are warnings, mostly innocuous ones like unused values. However, there is this indicator buffers amount is less than needed. I'll try digging here.

Yes, that's exactly it. That's where the error lies:

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- indicator buffers mapping
   SetIndexBuffer(0,gEURThermB,INDICATOR_DATA);
   SetIndexBuffer(0,gCHFThermB,INDICATOR_DATA);
   gEURRM = new CRangeManager(1,0.2,20,"EURUSD");
   gCHFRM = new CRangeManager(1,0.2,20,"USDCHF");
//---
   return(INIT_SUCCEEDED);
  }
Highlighted in red. Replace with 1.
 
#property indicator_buffers 1
#property indicator_plots   2
The number of buffers cannot be less than the number of plots. This is what the compiler tells you in the message.
 
tol64:

Yes, that's exactly it. That's what's wrong:

Highlighted in red. Replace with 1.
#property indicator_buffers 1
#property indicator_plots   2
Спасибо всем!
 
ns_k:

MT4 Built 500. I set the alert to a certain level, it goes off, everything is fine. I deactivate the alert (space), it shows as suspended. Then the instrument reaches a threshold value and the alert is triggered. Is this how it should be?

ps. Yes, a side note. First I highlighted all the alerts with my mouse (6 of them) and pressed the spacebar, they all became suspended. After triggering one, I've already turned it off with spacebar only and it still triggers

 

I'm going to sprinkle in some more.

//+------------------------------------------------------------------+
//|                                                      Therm02.mq5 |
//|                        Copyright 2013, MetaQuotes Software Corp. |
//|                                              https://www.mql5.com |
//+------------------------------------------------------------------+

//#include <ST_ServicesAndAbstracts.mqh>

#property copyright "Copyright 2013, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property indicator_separate_window
#property indicator_minimum 0
#property indicator_maximum 120
#property indicator_buffers 2
#property indicator_plots   2
//--- plot Label1
#property  indicator_label1  "Label1"

#property  indicator_type1   DRAW_LINE
#property  indicator_color1  clrBlack
#property  indicator_style1  STYLE_SOLID
#property  indicator_width1  1
//--- indicator buffers
double         gThermB[];

double         gEURThermB[];
double         gCHFThermB[];

//CRangeManager  *gEURRM, *gCHFRM;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- indicator buffers mapping
   SetIndexBuffer(0,gEURThermB,INDICATOR_DATA);
   SetIndexBuffer(1,gCHFThermB,INDICATOR_DATA);
   //gEURRM = new CRangeManager(1,0.2,20,"EURUSD");
   //gCHFRM = new CRangeManager(1,0.2,20,"USDCHF");
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate (const int rates_total,      // size of input time series
                 const int prev_calculated,  // bars handled in previous call
                 const datetime& time[],     // Time
                 const double& open[],       // Open
                 const double& high[],       // High
                 const double& low[],        // Low
                 const double& close[],      // Close
                 const long& tick_volume[],  // Tick Volume
                 const long& volume[],       // Real Volume
                 const int& spread[]         // Spread
   )

  {
//---
   double lEUR[], lCHF[];
   int copied;
  // copied=CopyClose("EURUSD",PERIOD_CURRENT,0,5000,lEUR); 
   if (copied==-1){Print("Ждите...EUR");return(0);}
  // copied=CopyClose("USDCHF",PERIOD_CURRENT,0,5000,lCHF); 
   if (copied==-1){Print("Ждите...CHF");return(0);}


   //sThermometer lT;
   for(int i=prev_calculated;i<5000;i++)
      {
         //lT = gEURRM.getState(lEUR[i]);
       //  gEURThermB[i] = lT.currentT; 
         
     //    lT = gCHFRM.getState(lCHF[i]);
     //    gCHFThermB[i] = lT.currentT; 
      }
//--- return value of prev_calculated for next call
   return(rates_total);
  }
//+------------------------------------------------------------------+
//| TradeTransaction function                                        |
//+------------------------------------------------------------------+
void OnTradeTransaction(const MqlTradeTransaction& trans,
                        const MqlTradeRequest& request,
                        const MqlTradeResult& result)
  {
//---
   
  }
//+------------------------------------------------------------------+

On startup the terminal swears the specified symbol is not selected. I've dragged it to another MT5 via the cloud - it works, and with commented strings using tickers.

I'd try to find the reason, but I don't know where to start searching for such a stray error. Maybe I should re-install the terminal at once?