[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Help with EL code



PureBytes Links

Trading Reference Links

> HighD and LowD are the daily highs and lows, so on a 5 minute bar
> HighD[1] will give your the high of yesterday 

Not quite.  HighD is a *function*, not a variable.  So you pass it an 
argument using parentheses:  HighD(1).  The HighD function uses that 
argument to determine how many days ago it should refer to.

To get the value of a *variable* N bars ago, you use Var[N].

> > I'm using 5-minute bars and want enter a trade if the price of the
> > current bar exceeds the high of the previous day.  I'm not sure
> > how the high of all of yesterday's bars is written.

HighD(1) gives you the high of yesterday.  Note, if you're using TS4, 
you MUST call HighD(1) on EVERY BAR.  HighD and LowD have a bug in 
them that will return the wrong value if you don't.  If you want to 
refer to it inside an if statement, store the HighD value in a 
variable, like this:

  vars:  HD(0), OneTick(MinMove points);
  HD = HighD(1);
  if foo = bar then buy at HD + OneTick stop;

Gary