Short-Long-Term-Support-Resistance-Expert

Short-Long-Term-Support-Resistance-Expert
Short-Long-Term-Support-Resistance-Expert



//www.aflcode.com
_SECTION_BEGIN("ADX"); 
pl = (Ref(H,-1)+Ref(L,-1)+Ref(C,-1)+O)/4;
Col_pl = IIf(pl > Ref(pl,-1),colorGreen,colorRed); 
Plot (PL,"trend",Col_pl,styleThick);
range = Param("trend period", 14, 2, 200, 1 ); 
em = Param("EMA Of the trend",5,1,20,1);
p = EMA(PDI(range),em);
m = EMA(MDI(range),em);
pe = p-m;
bbtop = BBandTop(pe,5,0.5);
bbbot = BBandBot(pe,5,0.5);

Col_pm = IIf(p > m, colorDarkGreen,colorDarkRed);
Buy = pe > bbtop AND Col_pl == colorGreen;
Sell = pe < bbbot AND Col_pl == colorRed;
Col_bar =IIf(Buy AND p > Ref(p,-1),colorAqua,IIf(Sell AND m > Ref(m,-1),colorRed,IIf(Buy,colorBlue, IIf(Sell,colorDarkRed,colorYellow))));
//Col_bar =IIf(Buy ,colorGreen,IIf(Sell ,colorRed,colorYellow));
Plot(Close,"price",col_bar,styleCandle);
Plot(EMA(High,20),"",colorWhite,styleThick);
Plot(EMA(Low,20),"",colorWhite,styleThick);
Buy = ExRem(Buy,Sell);
Sell = ExRem(Sell,Buy);
//PlotShapes(Buy*shapeHollowSmallUpTriangle,colorBlue);
//PlotShapes(Sell*shapeHollowSmallDownTriangle,colorBlue);

Plot(1, "", Col_pm, styleOwnScale| styleArea|styleNoLabel,-0.5,100);
_SECTION_END();

_SECTION_BEGIN("BB");
bb2top = BBandTop(Close,20,2.25);
bb1top = BBandTop(Close,20,1);
bb2bot = BBandBot(Close,20,2.25);
bb1bot = BBandBot(Close,20,1);
//PlotOHLC( Cc,Cc,80,Cc, "", IIf( Cc > 0, colorGreen, colorRed ), styleCloud | styleClipMinMax, -80, 80 ); 
Plot (bb2top,"",IIf(bb2top > Ref(bb2top,-1) AND bb2bot < Ref(bb2bot,-1),colorBlue,colorGrey40),styleNoLabel);
Plot (bb2bot,"",IIf(bb2top > Ref(bb2top,-1) AND bb2bot < Ref(bb2bot,-1),colorBlue,colorGrey40),styleNoLabel);

  PlotOHLC(bb2top,bb2top,bb1top,bb1top,"",colorDarkGrey,styleCloud); 
  PlotOHLC(bb1bot,bb1bot,bb2bot,bb1bot,"",colorDarkGrey,styleCloud); 
 
Col_action = IIf(Close >bb1top AND p > m,colorBrightGreen,IIf(Close <bb1bot AND p < m,colorRed,colorBlack));  
Plot(2, "", IIf(ADX(7) > Ref(ADX(7),-1),colorBlue,colorBlack), styleOwnScale| styleArea|styleNoLabel,-0.5,100);

Plot(5, "", Col_action, styleOwnScale| styleArea|styleNoLabel,-0.5,100);

_SECTION_END();


_SECTION_BEGIN("Fibo for all bars");

TimeFrameSet( in15Minute*2 ); 
DH=Ref(H,-1); 
DL=Ref(L,-1);
DC=Ref(C,-1);


pd = (O+ DH+ DL + DC )/4;
sd1 = (2*pd)-DH;
sd2 = pd -(DH - DL);
sd3 = Sd1 - (DH-DL); 
rd1 = (2*pd)-DL;
rd2 = pd +(DH -DL);
rd3 = rd1 +(DH-DL);



//Plot (pd,"Pivot",colorBlue,styleDots);
//Plot (rd1," R1 ",35,styleDots);
//Plot (rd2," R2 ",35,styleDots);
//Plot (rd3," R3 ",35,styleDots);

//Plot (sd1," S1 ",4,styleDots);
//Plot (Sd2," S2 ",4,styleDots);
//Plot (Sd3," S3 ",4,8+16);
/*
style = IIf(ParamList("Chart style", "styleCandle|styleBar")=="styleCandle",64,128+4);
Plot (C,Date ()+" close",1,style); //ENABLE THIS TO HAVE CANDLES AS WELL
*/
TimeFrameRestore();


Title = EncodeColor(colorWhite)+ "Short Long Term Expert" + " - " +  Name() + " - " + EncodeColor(colorRed)+ Interval(2) + EncodeColor(colorWhite) +
 "  - " + Date() +" - "
+ WriteIf(Col_action==colorGreen, EncodeColor(colorGreen)+"stay LONG","")+ WriteIf(Col_action==colorRed, EncodeColor(colorRed)+"stay SHORT","")+  WriteIf(Col_action==colorBlack, EncodeColor(colorYellow)+"No Trend","")+"\n"
+ "Vol= "+ WriteVal(V) +WriteIf ( V > MA(V,26) ,EncodeColor(colorGreen)+"  UP "+ (V/MA(V,26))*100 + " %", EncodeColor(colorRed)+"  DOWN "+ (V/MA(V,26))*100 + " %")
+ EncodeColor(colorGreen)+   "\n R3 : "+ EncodeColor(colorWhite)+RD3
+ EncodeColor(colorGreen)+   "\n R2 : "+ EncodeColor(colorWhite)+RD2
+ EncodeColor(colorGreen)+   "\n R1 : "+ EncodeColor(colorWhite)+RD1+ EncodeColor(colorGreen)+   "`            Hi: "+ EncodeColor(colorWhite)+H
+ EncodeColor(colorBlue)+   "\n Pivot : "+ EncodeColor(colorWhite)+pd + EncodeColor(colorYellow)+   "`   Op: "+ EncodeColor(colorWhite)+O+ EncodeColor(colorAqua)+   "Cl: "+ EncodeColor(colorBrightGreen)+C
+ EncodeColor(colorRed)+   "\n S1 : "+ EncodeColor(colorWhite)+SD1+ EncodeColor(colorRed)+   "`            Lo: "+ EncodeColor(colorWhite)+L
+ EncodeColor(colorRed)+   "\n S2 : "+ EncodeColor(colorWhite)+SD2
+ EncodeColor(colorRed)+   "\n S3 : "+ EncodeColor(colorWhite)+SD3
;

_SECTION_END();

//Plot( EMA( Close, 20 ), "", IIf(EMA( Close, 20 ) > MA(EMA( Close, 20 ),3),colorGreen,colorRed),styleThick ); 
//Plot( EMA( Close, 19 ), "", IIf(EMA( Close, 19 ) > MA(EMA( Close, 19 ),3),colorGreen,colorRed),styleThick+styleNoLabel ); 
//Plot( EMA( Close, 21 ), "", IIf(EMA( Close, 21 ) > MA(EMA( Close, 21 ),3),colorGreen,colorRed),styleThick+styleNoLabel ); 
PlotOHLC(EMA( Close, 19 ),IIf(EMA( Close, 19 ) > EMA( Close, 21 ),EMA( Close, 19 ),EMA( Close, 21 )),IIf(EMA( Close, 19 )<EMA( Close, 21 ),EMA( Close, 19 ),EMA( Close, 21 )),EMA( Close, 20 ),"",IIf(EMA( Close, 20 ) > MA(EMA( Close, 20 ),3),colorGreen,colorRed),styleCloud); 

_SECTION_END();
Previous
Next Post »