Australian (ASX) Stock Market Forum

Amibroker Exit Issue

Joined
7 January 2014
Posts
3
Reactions
0
Hi All

I am learning to code in Amibroker and cant figure out why I get this error during backtesting

I want to use

IIf(Foreign("XAO","C") > EMA(Foreign("XAO","C"),75), Sell = C < EMA(C,50), Sell = C < EMA(C,30));

but all sell signals seem to be using the 30 day MA even when XAO is above 75 day MA.

Any suggestions?

thanks.
 
Hi All

I am learning to code in Amibroker and cant figure out why I get this error during backtesting

I want to use

IIf(Foreign("XAO","C") > EMA(Foreign("XAO","C"),75), Sell = C < EMA(C,50), Sell = C < EMA(C,30));

but all sell signals seem to be using the 30 day MA even when XAO is above 75 day MA.

Any suggestions?

thanks.


How about doing something like:


AORD = Foreign("XAO,"Close");

Sell = (AORD<EMA(AORD,30) AND (some other condition)) OR (AORD<EMA(AORD,75) AND (some other code));
 
Hi All

I am learning to code in Amibroker and cant figure out why I get this error during backtesting

I want to use

IIf(Foreign("XAO","C") > EMA(Foreign("XAO","C"),75), Sell = C < EMA(C,50), Sell = C < EMA(C,30));

but all sell signals seem to be using the 30 day MA even when XAO is above 75 day MA.

Any suggestions?

thanks.
You are not using Iif function correctly! Read the help file about coding errors.

Correct way:

Code:
XAO = Foreign( "XAO","C" );
mycondition = IIf( XAO > EMA( XAO, 75 ), C < EMA( C, 50 ), C < EMA( C, 30 ) );

Sell = mycondition;
 
You are not using Iif function correctly! Read the help file about coding errors.

Correct way:

Code:
XAO = Foreign( "XAO","C" );
mycondition = IIf( XAO > EMA( XAO, 75 ), C < EMA( C, 50 ), C < EMA( C, 30 ) );

Sell = mycondition;

New I was missing something obvious. Thanks.
 
Top