Simple (I hope) MQL4 question

 
Hey dudes,

Just a small question I've spent a good few hours on trying to figure out (as I'm new to MQL)...

How do you look back on the previous bar?

Would be good if LastBar existed, but unfortunately it doesn't.

Close[1] shows the chart's value.

This is in a custom indicator in a separate window, using buffer arrays.

Here's a look at a snippet of code that sets the arrays im looking to look back on:


 for(i=0; i <= Bars-1; i++) 
   {   
   ErgoCCI[i] = (500 * iMAOnArray(var2,0,ps,0,MODE_EMA,i))/(iMAOnArray(var2b,0,ps,0,MODE_EMA,i)); //var2a[i]/var2b[i];
   
   }
   for(i=0; i<=Bars; i++)
   {
     MainCCI[i]=iMAOnArray(ErgoCCI,0,trigger,0,MODE_EMA,i);
   }

I know it's not much, all I'm really trying to do is look back on the previous bar's array value.

Thanks for any advice/help in advance.

- Dan
 

Time[1],Open[1],High[1],Low[1],Close[1],Volume[1]. See https://docs.mql4.com/predefined/variables

See also https://docs.mql4.com/series

 
stringo:

Time[1],Open[1],High[1],Low[1],Close[1],Volume[1]. See https://docs.mql4.com/predefined/variables

See also https://docs.mql4.com/series

Updated question, I wasn't clear with question.

Thanks for the quick response!
 
See Documentation - https://docs.mql4.com/series
 
No ideas on how I can go go the last drawn histogram bar?
 

Use iCustom()