.

Magic Ribbon with Buy Sell Zone - Amibroker AFL Code

Click Image To Enlarge. Please Rate And Comment.

Magic Ribbon with Buy Sell Zone

_SECTION_BEGIN("momentum");
A=EMA(C,10);
B=EMA(C,50); 
s1 = a/b;
s2 = EMA((A/B),2);
s_h = IIf(EMA((a/b),55) > EMA((a/b),30),EMA((a/b),55),EMA((a/b),30));
s_l = IIf(EMA((a/b),55) < EMA((a/b),30),EMA((a/b),55),EMA((a/b),30));  
Col_cloud = IIf(s1 > s_h AND s1 > EMA((a/b),15),colorBrightGreen,IIf(s1 > EMA((a/b),15),colorDarkGreen,IIf(s1 < EMA((a/b),15) AND s1 < s_l,colorRed,colorDarkRed)));
Plot(A/B,"",IIf(A/B > Ref(A/B,-1),colorGreen,colorRed),styleLine+styleDots);
//PlotOHLC(s1,IIf(s2 > s1,s2,s1),IIf(s2 > s1,s1,s2),s1,"",Col_cloud,styleCloud);

//Plot(EMA((A/B),2),"",col_cloud,styleLine+styleNoLabel);

Plot(EMA((a/b),3),"",IIf(a/b > EMA((a/b),3),colorLightBlue,colorDarkBlue),styleLine);
Plot(EMA((a/b),5),"",IIf(a/b > EMA((a/b),5),colorLightBlue,colorDarkBlue),styleLine);
Plot(EMA((a/b),8),"",IIf(a/b > EMA((a/b),8),colorLightBlue,colorDarkBlue),styleLine);
Plot(EMA((a/b),10),"",IIf(a/b > EMA((a/b),10),colorLightBlue,colorDarkBlue),styleLine);
Plot(EMA((a/b),12),"",IIf(a/b > EMA((a/b),12),colorLightBlue,colorDarkBlue),styleLine);
Plot(EMA((a/b),15),"",IIf(a/b > EMA((a/b),15),colorLightBlue,colorDarkBlue),styleLine);

Plot(EMA((a/b),30),"",colorYellow,styleLine);
Plot(EMA((a/b),34),"",colorRed,styleLine+styleNoLabel);
Plot(EMA((a/b),40),"",colorRed,styleLine+styleNoLabel);
Plot(EMA((a/b),45),"",colorRed,styleLine+styleNoLabel);
Plot(EMA((a/b),50),"",colorRed,styleLine+styleNoLabel);
Plot(EMA((a/b),55),"",colorRed,styleLine);


//Plot(Ref(A/B,-2),"",colorBlue,styleLine);


_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)+ "MAGIC RIBBON TRADING SYSTEM" + " - " +  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(6, "", Col_cloud, styleOwnScale| styleArea|styleNoLabel,-0.5,100);
Previous Post Next Post