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

[amibroker] Help with code



PureBytes Links

Trading Reference Links

i,
I am stuck here. I am writing the following conditions,
Fail=IIf((Index < 1 AND trend2 < 1) AND C<BBandBot (Close, 20, 0.8
 ),  VarSetText("ShortFlag"+Name(),"Fail" ), 
StaticVarRemove( "ShortFlag") );
Downtrend= IIf(C1<Ref(BBandBot (Close, 20, 0.8), -1) AND C<BBandBot 
(Close, 20, 0.8 ) AND trend2<=1 AND Index>1 AND SStrend<0, 
VarSetText("ShortFlag"+Name(),"Downtrend" ), 
StaticVarRemove( "ShortFlag") );
 
My problem is that VarGetText always returns the last condition.
 
I cannot afford a For statement, and IIF should take care of it.
 
How can I have a flag that tells me:
"The condition hit was (x)"
 
I need this to pass the result to buy/sell statements.
 
Any ideas? Any pointers to go on?
 
I was thinking something like
Fail=IIf((Index < 1 AND trend2 < 1) AND C<BBandBot (Close, 20, 0.8
 ),  VarSetText("ShortFlag"+Name(),"Fail" ), 
StaticVarRemove( "ShortFlag") );
if(VarGetText("ShortFlag"+Name())=="Fail")
{
Sell=(Index < 1 AND trend2 < 1) AND C<BBandBot (Close, 20, 0.8 );
}

Thanks
Jerry


Content-Description: "AVG certification"
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.432 / Virus Database: 268.15.26/598 - Release Date: 12/22/2006 3:22 PM