PureBytes Links
Trading Reference Links
|
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");
------------------------ Yahoo! Groups Sponsor --------------------~-->
<font face=arial size=-1><a href="http://us.ard.yahoo.com/SIG=12h0iar55/M=362343.6886682.7839641.1493532/D=groups/S=1705632198:TM/Y=YAHOO/EXP=1124977021/A=2894352/R=0/SIG=11fdoufgv/*http://www.globalgiving.com/cb/cidi/tsun.html">Help tsunami villages rebuild at GlobalGiving. The real work starts now</a>.</font>
--------------------------------------------------------------------~->
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
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/
<*> To unsubscribe from this group, send an email to:
amibroker-unsubscribe@xxxxxxxxxxxxxxx
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|