PureBytes Links
Trading Reference Links
|
well 4.49 DOES have looping but are you sure it was in
2003?
d
check the docs for that version: does it support the For
.. loop?
d
Hi,
I'm trying to code an Ord-Volume exploration based
on Tim Ord's article in July or August's TASC. It should be pretty
simple, but after a couple weeks of trying, I still am being stopped by
a type mismatch error. I've also tried using IIF() statements, but
they seem to have their own problems. I'm using ver 4.49.0, build
Nov 17, 2003 which shouldn't be the
problem.
TIA,
Joe
/*
Ord Volume with Swing
Indicator
by Joe Jungbluth
Rev - 08-25-05 */ swing_Days[0] =
swing_Days [1] = 0; swing_Vol[0] = swing_Vol[1] = 0; up_Swing =
down_Swing = 0; pivot_High = pivot_Low = 0; ord_Vol[0] = ord_Vol[1] =
0;
for( i = 2; i < BarCount;
i++) { if ((L[i-2] < L[i-1]) AND
(H[i-2] < H[i-1]))
{ up_Swing[i-1] =
1; } if
((L[i-2] > L[i-1]) AND (H[i-2] >
H[i-1]))
{ down_Swing[i-1] =
1; } if
((L[i-2] = L[i-1]) AND (H[i-2] = H[i-1]))
{ down_Swing[i-1] =
down_Swing[i-2]; up_Swing[i-1] =
up_Swing[i-2];
} if(up_Swing[i-1] == 1 AND H < H[i-1]
AND L < L[i-1])
{ pivot_High[i-1] =
1; }
if(down_Swing[i-1] == 1 AND H > H[i-1] AND L >
L[i-1])
{ pivot_Low[i-1] =
1; }
if(pivot_High[i-1] == 1 OR pivot_Low[i-1] == 1) //re-start accumulating
volume & swing count
{ swing_Vol[i] =
V; swing_Days[i] =
1; }
else {
swing_Vol[i] = swing_Vol[i-1] + V;
swing_Days[i] = swing_Days[i-1] + 1;
} ord_Vol[i] =
swing_Vol[i]/swing_Days[i]; } Filter = 1; AddColumn(H,
"H"); AddColumn(L, "L"); AddColumn(pivot_High, "pivot_H", 1.2,
colorDefault, IIf(pivot_High, colorGreen,
colorDefault)); AddColumn(pivot_Low, "pivot_L", 1.2, colorDefault,
IIf(pivot_Low, colorRed, colorDefault)); AddColumn(up_Swing, "Swing
Up", 1.2, colorDefault, IIf(up_Swing, colorGreen,
colorDefault)); AddColumn(down_Swing, "Swing Down", 1.2, colorDefault,
IIf (down_Swing, colorRed, colorDefault)); AddColumn(swing_Vol, "Swing
Volume"); AddColumn(swing_Days, "Swing Days"); AddColumn(ord_Vol, "Ord
Vol");
Please note that this group is for discussion between users only.
To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com
For other support material please check also:
http://www.amibroker.com/support.html
SPONSORED LINKS
YAHOO! GROUPS LINKS
|