I am working on a custom indicator that for now I would like to sum the minute volumes throughout the past hour and display this volume as a bar in the 1 hour time frame. I know this is pretty useless but there is more to the indicator that I will add once I can get this part to work. The code compiles but when I open up the indicator in MetaTrader, nothing shows up in the indicator window, not even a vertical scale on the right side. Any help would be greatly appreciated!
And the code:
#property indicator_separate_window
#property indicator_buffers 1
//---- BUFFER
double OutPut[];
//---- INPUT(S)
extern int Periods = 10;
//±-----------------------------------------------------------------+
//+ INIT |
//±-----------------------------------------------------------------+
int init()
{
//---- ERROR TRAPS
if( Periods <= 0 ) { Alert(“Invalid Periods”); return(-1); }
//---- INDICATOR STYLE
SetIndexBuffer(0, OutPut);
SetIndexStyle( 0, DRAW_HISTOGRAM, STYLE_SOLID, 1, Red);
SetIndexDrawBegin(0, Periods );
//----
return(0);
}
//±-----------------------------------------------------------------+
//+ DEINIT |
//±-----------------------------------------------------------------+
int deinit() { return(0); }
//±-----------------------------------------------------------------+
//+ START |
//±-----------------------------------------------------------------+
int start()
{
//---- Find MaxRecords
int counted_bars=IndicatorCounted();
if(counted_bars<0) return(-1);
if(counted_bars>0) { counted_bars–; }
int MaxRecords = Bars-counted_bars;
double ADTotal;
int j = 0;
for( int i = 0; i < MaxRecords ; i++ )
{
ADTotal=0;
for(j = 0; j <= 60 ; j++)
{
ADTotal = ADTotal + iVolume(0,1,j);
}
OutPut[i] = ADTotal;
}
//----
return(0);
}