AFL for MOMENTUM TRADING
This formula gives long & short entry points in trending markets. Use it with any oscillator.
Script:
_SECTION_BEGIN(“MT_UP”);
Typical = ( Close + Low + High ) / 3;
BullishCandleCheck = Low + (High – Low)*0.75;
BearishCandleCheck = High – (High – Low)*0.75;
Typical = ( Close + Low + High ) / 3;
BUY1 = EMA( Close , 20 ) > EMA( Close , 50 )
AND EMA( Close , 20 ) > Ref( EMA( Close , 20 ) , -5 )
AND EMA( Close , 50 ) > Ref( EMA( Close , 50 ) , -12 );
BUY2 = Close < (1.5*ATR(5) + LLV(Low,5));
BUY3 = HHV(Close,15) == HHV(Close ,45);
BUY4 = Cross(C,EMA(C,10))
AND IIf(Close > Open, Close > Typical, Close > BullishCandlecheck);
BUY5 = Close > Ref(Close,-1)
AND Cross(Ref(C,-1),Ref(EMA(C,10),-1));
Buy = BUY1 AND BUY2 AND BUY3 AND (BUY4 OR BUY5);
Sell = 0;
// Buy=ExRem(Buy,Sell) ;
// Sell=ExRem(Sell,Buy);
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorRed, 0, L, Offset=-40);
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorGreen, 0,L, Offset=-50);
PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-45);
SHORT1 = EMA( Close , 20 ) < EMA( Close , 50 )
AND EMA( Close , 20 ) < Ref( EMA( Close , 20 ) , -5 )
AND EMA( Close , 50 ) < Ref( EMA( Close , 50 ) , -12 );
SHORT2 = Close > (HHV(High,5) – 1.5*ATR(5));
SHORT3 = LLV(Close,15) == LLV(Close ,45);
SHORT4 = Cross(EMA(C,10),C)
AND IIf(Close < Open, Close < Typical, Close < BullishCandlecheck);
SHORT5 = Close < Ref(Close,-1)
AND Cross(Ref(EMA(C,10),-1),Ref(C,-1));
Short = SHORT1 AND SHORT2 AND SHORT3 AND (SHORT4 OR SHORT5);
Cover = 0;
PlotShapes(IIf(Short, shapeSquare, shapeNone),colorRed, 0, H, Offset=40);
PlotShapes(IIf(Short, shapeSquare, shapeNone),colorGreen, 0,H, Offset=50);
PlotShapes(IIf(Short, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-45);
_SECTION_END();