this is so simple I'm almost ashamed to post it but I've pulling my hair out trying to figure out what is going on.
I have a simple function:
Code: Select all
inputs: ftype(NumericSimple), parm0(NumericSimple);
vars: count(0);
switch (ftype)
begin
//init the counter
case 0:
count = 0;
KR_Test0=0;
//increment the counter
case 1:
count = count + 1;
print("<A> count is "+NumToStr(count,0));
KR_Test0 = 0;
//get the counter
case 2:
print("<B> count is "+NumToStr(count,0));
KR_Test0 = count;
end;
Code: Select all
vars: cnt(0);
//init the function on 1st bar
if(currentbar = 1 ) then
begin
KR_Test0(0,0);
end;
//increment the counter
KR_Test0(1,0);
//get the counter
cnt = KR_Test0(2,0);
<A> count is 1
<B> count is 0
<A> count is 2
<B> count is 0
<A> count is 3
<B> count is 0
<A> count is 4
<B> count is 0
<A> count is 5
<B> count is 0
I really have my tail between my legs on this, I know I'm missing something very obvious, but not sure what it could be. I've tried setting the function type to numeric, series, auto, no change.
Well any help greatly appreciated!
Thanks in advance
David