Need AFL from specified logics

#1
Hello,

Can someone from you please help me in creating AFL as per below logic ?

BUY = EMA(CLOSE, 5) > SMA (CLOSE, 20) AND RSI (CLOSE, 21) < 40
SELL = EMA(CLOSE, 5) < SMA (CLOSE, 20) AND RSI (CLOSE, 21) > 60

BUY EXIT = RSI (CLOSE, 21) > 80
SELL EXIT = RSI (CLOSE, 21) < 30
 

pratapvb

Well-Known Member
#2
Hello,

Can someone from you please help me in creating AFL as per below logic ?

BUY = EMA(CLOSE, 5) > SMA (CLOSE, 20) AND RSI (CLOSE, 21) < 40
SELL = EMA(CLOSE, 5) < SMA (CLOSE, 20) AND RSI (CLOSE, 21) > 60

BUY EXIT = RSI (CLOSE, 21) > 80
SELL EXIT = RSI (CLOSE, 21) < 30
won't you exit buy on any other conditions....for e.g. ema cross but above rs 60
 
#3
Thanks Pratap for replying on my request.

Actyally i don't have much knowledge about the code. I got this code very useful in nest trader so wanted to create afl so that i can use it in amibroker.

If it is difficult to create AFL with mentioned buy/sell exit call than you can create it without exit alert.
 

pratapvb

Well-Known Member
#4
Hello,

Can someone from you please help me in creating AFL as per below logic ?

BUY = EMA(CLOSE, 5) > SMA (CLOSE, 20) AND RSI (CLOSE, 21) < 40
SELL = EMA(CLOSE, 5) < SMA (CLOSE, 20) AND RSI (CLOSE, 21) > 60

BUY EXIT = RSI (CLOSE, 21) > 80
SELL EXIT = RSI (CLOSE, 21) < 30
code below. But according to me the RSI condition in the buy and sell (short) is making it no signal situation as most buy cross over are happening above rsi 40 and short cross over below rsi of 60


Code:
Buy = EMA(Close, 5) > MA (Close, 20) AND RSI (21) < 40 ;
Short = EMA(Close, 5) < MA (Close, 20) AND RSI (21) > 60 ;

Cover = RSI (21) > 80 ;
Sell = RSI (21) < 30 ;


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

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

PlotShapes(Cover*shapeUpArrow, colorBlack, 0, L, -12) ;
PlotShapes(Sell*shapeDownArrow, colorBlack, 0, H, -12) ;

PlotShapes(Buy*shapeUpArrow, colorBlue, 0, H, 12) ;
PlotShapes(Short*shapeDownArrow, colorRed, 0, L, 12) ;
 

Similar threads

Intraday Higher Leverage

Save up to 90% in brokerage and get higher leverage for intraday trades.

Name:Phone:
Email:City:
State:
Are you a day trader?