Download MetaTrader 5

WHAT DID YOU DO?????????? HOW COULD YOU UPDATE YOUR SOFTWARE AND MAKE THIS NOT WORK??????????

To add comments, please log in or register
Mom_markets1
88
Mom_markets1  

It is just a buffer that counts every bar. There is no way to make it work now.

int limit;

   if(prev_calculated==0)
      limit=0;
   else limit=prev_calculated-1;

int tick;
   for(int i=limit;i<rates_total;i++)
     {
     double a = Close[i]>0;
    
      if(a==true)
        {
        tick++;
         BufferFlat[i]=tick;
        }

}

//---- done
   return(rates_total);
  }
Alexey Da
Moderator
6615
Alexey Da  
Mom_markets1:

It is just a buffer that counts every bar. There is no way to make it work now.

...

1. Please insert code properly.

2. How did it work before update?

3. How is it working now? What's wrong? Make screenshots, attach logs and all sources.

MQL5.community - User Memo
  • 2010.02.25
  • MetaQuotes Software Corp.
  • www.mql5.com
You have just registered and most likely you have questions such as, "How do I insert a picture to my a message?" "How do I format my MQL5 source code?" "Where are my personal messages kept?" You may have many other questions. In this article, we have prepared some hands-on tips that will help you get accustomed in MQL5.community and take full advantage of its available features.
Mom_markets1
88
Mom_markets1  

1. Please insert your code properly.

#property  indicator_separate_window
#property  indicator_buffers 1
#property indicator_plots   1
#property indicator_type1   DRAW_HISTOGRAM
#property  indicator_color1  Red
#property  indicator_width1  2
#property indicator_minimum  0
#property indicator_maximum  2


//---- indicator buffers
double     BufferUp[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
//---- drawing settings
   PlotIndexGetInteger(0,PLOT_DRAW_BEGIN,0);





//---- indicator buffers mapping
   SetIndexBuffer(0,BufferUp,INDICATOR_DATA);
   

//---- initialization done
   return(0);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,const int prev_calculated,
                const datetime &Time[],
                const double &Open[],
                const double &High[],
                const double &Low[],
                const double &Close[],
                const long &TickVolume[],
                const long &Volume[],
                const int &Spread[])
  {

//---
   int limit;

   if(prev_calculated==0)
      limit=0;
   else limit=prev_calculated-1;

   for(int i=limit;i<rates_total;i++)
     {
     double a = Close[i]>0;
     int tick;
      if(a==true)
        {
        tick++;
         BufferUp[i]=tick;
        }

}

//---- done
   return(rates_total);

  }


2. How did it work before update?

It would create a buffer in a separate window that would create a buffer with a value that increased with every bar.

3. How is it working now? What's wrong? Make screenshots, attach logs and all sources

Now, I get a separate window but nothing is in it.

I actually cannot get any values into the window.

Documentation on MQL5: Standard Constants, Enumerations and Structures / Indicator Constants / Indicators Lines
  • www.mql5.com
Standard Constants, Enumerations and Structures / Indicator Constants / Indicators Lines - Documentation on MQL5
Alexey Da
Moderator
6615
Alexey Da  

Thank you. We have found our error in program's properties. At this moment you can avoid this error if you set indicator_maximum and indicator_minimum as 2.0 and 0.0


Have you seen warning?

possible use of uninitialized variable 'tick'   tmp.mq5 48      10

Check your algorithm. I think there is a logical mistake.


Mom_markets1
88
Mom_markets1  

Thank you very much. I have received similar results with the indicator window showing no data in numerous situations, and I have never been able to solve that issue through adding decimals to the min/max values. So many variables to troubleshoot. I actually just discovered the problem myself.

Thanks again. I should know a little better than to think that there has been some major fundamental change to the language. 

This is easily the best back-testing software I have ever come across.

To add comments, please log in or register