PureBytes Links
Trading Reference Links
|
Hi Ernie,
I don't know what this code is supposed to do, but I can get past any error
messages by making sure all variables get initialized before use and by
using the LastValue() function to enable a non-array condition for your if
statements. Like this:
<clip>
Cycle=0;
factor =1;
Length = 10;
cond1= LastValue(HHV(H,Length) - LLV(L,Length)) > 0;
Cond2= LastValue(C - LLV(L,Length)) > 0;
if (Cond1 AND Cond2)
{
SloFastK = (EMA((Close - LLV(L,Length)) / (HHV(H,Length) - LLV
(L,Length)) * 100,3));
}
else
{
SloFastK = 0;
}
// Calculate raw stochastic using xma from above (SloFastK)
Value1 = LastValue(LLV(SloFastK,Length));
Value2 = LastValue(HHV(SloFastK,Length) - Value1);
Value3 = LastValue(SloFastK);
if (Value2 > 0 )
{
NewFastK = (Value3 - Value1) / Value2 * 100;
}
else
{
NewFastK = 0;
}
Cycle = Factor * NewFastK + (1 - Factor) * Ref(Cycle,-1);
Plot(Cycle,"DGL-Cycle-10",colorYellow);
<clip>
HTH,
-john
----- Original Message -----
From: "Ernie Newman" <ewn87544@xxxxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Friday, August 13, 2004 12:45 PM
Subject: [amibroker] Help with Error Message
Hi
I am trying to convert a TS4 file to Amibroker format it includes
if else statements and I get the following error message and don't
know what to do
Error 3.
Condition in IF, WHILE, FOR statements
has to be Numeric or Boolean type.
You can not use array here,
please use [] (array subscript operator)
to access array elements
The following is the code I am using.
Length = 10;
if (HHV(H,Length) - LLV(L,Length) > 0 AND C - LLV(L,Length) > 0)
SloFastK = (EMA((Close - LLV(L,Length)) / (HHV(H,Length) - LLV
(L,Length)) * 100,3));
else (SloFastK = 0);
// Calculate raw stochastic using xma from above (SloFastK)
Value1 = LLV(SloFastK,Length);
Value2 = HHV(SloFastK,Length) - Value1;
Value3 = SloFastK;
if Value2 > 0 then
NewFastK = (Value3 - Value1) / Value2 * 100
else
NewFastK = 0;
Cycle = Factor * NewFastK + (1 - Factor) * Ref(Cycle,-1);
Plot(Cycle,"DGL-Cycle-10",colorYellow);
What do I need to do to make this work as I have other files that
use if else statements that I would like to use.
Thanks
Ernie
Check AmiBroker web page at:
http://www.amibroker.com/
Check group FAQ at:
http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Yahoo! Groups Links
------------------------ Yahoo! Groups Sponsor --------------------~-->
Yahoo! Domains - Claim yours for only $14.70
http://us.click.yahoo.com/Z1wmxD/DREIAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~->
Check AmiBroker web page at:
http://www.amibroker.com/
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.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/
|