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.
- 2010.02.25
- MetaQuotes Software Corp.
- www.mql5.com
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.
- www.mql5.com
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.
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.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
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);
}