Bars Reference

 

Hello,

My name is Carlos, I am new here.

I started to develop an indicator and I expected that using this type of code:


double iHigh(string symbol,ENUM_TIMEFRAMES timeframe,int index)

{
   if(index < 0) return(-1);
   double Arr[1];
   if(CopyHigh(symbol,timeframe, index, 1, Arr)>0)
        return(Arr[0]);
   else return(-1);
}


It would be possible to get the value of the last bar using this


iHigh(NULL,0,2)
But it appears this message:


'iHigh' - function can be declared only in the global scope


Could someone help me to find a way to use information of past bars to create an indicator ?


Thank you

 
Carlos_R: But it appears this message: 'iHigh' - function can be declared only in the global scope
When in doubt, think. You declared your function inside another function. Move it outside of the enclosing function. Or check your brackets.
Reason: