Hello, I have a problem with my indicator that I’m rewriting in MQL5.
I have 3 buffers with data, all are meant to display the same symbol (but in different color). The indicator is a separate window, and in MQL4 I was displaying all symbols at 0.0.
#property indicator_minimum -1
#property indicator_maximum 1
#property indicator_plots 3
#property indicator_buffers 3
#property indicator_color1 clrLawnGreen
#property indicator_color2 clrCrimson
#property indicator_color3 clrGold
#property indicator_type1 DRAW_ARROW
#property indicator_type2 DRAW_ARROW
#property indicator_type3 DRAW_ARROW
And the buffers:
double arrowUp[];
double arrowDown[];
double arrowHorizontal[];
...
int OnInit()
{
// Is it ok?
SetIndexBuffer(0,arrowUp,INDICATOR_DATA);
SetIndexBuffer(1,arrowDown,INDICATOR_DATA);
SetIndexBuffer(2,arrowHorizontal,INDICATOR_DATA);
PlotIndexSetInteger(0,PLOT_ARROW,143);
PlotIndexSetInteger(1,PLOT_ARROW,143);
PlotIndexSetInteger(2,PLOT_ARROW,143);
PlotIndexSetDouble(0,PLOT_EMPTY_VALUE,EMPTY_VALUE);
PlotIndexSetDouble(1,PLOT_EMPTY_VALUE,EMPTY_VALUE);
PlotIndexSetDouble(2,PLOT_EMPTY_VALUE,EMPTY_VALUE);
…
But when I test this indicator (with no real instructions yet!!!) I see all 3 colors displayed in the indicator window (I expected to see nothing in the window like in MQL4) and the value showed in Data Tester of Strategy window shows my buffers to be equal to 0.0. This is bad.
This is my onCalculate
if(prev_calculated==0)
{
ArrayInitialize(arrowUp,EMPTY_VALUE);
ArrayInitialize(arrowDown,EMPTY_VALUE);
ArrayInitialize(arrowHorizontal,EMPTY_VALUE);
}
int limit=rates_total-prev_calculated;
for(int n=limit-1; n>=0; n--)
{
// SO FAR NOTHING!
}
return(rates_total-1);
My indicator is meant to display a symbol in separate window. As you can see all 3 symbols are "DRAW_ARROW" and the symbol is the same - only the color is different. But in MQL4 I didn't see anything on the chart until I had arrowUp[n]=0/arrowDown[n]=0...
Could you help me?
This is what I see and from my code I would expect to see nothing at all… because my buffers hold EMPTY_VALUE: