Conversion to AFL following code

yasu222

Active Member
#1
Convert the following Metastock code into Amibroker Language. This code used to avoid multiple signals in Metastock.

(in case of buy signal)
a:= "Enter the condition for buy" ;
b:= "Enter the condition for sell" ;
state:=If(BarsSince(a)<BarsSince(b),1,0);
state>Ref(state,-1);

(in case of sell signal)
a:= "Enter the condition for buy" ;
b:= "Enter the condition for sell" ;
state:=If(BarsSince(a)<BarsSince(b),1,0);
state<Ref(State,-1);

Thanks in Advance.
 

mastermind007

Well-Known Member
#2
Convert the following Metastock code into Amibroker Language. This code used to avoid multiple signals in Metastock.

(in case of buy signal)
a:= "Enter the condition for buy" ;
b:= "Enter the condition for sell" ;
state:=If(BarsSince(a)<BarsSince(b),1,0);
state>Ref(state,-1);

(in case of sell signal)
a:= "Enter the condition for buy" ;
b:= "Enter the condition for sell" ;
state:=If(BarsSince(a)<BarsSince(b),1,0);
state<Ref(State,-1);

Thanks in Advance.
This logic is embedded into ExRem function of Amibroker

Buy = ExRem(Buy, Sell);
Sell = ExRem(Sell, Buy);
 

Similar threads