# Please help to modify below AFL for buy /sell signals

#### chdvicky

##### Member
Please help me to generate buy sell arrows signals & how can i get it in ALERT OUTPUT WINDOW

Buy Condition-1 , when green line cross red line upside
Buy Condition -2 when green line cross yellow line upside
Sell Condition-1 when green line breaks redline downside
Sell Condition-2 when green line breaks yellow line downside
Buy /Sell signal arrow to be generated whenever either condition fulfill

_SECTION_BEGIN("VK SPECIAL");

TRH = IIf(Ref(C, -1) > H, Ref(C, -1), H);
TRL = IIf(Ref(C, -1) < L, Ref(C, -1), L);
ad = IIf(C > Ref(C, -1), C - TRL, IIf(C < Ref(C, -1), C - TRH, 0));
xAD = Cum(ad);
X=nda = Wilders(EMA((xAD-Ref(xAD,-1)),14),7);
Plot(nda, "nda" , colorBrightGreen,4 , styleLine|styleThick);
ndi=0;
Plot(ndi, "ndi" , colorYellow , styleLine|styleThick|styleDots);

_SECTION_BEGIN("TEMA1");
P = ParamField("Price field",-1);
Periods = Param("Periods", 50, 2, 300, 1, 10 );
B= TEMA( P, Periods );
Plot(b, _DEFAULT_NAME(), ParamColor( "ColorRED", colorRed ), ParamStyle("Style") );

_SECTION_END();

#### trade4learn

##### Member
u can try something like this..
BuyPrice = open;
ShortPrice = open;

then put ur conditions for buy
cond1 = Cross(nda,ndi);
cond2 = Cross(nda,b);
cond3= Cross(ndi,nda);
cond4 = Cross(b,nda);

Buy = cond1 AND cond2;
Short = cond3 AND cond4;

pl note that i m no ami expert. But i think ami works this way.

hope this helps

#### trade4learn

##### Member
about plots and alerts u can simply copy paste from any another afl what uses plots and alerts.

#### chdvicky

##### Member
u can try something like this..
BuyPrice = open;
ShortPrice = open;

then put ur conditions for buy
cond1 = Cross(nda,ndi);
cond2 = Cross(nda,b);
cond3= Cross(ndi,nda);
cond4 = Cross(b,nda);

Buy = cond1 AND cond2;
Short = cond3 AND cond4;

pl note that i m no ami expert. But i think ami works this way.

hope this helps
sir, i tried but its not working

## Zerodha – Open Paperless Account

Open online account with Zerodha. Free delivery trading and Max Rs 20 for Intraday, F&O, Currency and Commodity Trading. Intraday High leverage with MIS, CO and BO.

 Name: Phone: Email: City: State: Select StateAndaman and Nicobar IslandsAndhra PradeshArunachal PradeshAssamBiharChhattisgarhDadra and Nagar HaveliDaman and DiuDelhiGoaGujaratHaryanaHimachal PradeshJammu and KashmirJharkhandKarnatakaKeralaLakshadweepMadhya PradeshMaharashtraManipurMeghalayaMizoramNagalandOdishaPuducherryPunjabRajasthanSikkimTamil NaduTelanganaTripuraUttarakhandUttar PradeshWest Bengal Are you a day trader?