[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [amibroker] Help with code!



PureBytes Links

Trading Reference Links

Dear Jeff,

The problem with your code is that it simply uses 
variable assignment operator instead of comparison operator.

Please remember that AFL "equal to" operator is == 
while single = represents variable assignment.

Also while you can write
a = b = 1;
(it will assign 1 to both a and b variables, as in C-language)

you can NOT test the equality using
a == b == 1

You have to use
a == 1 AND b == 1 (both conditions must be met)
a == 1 OR b == 1 ( at least one condition must be met)

Therefore your IIF line should look like this:
e3=IIF( b1==1 AND d3==1, 10, -10 );

Best regards,
Tomasz Janeczko 
----- Original Message ----- 
From: "Jeff Gholson" <jgholson@xxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: 16 July, 2001 15:44
Subject: [amibroker] Help with code!


Ok...I've looked at this thing until I'm cross-eyed. It seems like it
should function properly but it doesn't for me...sometimes it helps to have
others to look at it so here it goes...

b1=IIF(close>ref(close, -1),1,-1);
f1=IIF(close>ma(close,10),2,-2);
d2=IIF(close>ma(close,20),3,-3);
e2=IIF(ma(close,10)>ma(close,20),1,-1);
d3=IIF(volume>ma(volume,20),1,-1);

e3=IIF(b1=d3=1,10,-10);

graph0=e3;


The problem is the e3! It will not change! It remains at +10. I have
manually ran this against price data that should turn it to -10,but it won't
change in the program. When the e3 IIF statement is introduced b1 and d3
"magically" always read the same. However, when the e3 IIF is removed, b1
and d3,read the way they are supposed too. Sometimes they are equal
sometimes not, which is supposed to change the e3 IIF when in the AFL...

So I leave this problem to the AFL Gods...and may the FORCE BE WITH YOU!



Thanks




Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/