Long Term Trend Catcher


Long Term Trend Catcher
Long Term Trend Catcher

//www.aflcode.com
/* Condition 1. MACD (12,26,9) is Below Zero & Stochastic (20,5,5) 
has given negative Cross over, Plot Sell Signal if satisfy the condition & 
Close below previous candle (Day) Low

Condition 2. MACD (12,26,9) is above Zero & Stochastic (20,5,5) 
has given positive Cross over, Plot Buy Signal if satisfy the condition & 
Close above previous candle (Day) High


*/
Cond1=MACD()<0;
cond2=Cross(StochD(20,5,5), StochK(20,5));
Cond3=C<Ref(L,-1);

Sell = Cond1 AND Cond2 AND Cond3;

Cond4=MACD()>0;
cond5=Cross(StochK(20,5), StochD(20,5,5));
Cond6=C>Ref(H,-1);

Buy = Cond4 AND Cond5 AND Cond6;

Buy = ExRem(Buy,Sell);
Sell=ExRem(Sell,Buy);
//barcolor1=IIf(Buy,colorGreen,colorRed);

//PlotOHLC(O,H,L,C,"C",barcolor1);


//Plot Price
barcolor = IIf(MACD()>0, ParamColor("Up Color",colorBrightGreen), 
           IIf(MACD()<0,colorRed,ParamColor("Dn Color",colorRed))); 
Plot( C, "Close", barcolor, ParamStyle("Style",styleThick+styleNoLabel) | GetPriceStyle());


PlotShapes(shapeUpArrow * Buy,colorWhite,0,L);
PlotShapes(shapeDownArrow * Sell,colorYellow,0,H);

Previous
Next Post »