which way is faster ?

Questions about MultiCharts and user contributed studies.
User avatar
TJ
Posts: 6520
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 957 times
Been thanked: 1883 times

which way is faster ?

Postby TJ » 14 Sep 2007

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.

User avatar
Marina Pashkova
Posts: 2758
Joined: 27 Jul 2007

Re: which way is faster ?

Postby Marina Pashkova » 14 Sep 2007

Hi TJ,

From the point of view of programming the second variant

var: condition1(false);
condition1 = H > H [1] and L < L[1]

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.

User avatar
TJ
Posts: 6520
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 957 times
Been thanked: 1883 times

Postby TJ » 14 Sep 2007

many thanks Marina, especially for your speedy response.

User avatar
Marina Pashkova
Posts: 2758
Joined: 27 Jul 2007

Postby Marina Pashkova » 17 Sep 2007

You are welcome, TJ!

Nick
Posts: 490
Joined: 04 Aug 2006
Has thanked: 4 times
Been thanked: 24 times

Postby Nick » 19 Sep 2007

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?

User avatar
TJ
Posts: 6520
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 957 times
Been thanked: 1883 times

Postby TJ » 19 Sep 2007

I am only trying to find a way to filter out inside bars, outside bars, etc. that type of elimination.


Return to “MultiCharts”