Was done in a hurry... and i am no expert in AFL. So can not assure if this is a efficient code.. But it does what you have asked for...
Use this in 1 Min and you will see Green up triangles when your Buy condition is satisfied and red down arrows when your condition is satisfied.
Plot( C, "Close", ParamColor("Color", colorDefault ), GetPriceStyle());
fa = Optimize( "MACD Fast", 12, 5, 12, 1 );
sa = Optimize("MACD Slow", 26, 26, 34, 1 );
sig = Optimize( "Signal average", 9, 5, 9, 1 );
TimeFrameSet( in15Minute );
EMA20300=EMA(C,20);
EMA50300=EMA(C,50);
EMA100300=EMA(C,100);
EMA200300=EMA(C,200);
Buy15 = MACD( fa, sa )> Signal( fa, sa, sig );
Sell15 = MACD( fa, sa )< Signal( fa, sa, sig );
TimeFrameRestore();
EMA1520=TimeFrameExpand( EMA20300,in15Minute );
EMA1550=TimeFrameExpand( EMA50300,in15Minute );
EMA15100=TimeFrameExpand( EMA100300,in15Minute );
EMA15200=TimeFrameExpand( EMA200300,in15Minute );
Buy1 = TimeFrameExpand( Buy15 ,in15Minute );
Sell1 = TimeFrameExpand( Sell15 ,in15Minute );
Buy=O<C AND C>EMA(C,20) AND C>EMA(C,50) AND C>EMA(C,100) AND C>EMA(C,200) AND C>EMA1520 AND C>EMA1550 AND C>EMA15100 AND C>EMA15200 AND Buy1;
Sell=O>C AND C<EMA(C,20) AND C<EMA(C,50) AND C<EMA(C,100) AND C<EMA(C,200) AND C<EMA1520 AND C<EMA1550 AND C<EMA15100 AND C<EMA15200 AND Sell1;
Plot(EMA(C,20),"EMA 20",colorRed,styleLine);
Plot(EMA(C,50),"EMA 50",colorYellow,styleLine);
Plot(EMA(C,100),"EMA 100",colorGreen,styleLine);
Plot(EMA(C,200),"EMA 200",colorViolet,styleLine);
PlotShapes(IIf(Buy,shapeUpTriangle,shapeNone),colorGreen,layer = 0, L-2);
PlotShapes(IIf(Sell,shapeDownTriangle,shapeNone),colorRed,layer = 0, H+2);
Hai , I have a well tested strategy , but i canot make AFL as i donot know computer programming. If any senior can help to convert that strategy in to AFL , it will be very helpful for me and as well as other visitors of this forum.
The strategy for buy is :
condition 1 : MACD crossover in buy for 15 minutes timeframe.
condition 2 : EMA20 > EMA50 > EMA100 > EMA200 in 15 minutes timeframe and price close is above EMA20.
condition 3 : EMA20 > EMA50 > EMA100 > EMA200 in 1 minute timeframe and price close is above EMA20.
If all three conditions are satisfied then it is a strong buy signal . The vice-versa is valid for strong sell signal.
thanks a lot in advance to seniors.