stevehopwoodforex.com
https://www.stevehopwoodforex.com/phpBB3/
Print view

What is Shift Parameter?
https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=1426
Page 2 of 2
Author:  remix919 [ Fri Jan 25, 2013 10:35 pm ]
Post subject:  Re: What is Shift Parameter?

So...like this? :D

Code: Select all

//--- input parameters
extern int       shift=0;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int    bars=IndicatorCounted();
//----
for (bar = limit-1; bar >= 0; bar--) {
ACbuffer[bar] = iAC(null, 0, bar);
ACbufferShift[bar] = iAC(null, 0, bar + shift);
}
//----
   return(0);
  }
//+------------------------------------------------------------------+
Don't bash too hard, i'm still new :roll:
Author:  garyfritz [ Fri Jan 25, 2013 11:01 pm ]
Post subject:  Re: What is Shift Parameter?

That's the right direction, but you're missing some crucial pieces -- like declaring the buffer arrays, and making them indicator buffer by calling SetIndexBuffer().

I suggest you look at a simple indicator (like RSI.mql or ATR.mql) and see how it works, rather than guessing and asking. Go read http://book.mql4.com/samples/icustom, too.
Author:  remix919 [ Fri Jan 25, 2013 11:22 pm ]
Post subject:  Re: What is Shift Parameter?

Ok, thanks, I'll go read up on those in the MQL4 docs, btw, are the default indicators accessible? I can't seem to find them anywhere, I can only find the custom indicators.
Author:  garyfritz [ Sat Jan 26, 2013 8:43 pm ]
Post subject:  Re: What is Shift Parameter?

Look under experts\indicators. You'll find the two I mentioned and several others.
All times are UTC Page 2 of 2