Buy Sell conditions

I am use amibroker plz set afl code Some Places shows Correct Signal and Some Places Show Buy and Sell Arrow in First Candle. we want Buy and Sell Arrow when Breakout pre.High + 5 AND it should be in Up Trend for Buy or Breakout Pre.Low - 5 AND it should be in Down Trend for Sell.

As per above condition, code based on high and low

pds = Optimize("pds" ,10,2,25, 1); 
 
 CB = LLV(C,pds); 
 CS = HHV(C,pds); 
 mav = TEMA(C,50); 

 Plot(Ref(CB, -1),"Long setup",colorBrightGreen); 
 Plot(Ref(CS, -1),"Short setup",colorRed) ; 
 Plot(Ref(mav, -1),"MA", colorGold, styleThick) ; 
 
 Buy= C < Ref(CB,-1); 
 Buy = Ref(Buy,-1); 
 BuyPrice = O; 
 
 Sell = C > Ref(CS,-1); 
 Sell = Ref(Sell,-1) ; 
 SellPrice = O; 
 
 Buy = ExRem(Buy,Sell) ; 
 Sell = ExRem(Sell,Buy) ; 
 
 SetChartOptions( 0, chartShowDates) ; 
 GraphXSpace = 5; 
 Plot(C,"C",1, 64); 
 
 PlotShapes(IIf( Buy,shapeSmallUpTriangle, 0),colorWhite, layer = 0,
yposition = BuyPrice, offset = 0 ); 
 PlotShapes(IIf( Sell,shapeDownArrow,0),colorYellow, layer = 0,
yposition = SellPrice, offset = 0 ); 
_SECTION_BEGIN("HH_LL");
period= Param("period", 14, 1, 240, 1);
 
sell_lvl = LLV(C,period); 
 buy_lvl = HHV(C,period); 
 
 Buy_val = Ref(buy_lvl,-1) + 5;
 Sell_val = Ref(sell_lvl,-1) - 5;
 
 Buy = Close > Buy_val;
 Sell =  Close < Sell_val;
 
 Buy = ExRem(Buy,Sell);
 Sell = ExRem(Sell,Buy);
 
 Plot(Ref(buy_lvl , -1),"Buy",colorGreen); 
 Plot(Ref(sell_lvl, -1),"Sell",colorRed) ; 

PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorGreen, 0,L); 
        
PlotShapes(IIf(Sell, shapeDownArrow, shapeNone),colorRed, 0,H);

Plot(Close,"Close",colorGreen,styleCandle);

_SECTION_END();

Regards

Vivith

www.neotradeanalytics.com

(authorized vendor of NSE supporting realtime data feeds to Amibroker, Metastock and Ninjatrader)

1 Like

hello brother…

i need a renko afl which have buy and sell signals…is there any chance for u to provide me if not renko then please provide me the best afl in amibroker which can give 90% accurate buy and sell signals…kindly help me it will be a great help if u can do it