AFL writing guide for new user

KelvinHand

Well-Known Member
#91
DM sir,

I want make AFL , buy generated when DISP moving average (30,15 ) croses EMA 15.. & SEll generated when ema15 crosses DISP moving average (30, 15)..

I have learn to make crossover of simple Moving average from this thread but i m not able to make DISP moving average crossover AFL..

I request u to help whenever u get free time..

regds
Easy!!!
Period = Param("Period", 30, 1,200);
Shift = Param("Shift", 15, -200,200);
DISP_SMA = Ref(MA(C, Period), -Shift);
EMA1 = ema(C, 15);
Buy = cross(DISP_SMA, EMA1);
Sell = cross(EMA1,DISP_SMA);

To plot DISP_SMA, do this
Plot( MA(C, Period), "DMA", ColorRed, styleLine, 0, 0, Shift);
 
#93
Kelvinji,
Heartly thanks for your kind support..

but it is only showing line of DMA & EMA .. How buy signal will come if ema 15 crosses disp (30,15) & how sell signal will come if ema 15 crosses ..???

regds,
appended the code with buy/sell signal, try this-

Code:
Period = Param("Period", 30, 1,200);
Shift = Param("Shift", 15, -200,200);
DISP_SMA = Ref(MA(C, Period), -Shift);
EMA1 = EMA(C, 15);
Buy = Cross(DISP_SMA, EMA1);
Sell = Cross(EMA1,DISP_SMA);

//To Plot DISP_SMA, do this 
Plot( MA(C, Period), "DMA", colorRed, styleLine, 0, 0, Shift);

Buy=ExRem(Buy,Sell);
Sell=ExRem(Sell,Buy);
PlotShapes(Buy*shapeUpArrow+Sell*shapeDownArrow,IIf(Buy,colorGreen,IIf(Sell,colorRed,Null)));
 

Shantala

Well-Known Member
#94
Please help me writing this afl

Scan AFL for NR7 weekly high/low breakout (do not want chart plotting or exploration, only scan needed)

Skeleton

1) Find first NR7 in last 6 days excluding today.
2) Find Highest High and Lowest Low in 7 days of NR7.
3) Highest high or lowest low should not be broken out until today from NR7 day.
4) Generate following signals
a) BUY if today close is higher than highest high of NR7.
b) SELL if today close is lower than lowest low of NR7.
 
#97
I am very happy that many of Traderji is participating in helping other in AFL writing.
Thank you to all.
 
#98
:clapping: Thank you for this helpful thread.
can I ask here one query which I want to see it in ami AFL language.
somewhere in metatrader one person shown me one chart
(but I don't know how it built )
which contains weighted RSI bb indicator, STI indicator.
can we get the same in amibroker charts also. where can we get the code.
 
Last edited:
Help about Message Box

Hi DM,
Thanks and congrats on starting a thread like this. I have gone through almost all the posts in thread.
I have one query about my trading system. I want a message box to be flashed and a beep when buy or sell condition is satisfied. Say for example if Reliance becomes buy then it should flash message like this Reliance is buy. It should also flash the time at which this signal was generated.

Thanks in advance.

Cheers :!!!!!
 

Similar threads