I have hundreds of these evaluations. Pls tell me which way is faster.
(I have studied this in university years ago, but I do not remember which way)
method 1:
var: condition1(false);
if H > H [1] and L < L[1] then condition1 = true;
method 2:
var: condition1(false);
condition1 = H > H [1] and L < L[1] ;
Thanks in advance for your help.
which way is faster ?
- TJ
- Posts: 7740
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2221 times
- Marina Pashkova
- Posts: 2758
- Joined: 27 Jul 2007
Re: which way is faster ?
Hi TJ,
From the point of view of programming the second variant
From the point of view of programming the second variant
is more correct. Also, theoretically it should be faster. In practice, though, the speed of the two methods above would be pretty much the same.var: condition1(false);
condition1 = H > H [1] and L < L[1]
- TJ
- Posts: 7740
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2221 times
If you have hundreds of these types of comparisons its probably worth going boolean the whole way. So for example
higherhigh = h > h[1];
lowerlow = l < [1];
lowerhigh= blah blah
higherclose = blah blah blah
then simply use
if higherhigh + lowerlow + higherclose do something.
if lowerhigh + higherlow + lowerclose do something else
I am not sure if EL supports bitwise logic it may not (setting individual bits inside a word) then that would be even faster.
HH = 0000000000000001
LL = 0000000000000010
then using OR's ANDS and XORS with bitmasks for the condidtions you are testing for. I recall doing some studies like that for price patterns but can't recall if it was easy language or something else.
Cheers,
Nick.
P.S. always intrested in price action/pattern stuff what are you up to?
higherhigh = h > h[1];
lowerlow = l < [1];
lowerhigh= blah blah
higherclose = blah blah blah
then simply use
if higherhigh + lowerlow + higherclose do something.
if lowerhigh + higherlow + lowerclose do something else
I am not sure if EL supports bitwise logic it may not (setting individual bits inside a word) then that would be even faster.
HH = 0000000000000001
LL = 0000000000000010
then using OR's ANDS and XORS with bitmasks for the condidtions you are testing for. I recall doing some studies like that for price patterns but can't recall if it was easy language or something else.
Cheers,
Nick.
P.S. always intrested in price action/pattern stuff what are you up to?
- TJ
- Posts: 7740
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2221 times