buy and sell two EMAS for Amibroker (AFL)
mundo0007 about 14 years ago Amibroker (AFL)
Buy when the bar the maximum current is above the last bar and EMA (17) is greater than EMA (34).
Sell when the high is higher than 0.40% of the EMA (17)
Screenshots
Indicator / Formula
Copy & Paste Friendly
Plot(EMA(C,6),"EMA6", colorGreen );
Plot(EMA(C,17),"EMA17", colorBlue );
Plot(EMA(C,34),"EMA34", colorRed );
Plot(C,"low", colorBrown);
Alvo = 0;
Buy = High > Ref(H,-1) AND Low >= Ref(L,-1) AND Low >= EMA(C,17)AND EMA(C,17) >= EMA(C,34) AND EMA(C,6) >= EMA(C,17)AND((Low / EMA(C,17)-1)*100) <= 0.15 ;
Compra = IIf(Buy==True, Ref(H,-1)+0.01,0);
stop = IIf(Buy==True,Ref(L, -1)-0.02,0);
Alvo = Compra + ((Compra-stop)*2);
Sell = ((High / EMA(C,17)-1)*100) >= 0.40 OR IIf(Hour() > 17,True,False);
//Sell = Low < Ref(L,-1) AND High > Ref(H,-1);
//Sell = Alvo >= High; // AND Hour() < 18;
//Sell = IIf(EMA(C,17) >= EMA(Ref(C,-2),17),False,True); // vende quando as medias moveis cai
Buy = ExRem( Buy, Sell );
Sell = ExRem( Sell, Buy );
dist = 2*ATR(10);
for( i = 0; i < BarCount; i++ )
{
if( Buy[i] ) PlotText( "Compra:\n"+compra[i]+"\n Stop:\n" + stop[i]+"\n Alvo:\n" + Alvo[i], i, L[ i ]-dist[i], colorGreen );
if( Sell[i] ) PlotText( "Venda\n@" + C[ i ], i, H[ i ]+dist[i], colorRed, colorYellow );
}
PlotShapes(Buy*shapeUpArrow,colorGreen,0,Low);
PlotShapes(Sell*shapeDownArrow,colorRed,0,High);1 comments
Leave Comment
Please login here to leave a comment.
obrigado ( Mundooo7 ) Amigo , bonito formulas