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

Re: EL Question



PureBytes Links

Trading Reference Links


Romi, 
I assume that by "subtract[ing] the 'close' of a condition", 
you wanted to ask 'value of a variable while some function 
evaluates to true'.  The reason for such rewording of 
your question is that conditions return true or false, 
and cannot be subtracted from numeric values.

You could say:

  vars: MyCondition(false), MyVariable(0) ;

  { some code goes here to set myCondition}

  if MyCondtion then 
     plot1(myVariable - myVariable[7] , "something");

Array referance [integer] is about as fast as you can get in EL.

Notice that you do NOT need currentbar because every bar
is a currentbar while it is being evaluated.
The index reference [ ] allows you to point back in time
using a RELATIVE addressing scheme, relative to currentbar
so it is not necessary to name it.

You may want to set the plot1 properties to POINT.  
(There is also NoPlot function, but use only as necessary 
since it can be slow.)

By the way
   momentum(myVariable, 7)  
{assuming you are using 7 bars} produces the same result, 
and at equal speed.

Leslie


Romi Ghose wrote:
> 
> Hi Folks,
> What is the most efficient (ie, fast) EL to subtract the 'close' of a
> condition (I know not when in the past) from the 'close' of the current bar
> and then plot the resultant?
> Using 'currentbar' to do this seems a little bit slow (not sure if the
> slowness is only initially when you insert the indicator)...and also it
> increases the maxbarsback (again not sure why?)
> Romi

-- 
Regards,
Leslie Walko
610-688-2442
--
 "Life is a tragedy for those who feel, a comedy for those who
think"
	Horace Walpole, 4th earl of Orford, in a letter dated about 1770