PureBytes Links
Trading Reference Links
|
You need much more than an efficient algorithm, you need an efficient
language means.
TS2K freezes up or slows down significantly with arrays. TS8 should be even
worse with
its data accuracy.
C++ or Power Basic 'root' language dll's for example should be what you're
investing your
time in learning since they have a feasible solution. Then the elaborate
solutions presented will be
improvements of perhaps milliseconds versus minutes with TS EL. The most
important thing I've
learned in programming EL is knowing what to program in it and what not to.
Arrays is damn near
top of the list for what 'not' to program in EL. If you keep this in
perspective, TS2K is
incredible and best trading platform to date.
Phil
****************************************************************************
**********
****************************************************************************
**********
From: DH <catapult@xxxxxxxxxxxxxxxxxx>
Date: Fri, 26 Aug 2005 09:19:59 -0700
Here's a faster sort routine which Alex Matulich posted to the list a
while back.
--
Dennis
------------------------------------------------------------------------
{Function: _heapsort_a
by Alex Matulich
Adapted from _Numerical Recipes in C_
This function sorts an array ra[] from index 0 to N.
Lines marked with [*] are fixed from previous version, to
work correctly on EasyLanguage arrays which have a lowest
index of 0, instead of 1.
}
inputs:
ra[m](NumericArrayRef), {array to be sorted}
N(NumericSimple); {highest array index}
vars: NN(0), ii(0), ir(0), jj(0), ll(0), rra(0), lp1(true), lp2(true);
if m < N then NN = m else NN = N;
if NN > 0 then begin {*}
ll = IntPortion(0.5*NN); {*}
ir = NN;
while lp1 begin
if ll > 0 then begin {*}
ll = ll-1;
rra = ra[ll];
end else begin
rra = ra[ir];
ra[ir] = ra[0];
ir = ir-1;
if ir = 0 then begin
ra[0] = rra;
lp1 = false;
end;
end;
ii = ll;
jj = ll+ll;
lp2 = true;
while lp1 and lp2 and jj <= ir begin
if jj < ir and ra[jj] < ra[jj+1] then jj = jj+1;
if rra < ra[jj] then begin
ra[ii] = ra[jj];
ii = jj;
jj = jj+jj;
end else lp2 = false;
end;
ra[ii] = rra;
end;
end;
_heapsort_a = NN; {dummy return value}
|