Errors, bugs, questions - page 422

 
After upgrading to build 468 in the tester, trades diagnosed as [trade disabled] are no longer being processed. Testing on championship account 2010.
Automated Trading Championship 2010
  • championship.mql5.com
Automated Trading Championship 2010
 

Good afternoon, forum members.

Please help me to understand. The indicator does not appear on the chart for some reason - I don't know where the error is.

In general, it should be displayed on the chart like this:

But I just have nothing in the window of this indicator. MT4.

Here is the code of the indicator. Is there an error in the code or in something else?

//+------------------------------------------------------------------+
//|                                                        Bands.mq4 |
//|                      Copyright © 2005, MetaQuotes Software Corp. |
//|                                       http://www.metaquotes.net/ |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2005, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net/"

#property indicator_chart_window
#property indicator_buffers 6
#property indicator_color1 Blue
#property indicator_color2 Yellow
#property indicator_color3 Red
//---- indicator parameters
extern int    BandsPeriod=50;
extern int    BandsShift=0;
extern double BandsDeviations=2.0;
extern int    TrendBars = 10;
extern bool EnableTextDisplay = true;
//---- buffers
double MovingBuffer[];
double UpperBuffer[];
double LowerBuffer[];
double HighTrend[];
double LowTrend[];
double MidTrend[];

//bool DisplayText = false;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,MovingBuffer);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexBuffer(1,UpperBuffer);
   SetIndexStyle(2,DRAW_LINE);
   SetIndexBuffer(2,LowerBuffer);
   SetIndexBuffer(3,HighTrend);
   SetIndexBuffer(4,LowTrend);
   SetIndexBuffer(5,MidTrend);
   
//----
   SetIndexDrawBegin(0,BandsPeriod+BandsShift);
   SetIndexDrawBegin(1,BandsPeriod+BandsShift);
   SetIndexDrawBegin(2,BandsPeriod+BandsShift);
//----
   if(EnableTextDisplay)
   {
      DisplayLabel_1();
      DisplayLabel_2();
      DisplayLabel_3();
   }
   
   return(0);
  }
//+------------------------------------------------------------------+
//| Bollinger Bands                                                  |
//+------------------------------------------------------------------+
int start()
  {
   int    i,k,counted_bars=IndicatorCounted();
   double deviation;
   double sum,oldval,newres;
//----
   if(Bars<=BandsPeriod) return(0);
//---- initial zero
   if(counted_bars<1)
      for(i=1;i<=BandsPeriod;i++)
        {
         MovingBuffer[Bars-i]=EMPTY_VALUE;
         UpperBuffer[Bars-i]=EMPTY_VALUE;
         LowerBuffer[Bars-i]=EMPTY_VALUE;
        }
//----
   int limit=Bars-counted_bars;
   if(counted_bars>0) limit++;
   for(i=0; i<limit; i++)
      MovingBuffer[i]=iMA(NULL,0,BandsPeriod,BandsShift,MODE_SMA,PRICE_CLOSE,i);
//----
   i=Bars-BandsPeriod+1;
   if(counted_bars>BandsPeriod-1) i=Bars-counted_bars-1;
   while(i>=0)
     {
      sum=0.0;
      k=i+BandsPeriod-1;
      oldval=MovingBuffer[i];
      while(k>=i)
        {
         newres=Close[k]-oldval;
         sum+=newres*newres;
         k--;
        }
      deviation=BandsDeviations*MathSqrt(sum/BandsPeriod);
      UpperBuffer[i]=oldval+deviation;
      LowerBuffer[i]=oldval-deviation;
      i--;
     }
//----

   double TestVal1 = 0;
   double TrendValueHigh = 0;
   for(i=0;i<TrendBars;i++)
   {
         TestVal1 = UpperBuffer[i] - UpperBuffer[1+1];
         TrendValueHigh = TrendValueHigh - TestVal1;

   }
   double TrendValueLow = 0;
   for(i=0;i<TrendBars;i++)
   {
         TestVal1 = LowerBuffer[i] - LowerBuffer[1+1];
         TrendValueLow = TrendValueLow - TestVal1;

   }   
   double TrendValueMid = 0;
   for(i=0;i<TrendBars;i++)
   {
         TestVal1 = MovingBuffer[i] - MovingBuffer[1+1];
         TrendValueMid = TrendValueMid - TestVal1;

   }  
   
   
   MidTrend[0] = TrendValueMid * 1000;
   HighTrend[0] = TrendValueHigh * 1000;
   LowTrend[0] = TrendValueLow * 1000;


   if(EnableTextDisplay)
   {
      ObjectSetText("Label_Message1","High " + DoubleToStr(HighTrend[0], 2),14,"Arial",Yellow);
      ObjectSetText("Label_Message2","Mid " + DoubleToStr(MidTrend[0], 2),14,"Arial",Yellow);
      ObjectSetText("Label_Message3","Low " + DoubleToStr(LowTrend[0], 2),14,"Arial",Yellow);
   }


   return(0);
  }
  
  int  DisplayLabel_1()  
{
   ObjectCreate("Label_Message1", OBJ_LABEL, 0, 0, 0);// Creating obj.
   ObjectSet("Label_Message1", OBJPROP_CORNER, 1);    // Reference corner
   ObjectSet("Label_Message1", OBJPROP_XDISTANCE, 10);// X coordinate
   ObjectSet("Label_Message1", OBJPROP_YDISTANCE, 15);// Y coordinate

   ObjectSetText("Label_Message1","",14,"Arial",White);
   
   return(0);      
}
int  DisplayLabel_2()  
{
   ObjectCreate("Label_Message2", OBJ_LABEL, 0, 0, 0);// Creating obj.
   ObjectSet("Label_Message2", OBJPROP_CORNER, 1);    // Reference corner
   ObjectSet("Label_Message2", OBJPROP_XDISTANCE, 10);// X coordinate
   ObjectSet("Label_Message2", OBJPROP_YDISTANCE, 35);// Y coordinate

   ObjectSetText("Label_Message2","",14,"Arial",White);
   
   return(0);      
}
int  DisplayLabel_3()  
{
   ObjectCreate("Label_Message3", OBJ_LABEL, 0, 0, 0);// Creating obj.
   ObjectSet("Label_Message3", OBJPROP_CORNER, 1);    // Reference corner
   ObjectSet("Label_Message3", OBJPROP_XDISTANCE, 10);// X coordinate
   ObjectSet("Label_Message3", OBJPROP_YDISTANCE, 55);// Y coordinate

   ObjectSetText("Label_Message3","",14,"Arial",White);
   
   return(0);      
}

//+------------------------------------------------------------------+
 

Sorry, but you'd rather go to the MT4 website

http://forum.mql4.com/ru/


It's MT5.

\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\


Can anyone tell me what is the maximum allowed bin file size

which may be opened by advisor for reading, because 25 m with 3 mln.

It may be that 25 meters and 3 million tens of value will not be read, but 500.000 values will be read?

MQL4: форум по механическим торговым системам и тестированию стратегий
  • www.mql5.com
MQL4: форум по механическим торговым системам и тестированию стратегий
 
Im_hungry:

Sorry, but you'd rather go to the MT4 website

https://www.mql5.com/ru/forum


It's MT5.

Thanks, I'll go there.
 
Im_hungry:

Can anyone tell me what is the maximum permissible bin file size

which may be opened by the Expert Advisor for reading, because 25 m with 3 mln.

does not want to open, but opens with 500,000 values ?

To the developers. There is nothing about file size limitation in documentation.
 
Im_hungry:


Can anyone tell me what is the maximum permissible bin file size

which may be opened by the Expert Advisor for reading, because 25 m with 3 mln.

does not want to open, but it opens with 500,000 values?

I assume the file is read into the array? - Most likely just not enough RAM.
 
String


Print((int)ChartGetInteger(0,CHART_FIRST_VISIBLE_BAR)," ",(int)ChartGetInteger(0,CHART_VISIBLE_BARS));

It returns almost the same values (the difference is only one bar), how is that possible?

2011.06.18 00:03:45     CHFJPY (CHFJPY,M15)     384 385

In idea one function should return how many bars to view on the current chart (for example 5000) and the other only the number that fits into the screen (in my case just over 380).

Build 466, Full 7 x64

 
olyakish:
The line


It returns almost the same values (the difference is only one bar), how is that possible?

In idea one function should return the total number of bars for viewing in the current chart (for example 5000) and the other should return only the number that fits into the screen (in my case just over 380).

Build 466, Fortock OS 7 x64

That's right. Number of visible bars:
ChartGetInteger(0,CHART_VISIBLE_BARS)

is always 1 more than the number of the first (left) visible bar:

ChartGetInteger(0,CHART_FIRST_VISIBLE_BAR)

The last bar (right) has number 0.

Unless the chart is scrolled. If the chart is "scrolled", <number of the first visible bar> = <number of visible bars> + <the shift of the chart in bars>-1.

And what you write:

...how many total bars to view yes the current chart ( e.g. 5000)...

is a bit different:

TerminalInfoInteger(TERMINAL_MAXBARS);   // Максимальное количество баров на графике
 

About not opening the file size, and for the year 2010 and 2009 2008 does not want to open,

I tried to open a file created using this code but keeps getting an error message

2 значения - первое целое (хранит время в секундах)

второе дробное (цену или еще что),


Когда время (т.е. секунды) в файле совпадает с временем, текущим, используем второе значение

и выводим его. Все это я реализовал следующим образом - работает без косяков - пока :-)


double proverka()
{
 handle= FileOpen("kor.bin", FILE_BIN|FILE_READ);
 if(handle<0) Print("-----Неоткрывается :-)");
 ulong file=FileSize(handle);
 ulong N = 0.0;
 double kor = 0.0;
 datetime bar[1];
 CopyTime(Symbol_1,NULL,0,1,bar);
 ulong New = (ulong) bar[0];
 while (N < file)
  {
   kor=FileReadDouble(handle); 
   N = FileTell(handle);
   if (kor == New) 
    {
     double ss = FileReadDouble(handle);
     FileClose(handle);
     return (ss);
     break;
    }
  } 
 FileClose(handle);
 return (kor);
}

Any time interval except 2011, 01, 01 opens the rest do not,

What kind of problem?

Документация по MQL5: Файловые операции / FileOpen
Документация по MQL5: Файловые операции / FileOpen
  • www.mql5.com
Файловые операции / FileOpen - Документация по MQL5
 
uncleVic:

is a little different:


I'm afraid that's not going to work.

TerminalInfoInteger(TERMINAL_MAXBARS); 

For example, I've got 50000 bars checked in my settings but 11375 bars loaded in reality.


The method

PlotIndexSetInteger(0,PLOT_DRAW_BEGIN,);


And which number to use here.

ZS Here's what's onInit

   SetIndexBuffer(0,CHF,INDICATOR_DATA);
   PlotIndexSetString(0,PLOT_LABEL,"CHF");
   PlotIndexSetInteger(0,PLOT_DRAW_TYPE,DRAW_LINE);
   PlotIndexSetInteger(0,PLOT_LINE_COLOR,clrMagenta);
   ArraySetAsSeries(CHF,true);
   ArrayInitialize(CHF,EMPTY_VALUE);
   //PlotIndexSetInteger(0,PLOT_DRAW_BEGIN,);

And the rubbish in the history is not cleared...

Reason: