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

Re: [amibroker] Metastock's formula into AFL



PureBytes Links

Trading Reference Links

hello,

//enter long

wcan= C > O;
Buy=MACD() > EMA(MACD(), 9) AND C > O AND O < L+(H-L) * 0.5 AND ((C/O) -
1) * 100 >=1 AND Sum(wcan,2)<=1 ;

//Close LONG
wcan= C > O;
BuyPrice= ValueWhen(MACD() > EMA(MACD(),9) AND C > O AND O < L + (H-L) *
0.5 AND ((C/O) - 1) * 100 >=1 AND Sum(wcan,2) <= 1,C,1);
cond1= MACD() < EMA(MACD(),9);
cond2= (C/BuyPrice >= 0 AND BarsSince(MACD() > EMA(MACD(),9) AND C > O
AND O < L+(H-L)*0.5 AND ((C/O)-1)*100 >= 1 AND Sum(wcan,2) <= 1) >= 17);

Sell=cond1 OR cond2;

//ENTER Short
bcan=C<=O;
cond1=MACD()<EMA(MACD(),9);
Short=cond1 AND bcan=1 AND C<L+(H-L)*0.2 AND Sum(bcan,3)<=1;

//Close Short

bcan=C<=O;
Cond1=MACD()>EMA(MACD(),9);
SellPrice=ValueWhen(cond1 AND bcan=1 AND C<L+(H-L)*0.2 AND
Sum(bcan,3)<=1,C,1);
cond2=(SellPrice>=0 AND BarsSince(cond1 AND bcan=1 AND C<L+(H-L)*0.2 AND
Sum(bcan,3)<=1)>=50);
Cover=cond1 OR cond2;

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

Filter=1;

AddColumn(Buy,"buy");AddColumn(Sell,"sell");
AddColumn(Short,"short");AddColumn(Cover,"cover");
AddColumn(BuyPrice,"buyprice");AddColumn(SellPrice,"sellprice");


Inwind wrote:

> Can someone please convert this Metastock's formula into AFL -
> ThanksENTER LONG
> wcan= C > O;
> MACD() > Mov(MACD(), 9, E) AND C > O AND O < L+(H-L) * 0.5 AND ((C/O)
> - 1) * 100 >=1 AND Sum(wcan,2) <=1 CLOSE LONG
> wcan:= C > O;
> buyprice:= ValueWhen(1, MACD() > Mov(MACD(),9,E) AND C > O AND O < L
> + (H-L) * 0.5 AND ((C/O) - 1) * 100 >=1 AND Sum(wcan,2) < = 1,C);
> cond1:= MACD() < Mov(MACD(),9,E);
> cond2:= (C/buyprice >= 0 AND BarsSince(MACD() > Mov(MACD(),9,E) AND C
> > O AND O < L+(H-L)*0.5 AND ((C/O)-1)*100 >= 1 AND Sum(wcan,2) <= 1)
> >= 17);
> cond1 OR cond2 ENTER SHORT
> bcan:=C<=O;
> cond1:=MACD()<Mov(MACD(),9,E);
> cond1 AND bcan=1 AND C<L+(H-L)*0.2 AND Sum(bcan,3)<=1 CLOSE
> SHORT bcan:=C<=O;
> cond1:=MACD()>Mov(MACD(),9,E);
> sellprice:=ValueWhen(1,cond1 AND bcan=1 AND C<L+(H-L)*0.2 AND
> Sum(bcan,3)<=1,C);
> cond2:=(sellprice>=0 AND BarsSince(cond1 AND bcan=1 AND
> C<L+(H-L)*0.2 AND Sum(bcan,3)<=1)>=50);
> cond1 OR cond2 ThanksPeter
>
>
> Yahoo! Groups Sponsor
ADVERTISEMENT
[Click Here!]
>
> Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.