// Downloaded From https://www.WiseStockTrader.com _SECTION_BEGIN("Background Color"); BKswitch = ParamToggle("Background Color","On,Off"); OUTcolor = ParamColor("Outer Panel Color",colorBlack); INUPcolor = ParamColor("Inner Panel Upper",colorBlack); INDNcolor = ParamColor("Inner Panel Lower",colorBlack); TitleColor = ParamColor("Title Color ",colorBlack); if (NOT BKswitch) { SetChartBkColor(OUTcolor); // color of outer border SetChartBkGradientFill(INUPcolor,INDNcolor,TitleColor); // color of inner panel } _SECTION_END(); _SECTION_BEGIN("Smooth CCI 8-4"); ///// Smooth CCI ////// x=12; Y=6; x1=CCI(x); Y2=DEMA(x1,Y); Z=3;//Param("Signal Line 3 - 9",3,3,9,1); Z2=MA(Y2,Z); //==================================================================================================================================== Buy_8_4 = Cross(x1,Y2); Sell_8_4 = Cross(Y2,x1); Buy_8_4=ExRem(Buy_8_4,Sell_8_4); Sell_8_4=ExRem(Sell_8_4,Buy_8_4); //==================================================================================================================================== _SECTION_END(); //======================================================================================= _SECTION_BEGIN("debdulal"); //Title="Indicator Developed and Conceptualised by Debdulal And Soumya"; //SetChartOptions(0,chartShowArrows|chartShowDates); //_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) Vol " + //WriteVal( V, 1.0 ) +" {{VALUES}}", //O, H, L, C, SelectedValue( ROC( C, 1 )) )); // This part will plot the EMA value And type of user choice EMAstyle=ParamStyle("MAType",styleLine,maskAll ); LTEMAcolor=ParamColor("LT EMA Colour" ,colorRed); STEMAcolor=ParamColor("ST EMA Colour",colorGreen); LTEMAPeriod=Param("LTEMA Period",30); STEMAPeriod=Param("STEMA Period",13); //Plot(EMA(Close,STEMAPeriod),"EMA of "+STEMAPeriod+" Days" , STEMAcolor, EMAstyle, Null, Null ); //Plot(EMA(Close,LTEMAPeriod), "EMA of "+LTEMAPeriod+" Days", LTEMAcolor, EMAstyle, Null, Null ); //Plot(SAR(.02,.2),"SAR",colorBlue,maskAll,Null,Null); // This part will plot Closing price with barstyle choosen by user ChartStyl=ParamStyle("Chart Type", styleBar,maskAll ); Chartcolor=ParamColor("Chart Colour",colorGreen); //Plot(Close,"Debdulal",Chartcolor,ChartStyl); // This part will find the buy and sell point in the chart SellTRIGGER=MACD(12,26)<= Signal(12,26,9); Buy_debdulal=Cross(MACD(12,26),Signal(12,26,9)); Sell_debdulal=(EMA(Close,LTEMAperiod)>EMA(Close,STEMAperiod)) AND SellTRIGGER; //Buy= MACD(12,26)>=Signal(12,26,9); //Sell=MACD(12,26)Ref(r,-1),1,IIf(L=0,TRIXMA,TRIXMA*-1),99)*6.8540; TrixMAUpper3= MA(IIf(TRIXMA>=0,TRIXMA,TRIXMA*-1),99)*4.2360; TrixMAUpper2= MA(IIf(TRIXMA>=0,TRIXMA,TRIXMA*-1),99)*2.6180; TrixMAUpper1= MA(IIf(TRIXMA>=0,TRIXMA,TRIXMA*-1),99)*1.6180; TrixMALower1= MA(IIf(TRIXMA>=0,TRIXMA*-1,TRIXMA),99)*1.6180; TrixMALower2= MA(IIf(TRIXMA>=0,TRIXMA*-1,TRIXMA),99)*2.6180; TrixMALower3= MA(IIf(TRIXMA>=0,TRIXMA*-1,TRIXMA),99)*4.2360; TrixMALower4= MA(IIf(TRIXMA>=0,TRIXMA*-1,TRIXMA),99)*6.8540; Plot( TrixM, "TRIXM", colorBlue ); Plot( TrixMA, "TRIXMA", colorLime); Plot(0,"",colorDarkYellow); if (NOT ParamToggle("FiboBands 4","On,Off")) { Plot( TrixMAUpper4, "", colorDarkTeal); Plot( TrixMALower4, "", colorDarkTeal); } if (NOT ParamToggle("FiboBands 3","On,Off")) { Plot( TrixMAUpper3, "", colorDarkGrey); Plot( TrixMALower3, "", colorDarkGrey); } if (NOT ParamToggle("FiboBands 2","On,Off")) { Plot( TrixMAUpper2, "", colorDarkRed); Plot( TrixMALower2, "", colorDarkRed); } if (NOT ParamToggle("FiboBands 1","On,Off")) { Plot( TrixMAUpper1, "", colorViolet); Plot( TrixMALower1, "", colorViolet); } Buy = Cross(TrixM,TrixMA); Sell = Cross(TrixMA,TrixM); Short = Sell; Cover = Buy; Lower_1= Trixma-Trixm>Ref(Trixma,-1)-Ref(Trixm,-1) AND trixma>trixm AND Ref(trixma,-1)>Ref(trixm,-1); Lower_2= Lower_1 AND Ref(Trixma,-1)-Ref(Trixm,-1)>Ref(Trixma,-2)-Ref(Trixm,-2) AND Ref(trixma,-2)>Ref(trixm,-2); Lower_3= Lower_2 AND Ref(Trixma,-2)-Ref(Trixm,-2)>Ref(Trixma,-3)-Ref(Trixm,-3) AND Ref(trixma,-3)>Ref(trixm,-3); Lower_4= Lower_3 AND Ref(Trixma,-3)-Ref(Trixm,-3)>Ref(Trixma,-4)-Ref(Trixm,-4) AND Ref(trixma,-4)>Ref(trixm,-4) ; Lower_5= Lower_4 AND Ref(Trixma,-4)-Ref(Trixm,-4)>Ref(Trixma,-5)-Ref(Trixm,-5) AND Ref(trixma,-5)>Ref(trixm,-5); Lower_6= Lower_5 AND Ref(Trixma,-5)-Ref(Trixm,-5)>Ref(Trixma,-6)-Ref(Trixm,-6) AND Ref(trixma,-6)>Ref(trixm,-6); Lower_7= Lower_6 AND Ref(Trixma,-6)-Ref(Trixm,-6)>Ref(Trixma,-7)-Ref(Trixm,-7) AND Ref(trixma,-7)>Ref(trixm,-7); Lower_8= Lower_7 AND Ref(Trixma,-7)-Ref(Trixm,-7)>Ref(Trixma,-8)-Ref(Trixm,-8) AND Ref(trixma,-8)>Ref(trixm,-8); Lower_9= Lower_8 AND Ref(Trixma,-8)-Ref(Trixm,-8)>Ref(Trixma,-9)-Ref(Trixm,-9) AND Ref(trixma,-9)>Ref(trixm,-9); Lower_10= Lower_9 AND Ref(Trixma,-9)-Ref(Trixm,-9)>Ref(Trixma,-10)-Ref(Trixm,-10) AND Ref(trixma,-10)>Ref(trixm,-10); Lower_11= Lower_10 AND Ref(Trixma,-10)-Ref(Trixm,-10)>Ref(Trixma,-11)-Ref(Trixm,-11) AND Ref(trixma,-11)>Ref(trixm,-11); Lower_12= Lower_11 AND Ref(Trixma,-11)-Ref(Trixm,-11)>Ref(Trixma,-12)-Ref(Trixm,-12) AND Ref(trixma,-12)>Ref(trixm,-12); Lower_13= Lower_12 AND Ref(Trixma,-12)-Ref(Trixm,-12)>Ref(Trixma,-13)-Ref(Trixm,-13) AND Ref(trixma,-13)>Ref(trixm,-13); Lower_14= Lower_13 AND Ref(Trixma,-13)-Ref(Trixm,-13)>Ref(Trixma,-14)-Ref(Trixm,-14) AND Ref(trixma,-14)>Ref(trixm,-14); Lower_15= Lower_14 AND Ref(Trixma,-14)-Ref(Trixm,-14)>Ref(Trixma,-15)-Ref(Trixm,-15) AND Ref(trixma,-15)>Ref(trixm,-15); Lower_16= Lower_15 AND Ref(Trixma,-15)-Ref(Trixm,-15)>Ref(Trixma,-16)-Ref(Trixm,-16) AND Ref(trixma,-16)>Ref(trixm,-16); Lower_17= Lower_16 AND Ref(Trixma,-16)-Ref(Trixm,-16)>Ref(Trixma,-17)-Ref(Trixm,-17) AND Ref(trixma,-17)>Ref(trixm,-17); Lower_18= Lower_17 AND Ref(Trixma,-17)-Ref(Trixm,-17)>Ref(Trixma,-18)-Ref(Trixm,-18) AND Ref(trixma,-18)>Ref(trixm,-18); Not_Lower_1= Trixma-Trixm<=Ref(Trixma,-1)-Ref(Trixm,-1) AND trixma>trixm AND Ref(trixma,-1)>Ref(trixm,-1); Not_Lower_2= Not_Lower_1 AND Ref(Trixma,-1)-Ref(Trixm,-1)<=Ref(Trixma,-2)-Ref(Trixm,-2) AND Ref(trixma,-2)>Ref(trixm,-2); Not_Lower_3= Not_Lower_2 AND Ref(Trixma,-2)-Ref(Trixm,-2)<=Ref(Trixma,-3)-Ref(Trixm,-3) AND Ref(trixma,-3)>Ref(trixm,-3); Not_Lower_4= Not_Lower_3 AND Ref(Trixma,-3)-Ref(Trixm,-3)<=Ref(Trixma,-4)-Ref(Trixm,-4) AND Ref(trixma,-4)>Ref(trixm,-4) ; Not_Lower_5= Not_Lower_4 AND Ref(Trixma,-4)-Ref(Trixm,-4)<=Ref(Trixma,-5)-Ref(Trixm,-5) AND Ref(trixma,-5)>Ref(trixm,-5); Not_Lower_6= Not_Lower_5 AND Ref(Trixma,-5)-Ref(Trixm,-5)<=Ref(Trixma,-6)-Ref(Trixm,-6) AND Ref(trixma,-6)>Ref(trixm,-6); Not_Lower_7= Not_Lower_6 AND Ref(Trixma,-6)-Ref(Trixm,-6)<=Ref(Trixma,-7)-Ref(Trixm,-7) AND Ref(trixma,-7)>Ref(trixm,-7); Not_Lower_8= Not_Lower_7 AND Ref(Trixma,-7)-Ref(Trixm,-7)<=Ref(Trixma,-8)-Ref(Trixm,-8) AND Ref(trixma,-8)>Ref(trixm,-8); Not_Lower_9= Not_Lower_8 AND Ref(Trixma,-8)-Ref(Trixm,-8)<=Ref(Trixma,-9)-Ref(Trixm,-9) AND Ref(trixma,-9)>Ref(trixm,-9); Not_Lower_10= Not_Lower_9 AND Ref(Trixma,-9)-Ref(Trixm,-9)<=Ref(Trixma,-10)-Ref(Trixm,-10) AND Ref(trixma,-10)>Ref(trixm,-10); Not_Lower_11= Not_Lower_10 AND Ref(Trixma,-10)-Ref(Trixm,-10)<=Ref(Trixma,-11)-Ref(Trixm,-11) AND Ref(trixma,-11)>Ref(trixm,-11); Not_Lower_12= Not_Lower_11 AND Ref(Trixma,-11)-Ref(Trixm,-11)<=Ref(Trixma,-12)-Ref(Trixm,-12) AND Ref(trixma,-12)>Ref(trixm,-12); Not_Lower_13= Not_Lower_12 AND Ref(Trixma,-12)-Ref(Trixm,-12)<=Ref(Trixma,-13)-Ref(Trixm,-13) AND Ref(trixma,-13)>Ref(trixm,-13); Not_Lower_14= Not_Lower_13 AND Ref(Trixma,-13)-Ref(Trixm,-13)<=Ref(Trixma,-14)-Ref(Trixm,-14) AND Ref(trixma,-14)>Ref(trixm,-14); Not_Lower_15= Not_Lower_14 AND Ref(Trixma,-14)-Ref(Trixm,-14)<=Ref(Trixma,-15)-Ref(Trixm,-15) AND Ref(trixma,-15)>Ref(trixm,-15); Not_Lower_16= Not_Lower_15 AND Ref(Trixma,-15)-Ref(Trixm,-15)<=Ref(Trixma,-16)-Ref(Trixm,-16) AND Ref(trixma,-16)>Ref(trixm,-16); Not_Lower_17= Not_Lower_16 AND Ref(Trixma,-16)-Ref(Trixm,-16)<=Ref(Trixma,-17)-Ref(Trixm,-17) AND Ref(trixma,-17)>Ref(trixm,-17); Not_Lower_18= Not_Lower_17 AND Ref(Trixma,-17)-Ref(Trixm,-17)<=Ref(Trixma,-18)-Ref(Trixm,-18) AND Ref(trixma,-18)>Ref(trixm,-18); Upper_1= Trixm-Trixma>Ref(Trixm,-1)-Ref(Trixma,-1) AND trixm>trixma AND Ref(trixm,-1)>Ref(trixma,-1); Upper_2= Upper_1 AND Ref(Trixm,-1)-Ref(Trixma,-1)>Ref(Trixm,-2)-Ref(Trixma,-2) AND Ref(trixm,-2)>Ref(trixma,-2); Upper_3= Upper_2 AND Ref(Trixm,-2)-Ref(Trixma,-2)>Ref(Trixm,-3)-Ref(Trixma,-3) AND Ref(trixm,-3)>Ref(trixma,-3); Upper_4= Upper_3 AND Ref(Trixm,-3)-Ref(Trixma,-3)>Ref(Trixm,-4)-Ref(Trixma,-4) AND Ref(trixm,-4)>Ref(trixma,-4); Upper_5= Upper_4 AND Ref(Trixm,-4)-Ref(Trixma,-4)>Ref(Trixm,-5)-Ref(Trixma,-5) AND Ref(trixm,-5)>Ref(trixma,-5); Upper_6= Upper_5 AND Ref(Trixm,-5)-Ref(Trixma,-5)>Ref(Trixm,-6)-Ref(Trixma,-6) AND Ref(trixm,-6)>Ref(trixma,-6); Upper_7= Upper_6 AND Ref(Trixm,-6)-Ref(Trixma,-6)>Ref(Trixm,-7)-Ref(Trixma,-7) AND Ref(trixm,-7)>Ref(trixma,-7); Upper_8= Upper_7 AND Ref(Trixm,-7)-Ref(Trixma,-7)>Ref(Trixm,-8)-Ref(Trixma,-8) AND Ref(trixm,-8)>Ref(trixma,-8); Upper_9= Upper_8 AND Ref(Trixm,-8)-Ref(Trixma,-8)>Ref(Trixm,-9)-Ref(Trixma,-9) AND Ref(trixm,-9)>Ref(trixma,-9); Upper_10= Upper_9 AND Ref(Trixm,-9)-Ref(Trixma,-9)>Ref(Trixm,-10)-Ref(Trixma,-10) AND Ref(trixm,-10)>Ref(trixma,-10); Upper_11= Upper_10 AND Ref(Trixm,-10)-Ref(Trixma,-10)>Ref(Trixm,-11)-Ref(Trixma,-11) AND Ref(trixm,-11)>Ref(trixma,-11); Upper_12= Upper_11 AND Ref(Trixm,-11)-Ref(Trixma,-11)>Ref(Trixm,-12)-Ref(Trixma,-12) AND Ref(trixm,-12)>Ref(trixma,-12); Upper_13= Upper_12 AND Ref(Trixm,-12)-Ref(Trixma,-12)>Ref(Trixm,-13)-Ref(Trixma,-13) AND Ref(trixm,-13)>Ref(trixma,-13); Upper_14= Upper_13 AND Ref(Trixm,-13)-Ref(Trixma,-13)>Ref(Trixm,-14)-Ref(Trixma,-14) AND Ref(trixm,-14)>Ref(trixma,-14); Upper_15= Upper_14 AND Ref(Trixm,-14)-Ref(Trixma,-14)>Ref(Trixm,-15)-Ref(Trixma,-15) AND Ref(trixm,-15)>Ref(trixma,-15); Upper_16= Upper_15 AND Ref(Trixm,-15)-Ref(Trixma,-15)>Ref(Trixm,-16)-Ref(Trixma,-16) AND Ref(trixm,-16)>Ref(trixma,-16); Upper_17= Upper_16 AND Ref(Trixm,-16)-Ref(Trixma,-16)>Ref(Trixm,-17)-Ref(Trixma,-17) AND Ref(trixm,-17)>Ref(trixma,-17); Upper_18= Upper_17 AND Ref(Trixm,-17)-Ref(Trixma,-17)>Ref(Trixm,-18)-Ref(Trixma,-18) AND Ref(trixm,-18)>Ref(trixma,-18); Not_Upper_1= Trixm-Trixma<=Ref(Trixm,-1)-Ref(Trixma,-1) AND trixm>trixma AND Ref(trixm,-1)>Ref(trixma,-1); Not_Upper_2= Not_Upper_1 AND Ref(Trixm,-1)-Ref(Trixma,-1)<=Ref(Trixm,-2)-Ref(Trixma,-2) AND Ref(trixm,-2)>Ref(trixma,-2); Not_Upper_3= Not_Upper_2 AND Ref(Trixm,-2)-Ref(Trixma,-2)<=Ref(Trixm,-3)-Ref(Trixma,-3) AND Ref(trixm,-3)>Ref(trixma,-3); Not_Upper_4= Not_Upper_3 AND Ref(Trixm,-3)-Ref(Trixma,-3)<=Ref(Trixm,-4)-Ref(Trixma,-4) AND Ref(trixm,-4)>Ref(trixma,-4); Not_Upper_5= Not_Upper_4 AND Ref(Trixm,-4)-Ref(Trixma,-4)<=Ref(Trixm,-5)-Ref(Trixma,-5) AND Ref(trixm,-5)>Ref(trixma,-5); Not_Upper_6= Not_Upper_5 AND Ref(Trixm,-5)-Ref(Trixma,-5)<=Ref(Trixm,-6)-Ref(Trixma,-6) AND Ref(trixm,-6)>Ref(trixma,-6); Not_Upper_7= Not_Upper_6 AND Ref(Trixm,-6)-Ref(Trixma,-6)<=Ref(Trixm,-7)-Ref(Trixma,-7) AND Ref(trixm,-7)>Ref(trixma,-7); Not_Upper_8= Not_Upper_7 AND Ref(Trixm,-7)-Ref(Trixma,-7)<=Ref(Trixm,-8)-Ref(Trixma,-8) AND Ref(trixm,-8)>Ref(trixma,-8); Not_Upper_9= Not_Upper_8 AND Ref(Trixm,-8)-Ref(Trixma,-8)<=Ref(Trixm,-9)-Ref(Trixma,-9) AND Ref(trixm,-9)>Ref(trixma,-9); Not_Upper_10= Not_Upper_9 AND Ref(Trixm,-9)-Ref(Trixma,-9)<=Ref(Trixm,-10)-Ref(Trixma,-10) AND Ref(trixm,-10)>Ref(trixma,-10); Not_Upper_11= Not_Upper_10 AND Ref(Trixm,-10)-Ref(Trixma,-10)<=Ref(Trixm,-11)-Ref(Trixma,-11) AND Ref(trixm,-11)>Ref(trixma,-11); Not_Upper_12= Not_Upper_11 AND Ref(Trixm,-11)-Ref(Trixma,-11)<=Ref(Trixm,-12)-Ref(Trixma,-12) AND Ref(trixm,-12)>Ref(trixma,-12); Not_Upper_13= Not_Upper_12 AND Ref(Trixm,-12)-Ref(Trixma,-12)<=Ref(Trixm,-13)-Ref(Trixma,-13) AND Ref(trixm,-13)>Ref(trixma,-13); Not_Upper_14= Not_Upper_13 AND Ref(Trixm,-13)-Ref(Trixma,-13)<=Ref(Trixm,-14)-Ref(Trixma,-14) AND Ref(trixm,-14)>Ref(trixma,-14); Not_Upper_15= Not_Upper_14 AND Ref(Trixm,-14)-Ref(Trixma,-14)<=Ref(Trixm,-15)-Ref(Trixma,-15) AND Ref(trixm,-15)>Ref(trixma,-15); Not_Upper_16= Not_Upper_15 AND Ref(Trixm,-15)-Ref(Trixma,-15)<=Ref(Trixm,-16)-Ref(Trixma,-16) AND Ref(trixm,-16)>Ref(trixma,-16); Not_Upper_17= Not_Upper_16 AND Ref(Trixm,-16)-Ref(Trixma,-16)<=Ref(Trixm,-17)-Ref(Trixma,-17) AND Ref(trixm,-17)>Ref(trixma,-17); Not_Upper_18= Not_Upper_17 AND Ref(Trixm,-17)-Ref(Trixma,-17)<=Ref(Trixm,-18)-Ref(Trixma,-18) AND Ref(trixm,-18)>Ref(trixma,-18); Lower_z1= Lower_1 AND L=Ref(LB,-1); Not_Lower_z3= Not_Lower_z2 AND Ref(L,-2)>=Ref(LB,-2); Not_Lower_z4= Not_Lower_z3 AND Ref(L,-3)>=Ref(LB,-3); Not_Lower_z5= Not_Lower_z4 AND Ref(L,-4)>=Ref(LB,-4); Not_Lower_z6= Not_Lower_z5 AND Ref(L,-5)>=Ref(LB,-5); Not_Lower_z7= Not_Lower_z6 AND Ref(L,-6)>=Ref(LB,-6); Not_Lower_z8= Not_Lower_z7 AND Ref(L,-7)>=Ref(LB,-7); Not_Lower_z9= Not_Lower_z8 AND Ref(L,-8)>=Ref(LB,-8); Not_Lower_z10= Not_Lower_z9 AND Ref(L,-9)>=Ref(LB,-9); Not_Lower_z11= Not_Lower_z10 AND Ref(L,-10)>=Ref(LB,-10); Not_Lower_z12= Not_Lower_z11 AND Ref(L,-11)>=Ref(LB,-11); Not_Lower_z13= Not_Lower_z12 AND Ref(L,-12)>=Ref(LB,-12); Not_Lower_z14= Not_Lower_z13 AND Ref(L,-13)>=Ref(LB,-13); Not_Lower_z15= Not_Lower_z14 AND Ref(L,-14)>=Ref(LB,-14); Not_Lower_z16= Not_Lower_z15 AND Ref(L,-15)>=Ref(LB,-15); Not_Lower_z17= Not_Lower_z16 AND Ref(L,-16)>=Ref(LB,-16); Not_Lower_z18= Not_Lower_z17 AND Ref(L,-17)>=Ref(LB,-17); Upper_z1= Upper_1 AND H>UB; Upper_z2= Upper_z1 AND Ref(H,-1)>Ref(UB,-1); Upper_z3= Upper_z2 AND Ref(H,-2)>Ref(UB,-2); Upper_z4= Upper_z3 AND Ref(H,-3)>Ref(UB,-3); Upper_z5= Upper_z4 AND Ref(H,-4)>Ref(UB,-4); Upper_z6= Upper_z5 AND Ref(H,-5)>Ref(UB,-5); Upper_z7= Upper_z6 AND Ref(H,-6)>Ref(UB,-6); Upper_z8= Upper_z7 AND Ref(H,-7)>Ref(UB,-7); Upper_z9= Upper_z8 AND Ref(H,-8)>Ref(UB,-8); Upper_z10= Upper_z9 AND Ref(H,-9)>Ref(UB,-9); Upper_z11= Upper_z10 AND Ref(H,-10)>Ref(UB,-10); Upper_z12= Upper_z11 AND Ref(H,-11)>Ref(UB,-11); Upper_z13= Upper_z12 AND Ref(H,-12)>Ref(UB,-12); Upper_z14= Upper_z13 AND Ref(H,-13)>Ref(UB,-13); Upper_z15= Upper_z14 AND Ref(H,-14)>Ref(UB,-14); Upper_z16= Upper_z15 AND Ref(H,-15)>Ref(UB,-15); Upper_z17= Upper_z16 AND Ref(H,-16)>Ref(UB,-16); Upper_z18= Upper_z17 AND Ref(H,-17)>Ref(UB,-17); Not_Upper_z1= Not_Upper_1 AND H>UB; Not_Upper_z2= Not_Upper_z1 AND Ref(H,-1)<=Ref(UB,-1); Not_Upper_z3= Not_Upper_z2 AND Ref(H,-2)<=Ref(UB,-2); Not_Upper_z4= Not_Upper_z3 AND Ref(H,-3)<=Ref(UB,-3); Not_Upper_z5= Not_Upper_z4 AND Ref(H,-4)<=Ref(UB,-4); Not_Upper_z6= Not_Upper_z5 AND Ref(H,-5)<=Ref(UB,-5); Not_Upper_z7= Not_Upper_z6 AND Ref(H,-6)<=Ref(UB,-6); Not_Upper_z8= Not_Upper_z7 AND Ref(H,-7)<=Ref(UB,-7); Not_Upper_z9= Not_Upper_z8 AND Ref(H,-8)<=Ref(UB,-8); Not_Upper_z10= Not_Upper_z9 AND Ref(H,-9)<=Ref(UB,-9); Not_Upper_z11= Not_Upper_z10 AND Ref(H,-10)<=Ref(UB,-10); Not_Upper_z12= Not_Upper_z11 AND Ref(H,-11)<=Ref(UB,-11); Not_Upper_z13= Not_Upper_z12 AND Ref(H,-12)<=Ref(UB,-12); Not_Upper_z14= Not_Upper_z13 AND Ref(H,-13)<=Ref(UB,-13); Not_Upper_z15= Not_Upper_z14 AND Ref(H,-14)<=Ref(UB,-14); Not_Upper_z16= Not_Upper_z15 AND Ref(H,-15)<=Ref(UB,-15); Not_Upper_z17= Not_Upper_z16 AND Ref(H,-16)<=Ref(UB,-16); Not_Upper_z18= Not_Upper_z17 AND Ref(H,-17)<=Ref(UB,-17); Not_lower= IIf(Not_Lower_18,18, IIf(Not_Lower_17,17, IIf(Not_Lower_16,16, IIf(Not_Lower_15,15, IIf(Not_Lower_14,14, IIf(Not_Lower_13,13, IIf(Not_Lower_12,12, IIf(Not_Lower_11,11, IIf(Not_Lower_10,10, IIf(Not_Lower_9,9, IIf(Not_Lower_8,8, IIf(Not_Lower_7,7, IIf(Not_Lower_6,6, IIf(Not_Lower_5,5, IIf(Not_Lower_4,4, IIf(Not_Lower_3,3, IIf(Not_Lower_2,2, IIf(Not_lower_1,1,0)))))))))))))))))); Not_Upper= IIf(Not_Upper_18,18, IIf(Not_Upper_17,17, IIf(Not_Upper_16,16, IIf(Not_Upper_15,15, IIf(Not_Upper_14,14, IIf(Not_Upper_13,13, IIf(Not_Upper_12,12, IIf(Not_Upper_11,11, IIf(Not_Upper_10,10, IIf(Not_Upper_9,9, IIf(Not_Upper_8,8, IIf(Not_Upper_7,7, IIf(Not_Upper_6,6, IIf(Not_Upper_5,5, IIf(Not_Upper_4,4, IIf(Not_Upper_3,3, IIf(Not_Upper_2,2, IIf(Not_Upper_1,1,0)))))))))))))))))); Lower= IIf(Lower_18,18, IIf(Lower_17,17, IIf(Lower_16,16, IIf(Lower_15,15, IIf(Lower_14,14, IIf(Lower_13,13, IIf(Lower_12,12, IIf(Lower_11,11, IIf(Lower_10,10, IIf(Lower_9,9, IIf(Lower_8,8, IIf(Lower_7,7, IIf(Lower_6,6, IIf(Lower_5,5, IIf(Lower_4,4, IIf(Lower_3,3, IIf(Lower_2,2, IIf(Lower_1,1,0)))))))))))))))))); Upper= IIf(Upper_18,18, IIf(Upper_17,17, IIf(Upper_16,16, IIf(Upper_15,15, IIf(Upper_14,14, IIf(Upper_13,13, IIf(Upper_12,12, IIf(Upper_11,11, IIf(Upper_10,10, IIf(Upper_9,9, IIf(Upper_8,8, IIf(Upper_7,7, IIf(Upper_6,6, IIf(Upper_5,5, IIf(Upper_4,4, IIf(Upper_3,3, IIf(Upper_2,2, IIf(Upper_1,1,0)))))))))))))))))); Lower_z= IIf(Lower_z18,18, IIf(Lower_z17,17, IIf(Lower_z16,16, IIf(Lower_z15,15, IIf(Lower_z14,14, IIf(Lower_z13,13, IIf(Lower_z12,12, IIf(Lower_z11,11, IIf(Lower_z10,10, IIf(Lower_z9,9, IIf(Lower_z8,8, IIf(Lower_z7,7, IIf(Lower_z6,6, IIf(Lower_z5,5, IIf(Lower_z4,4, IIf(Lower_z3,3, IIf(Lower_z2,2, IIf(Lower_z1,1,0)))))))))))))))))); Upper_z= IIf(Upper_z18,18, IIf(Upper_z17,17, IIf(Upper_z16,16, IIf(Upper_z15,15, IIf(Upper_z14,14, IIf(Upper_z13,13, IIf(Upper_z12,12, IIf(Upper_z11,11, IIf(Upper_z10,10, IIf(Upper_z9,9, IIf(Upper_z8,8, IIf(Upper_z7,7, IIf(Upper_z6,6, IIf(Upper_z5,5, IIf(Upper_z4,4, IIf(Upper_z3,3, IIf(Upper_z2,2, IIf(Upper_z1,1,0)))))))))))))))))); //Plot( Flip( Buy, Sell ), "Trade", colorDarkGreen, styleArea | styleOwnScale, 0, 1 ); x=IIf(trixm>trixma AND Ref(trixm,-1)>Ref(trixma,-1),Trixm-Trixma>Ref(Trixm,-1)-Ref(Trixma,-1),IIf(trixma>trixm AND Ref(trixma,-1)>Ref(trixm,-1),Trixma-Trixm>Ref(Trixma,-1)-Ref(Trixm,-1),0)); Lower_x=IIf(TrixmTrixma AND x,1,0); Upper_xy=IIf(Trixm>Trixma AND x AND H>UB,1,0); UpperDolly_4=IIf(H>UpperBand4,1,0); UpperDolly_3=IIf(H>UpperBand3 AND H<=UpperBand4,1,0); UpperDolly_2=IIf(H>UpperBand2 AND H<=UpperBand3,1,0); UpperDolly_1=IIf(H>UpperBand1 AND H<=UpperBand2,1,0); UpperDolly_0=IIf(H>MidPoint AND H<=UpperBand1,1,0); LowerDolly_0=IIf(L<=MidPoint AND L>LowerBand1,1,0); LowerDolly_1=IIf(L<=LowerBand1 AND L>LowerBand2,1,0); LowerDolly_2=IIf(L<=LowerBand2 AND L>LowerBand3,1,0); LowerDolly_3=IIf(L<=LowerBand3 AND L>LowerBand4,1,0); LowerDolly_4=IIf(L<=LowerBand4,1,0); RSIPeriod=Param("RSI Period Length", 14, 3 , 50, 1); R = RSI(RSIperiod); Period1=10;//Param("Period 1", 10, 5, 50, 1); Period2=10;//Param("Period 2", 5, 5, 50, 1); EMA1= EMA(R,Period1); EMA2= EMA(EMA1,Period2); Difference= EMA1 - EMA2; ZeroLagEMA= EMA1 + Difference; StoRSI =abs(ZeroLagEMA); period1 =10 ;//Param( "Period 1", 10, 2, 200, 1 ); period2 =5 ;//Param( "Period 2", 5, 2, 200, 1 ); /*ZeroLag W%R*/ "========"; R = ((HHV(H,14) - C) /(HHV (H,14) -LLV (L,14))) *-100; //Period= 10; EMA1= EMA(R,period1); EMA2= EMA(EMA1,period2); Difference= EMA1 - EMA2; ZeroLagEMA= EMA1 + Difference; PR=100-abs(ZeroLagEMA); Lower_StoRSI=StoRSI<=10; Upper_StoRSI=StoRSI>=90; Lower_R=PR<=50; Upper_R=PR>50; x=8;//Param("CCI Period 3 - 50",14,3,50,1); Y=8;//Param("Smooth Factor 3 - 15",14,3,50,1); StochCCI=100*(CCI(x)-LLV(CCI(x),Y))/(HHV(CCI(x),Y)-LLV(CCI(x),Y)); x1=CCI(x); Buy_x=x1<-100; Sell_x=x1>100; Buy_y=StochCCI<20; Sell_y=StochCCI>80; Buy_z=Buy_x AND Buy_y; Sell_z=Sell_x AND Sell_y; /*if (NOT ParamToggle("BUY - StochCCI<20 and CCI_14<-100","On,Off")) { PlotShapes( Buy_y * shapeHollowUpArrow , colorLime,0, L, -17); PlotShapes( Buy_x * shapeHollowUpArrow , colorRed,0, L, -17); PlotShapes( Buy_z * shapeHollowUpArrow , 3,0, L, -17); } if (NOT ParamToggle("SELL - StochCCI<20 and CCI_14<-100","On,Off")) { PlotShapes( Sell_y * shapeHollowDownArrow , colorLime,0, L, -17); PlotShapes( Sell_x * shapeHollowDownArrow , colorRed,0, L, -17); PlotShapes( Sell_z * shapeHollowDownArrow , 3,0, L, -17); }*/ if (NOT ParamToggle("ATR Trading System Switch","On,Off")) {PlotShapes( UpperDolly_4 * shapeSmallCircle, colorDarkTeal,0,Graph0,25); PlotShapes( UpperDolly_3 * shapeSmallCircle, colorDarkGrey,0,Graph0,25); PlotShapes( UpperDolly_2 * shapeSmallCircle, colorDarkRed,0,Graph0,25); PlotShapes( UpperDolly_1 * shapeSmallCircle, colorViolet,0,Graph0,25); PlotShapes( UpperDolly_0 * shapeSmallCircle, colorDarkGreen,0,Graph0,25); PlotShapes( LowerDolly_0 * shapeSmallCircle, colorDarkGreen,0,Graph0,-25); PlotShapes( LowerDolly_1 * shapeSmallCircle, colorViolet,0,Graph0,-25); PlotShapes( LowerDolly_2 * shapeSmallCircle, colorDarkRed,0,Graph0,-25); PlotShapes( LowerDolly_3 * shapeSmallCircle, colorDarkGrey,0,Graph0,-25); PlotShapes( LowerDolly_4 * shapeSmallCircle, colorDarkTeal,0,Graph0,-25); //PlotShapes( Lower_CCI * shapeHollowSmallSquare, colorBlue,0,Graph0,-50); //PlotShapes( Upper_CCI * shapeHollowSmallSquare, colorBlue,0,Graph0,50); //PlotShapes( Lower_StochCCI * shapeHollowSmallSquare, IIf(PR<=20,colorDarkYellow,colorDarkGrey),0,Graph0,-40); //PlotShapes( Upper_StochCCI * shapeHollowSmallSquare, IIf(PR>80,colorDarkYellow,colorDarkGrey),0,Graph0,40); //PlotShapes( Lower_StochCCI * shapeHollowSmallSquare, colorDarkYellow,0,Graph0,-40); //PlotShapes( Upper_StochCCI * shapeHollowSmallSquare, colorDarkYellow,0,Graph0,40); } if (NOT ParamToggle("CCI Switch","On,Off")) {PlotShapes( Buy_y * shapeHollowSmallSquare, colorLime,0, Graph0, -40); PlotShapes( Buy_x * shapeHollowSmallSquare, colorRed,0, Graph0, -40); PlotShapes( Buy_z * shapeHollowSmallSquare, 3,0, Graph0, -40); PlotShapes( Sell_y * shapeHollowSmallSquare, colorLime,0, Graph0, 40); PlotShapes( Sell_x * shapeHollowSmallSquare, colorRed,0, Graph0, 40); PlotShapes( Sell_z * shapeHollowSmallSquare, 3,0,Graph0, 40); } PlotShapes( Lower_x * shapeHollowUpArrow , colorDarkGreen,0,Graph0,-12); PlotShapes( Upper_x * shapeHollowDownArrow , colorDarkRed,0,Graph0,-12); PlotShapes( Lower_xy * shapeHollowUpArrow , colorYellow,0,Graph0,-12); PlotShapes( Upper_xy * shapeHollowDownArrow , colorYellow,0,Graph0,-12); PlotShapes( Buy * shapeUpArrow, colorGreen); PlotShapes( Sell * shapeDownArrow, colorRed); /* basic variable defs ud: up-Day (Close up from Open) dd: down-Day (Close down from Open) uc: up-Close (Close up from previous Close) dc: down-Close: (Close down from previous Close) */ C1 = Ref(C, -1); uc = C > C1; dc = C <= C1; ud = C > O; dd = C <= O; /* Volume Day types: green: up-day and up-close yellow: up-day but down-close red: down-day and down-close blue: down-day but up-close white: close equals open, close equals previous close (currently unused vtypes are for future enhancements) */ green = 1; blue = 2; yellow = 3; red = 4; white = 5; VType = IIf(ud, IIf(uc, green, yellow), IIf(dd, IIf(dc, red, blue), white)); /* green volume: up-day and up-close*/ gv = IIf(VType == green, V, 0); /* yellow volume: up-day but down-close */ yv = IIf(VType == yellow, V, 0); /* red volume: down-day and down-close */ rv = IIf(VType == red, V, 0); /* blue volume: down-day but up-close */ bv = IIf(VType == blue, V, 0); /* split up volume of up-close days from down-close days - (for the purposes of this volume display indicator, up-days that closed down from the previous close are considered bearish volume days, and conversely, down-days that nevertheless closed up from the previous close are considered bullish volume days - my testing indicates this is more accurate than using ordinary up-days and down-days) */ uv = gv + bv; uv1 = Ref(uv, -1); /* up volume */ dv = rv + yv; dv1 = Ref(dv, -1); /* down volume */ //----------- upperTail = IIf(C>O,H-C,H-O); lowerTail = IIf(C>O,O-L,C-L); BDIn=IIf( (C>O) OR (C==O AND lowerTail>upperTail),V,0); BDOut=IIf( (C0, colorGreen,colorRed) ; ColorBW=IIf( BDWeek>0, colorGreen,colorRed) ; //----------------------------------------------------- VolPer = Param("Adjust Vol. MA per.", 34, 1, 255, 1); MAuv = TEMA(uv, VolPer ); mauv1 = Ref(mauv, -1); MAdv = TEMA(dv, VolPer ); madv1 = Ref(madv, -1); ColorBBV=IIf( MAuv>MAdv, colorYellow,colorRed) ; //----------------------------------------------------- BBVAcc_1 = MAuv>MAdv; BBVAcc_2 = BBVAcc_1 AND Ref(MAuv,-1)>Ref(MAdv,-1); BBVAcc_3 = BBVAcc_2 AND Ref(MAuv,-2)>Ref(MAdv,-2); BBVAcc_4 = BBVAcc_3 AND Ref(MAuv,-3)>Ref(MAdv,-3); BBVAcc_5 = BBVAcc_4 AND Ref(MAuv,-4)>Ref(MAdv,-4); BBVAcc_6 = BBVAcc_5 AND Ref(MAuv,-5)>Ref(MAdv,-5); BBVAcc_7 = BBVAcc_6 AND Ref(MAuv,-6)>Ref(MAdv,-6); BBVAcc_8 = BBVAcc_7 AND Ref(MAuv,-7)>Ref(MAdv,-7); BBVAcc_9 = BBVAcc_8 AND Ref(MAuv,-8)>Ref(MAdv,-8); BBVAcc_10 = BBVAcc_9 AND Ref(MAuv,-9)>Ref(MAdv,-9); BBVAcc_11 = BBVAcc_10 AND Ref(MAuv,-10)>Ref(MAdv,-10); BBVAcc_12 = BBVAcc_11 AND Ref(MAuv,-11)>Ref(MAdv,-11); BBVAcc_13 = BBVAcc_12 AND Ref(MAuv,-12)>Ref(MAdv,-12); BBVAcc_14 = BBVAcc_13 AND Ref(MAuv,-13)>Ref(MAdv,-13); BBVAcc_15 = BBVAcc_14 AND Ref(MAuv,-14)>Ref(MAdv,-14); BBVAcc_16 = BBVAcc_15 AND Ref(MAuv,-15)>Ref(MAdv,-15); BBVAcc_17 = BBVAcc_16 AND Ref(MAuv,-16)>Ref(MAdv,-16); BBVAcc_18 = BBVAcc_17 AND Ref(MAuv,-17)>Ref(MAdv,-17); BBVAcc_19 = BBVAcc_18 AND Ref(MAuv,-18)>Ref(MAdv,-18); BBVAcc_20 = BBVAcc_19 AND Ref(MAuv,-19)>Ref(MAdv,-19); BBVAcc_21 = BBVAcc_20 AND Ref(MAuv,-20)>Ref(MAdv,-20); BBVAcc_22 = BBVAcc_21 AND Ref(MAuv,-21)>Ref(MAdv,-21); BBVAcc_23 = BBVAcc_22 AND Ref(MAuv,-22)>Ref(MAdv,-22); BBVAcc_24 = BBVAcc_23 AND Ref(MAuv,-23)>Ref(MAdv,-23); BBVAcc_25 = BBVAcc_24 AND Ref(MAuv,-24)>Ref(MAdv,-24); BBVAcc_26 = BBVAcc_25 AND Ref(MAuv,-25)>Ref(MAdv,-25); BBVAcc_27 = BBVAcc_26 AND Ref(MAuv,-26)>Ref(MAdv,-26); BBVAcc_28 = BBVAcc_27 AND Ref(MAuv,-27)>Ref(MAdv,-27); BBVAcc_29 = BBVAcc_28 AND Ref(MAuv,-28)>Ref(MAdv,-28); BBVAcc_30 = BBVAcc_29 AND Ref(MAuv,-29)>Ref(MAdv,-29); BBVAcc= IIf(BBVAcc_30,30, IIf(BBVAcc_29,29, IIf(BBVAcc_28,28, IIf(BBVAcc_27,27, IIf(BBVAcc_26,26, IIf(BBVAcc_25,25, IIf(BBVAcc_24,24, IIf(BBVAcc_23,23, IIf(BBVAcc_22,22, IIf(BBVAcc_21,21, IIf(BBVAcc_20,20, IIf(BBVAcc_19,19, IIf(BBVAcc_18,18, IIf(BBVAcc_17,17, IIf(BBVAcc_16,16, IIf(BBVAcc_15,15, IIf(BBVAcc_14,14, IIf(BBVAcc_13,13, IIf(BBVAcc_12,12, IIf(BBVAcc_11,11, IIf(BBVAcc_10,10, IIf(BBVAcc_9,9, IIf(BBVAcc_8,8, IIf(BBVAcc_7,7, IIf(BBVAcc_6,6, IIf(BBVAcc_5,5, IIf(BBVAcc_4,4, IIf(BBVAcc_3,3, IIf(BBVAcc_2,2, IIf(BBVAcc_1,1,0)))))))))))))))))))))))))))))); BBVDist_1 = MAuv<=MAdv; BBVDist_2 = BBVDist_1 AND Ref(MAuv,-1)<=Ref(MAdv,-1); BBVDist_3 = BBVDist_2 AND Ref(MAuv,-2)<=Ref(MAdv,-2); BBVDist_4 = BBVDist_3 AND Ref(MAuv,-3)<=Ref(MAdv,-3); BBVDist_5 = BBVDist_4 AND Ref(MAuv,-4)<=Ref(MAdv,-4); BBVDist_6 = BBVDist_5 AND Ref(MAuv,-5)<=Ref(MAdv,-5); BBVDist_7 = BBVDist_6 AND Ref(MAuv,-6)<=Ref(MAdv,-6); BBVDist_8 = BBVDist_7 AND Ref(MAuv,-7)<=Ref(MAdv,-7); BBVDist_9 = BBVDist_8 AND Ref(MAuv,-8)<=Ref(MAdv,-8); BBVDist_10 = BBVDist_9 AND Ref(MAuv,-9)<=Ref(MAdv,-9); BBVDist_11 = BBVDist_10 AND Ref(MAuv,-10)<=Ref(MAdv,-10); BBVDist_12 = BBVDist_11 AND Ref(MAuv,-11)<=Ref(MAdv,-11); BBVDist_13 = BBVDist_12 AND Ref(MAuv,-12)<=Ref(MAdv,-12); BBVDist_14 = BBVDist_13 AND Ref(MAuv,-13)<=Ref(MAdv,-13); BBVDist_15 = BBVDist_14 AND Ref(MAuv,-14)<=Ref(MAdv,-14); BBVDist_16 = BBVDist_15 AND Ref(MAuv,-15)<=Ref(MAdv,-15); BBVDist_17 = BBVDist_16 AND Ref(MAuv,-16)<=Ref(MAdv,-16); BBVDist_18 = BBVDist_17 AND Ref(MAuv,-17)<=Ref(MAdv,-17); BBVDist_19 = BBVDist_18 AND Ref(MAuv,-18)<=Ref(MAdv,-18); BBVDist_20 = BBVDist_19 AND Ref(MAuv,-19)<=Ref(MAdv,-19); BBVDist_21 = BBVDist_20 AND Ref(MAuv,-20)<=Ref(MAdv,-20); BBVDist_22 = BBVDist_21 AND Ref(MAuv,-21)<=Ref(MAdv,-21); BBVDist_23 = BBVDist_22 AND Ref(MAuv,-22)<=Ref(MAdv,-22); BBVDist_24 = BBVDist_23 AND Ref(MAuv,-23)<=Ref(MAdv,-23); BBVDist_25 = BBVDist_24 AND Ref(MAuv,-24)<=Ref(MAdv,-24); BBVDist_26 = BBVDist_25 AND Ref(MAuv,-25)<=Ref(MAdv,-25); BBVDist_27 = BBVDist_26 AND Ref(MAuv,-26)<=Ref(MAdv,-26); BBVDist_28 = BBVDist_27 AND Ref(MAuv,-27)<=Ref(MAdv,-27); BBVDist_29 = BBVDist_28 AND Ref(MAuv,-28)<=Ref(MAdv,-28); BBVDist_30 = BBVDist_29 AND Ref(MAuv,-29)<=Ref(MAdv,-29); BBVDist= IIf(BBVDist_30,30, IIf(BBVDist_29,29, IIf(BBVDist_28,28, IIf(BBVDist_27,27, IIf(BBVDist_26,26, IIf(BBVDist_25,25, IIf(BBVDist_24,24, IIf(BBVDist_23,23, IIf(BBVDist_22,22, IIf(BBVDist_21,21, IIf(BBVDist_20,20, IIf(BBVDist_19,19, IIf(BBVDist_18,18, IIf(BBVDist_17,17, IIf(BBVDist_16,16, IIf(BBVDist_15,15, IIf(BBVDist_14,14, IIf(BBVDist_13,13, IIf(BBVDist_12,12, IIf(BBVDist_11,11, IIf(BBVDist_10,10, IIf(BBVDist_9,9, IIf(BBVDist_8,8, IIf(BBVDist_7,7, IIf(BBVDist_6,6, IIf(BBVDist_5,5, IIf(BBVDist_4,4, IIf(BBVDist_3,3, IIf(BBVDist_2,2, IIf(BBVDist_1,1,0)))))))))))))))))))))))))))))); BDWeekAcc_1 = BDWeek<=0; BDWeekAcc_2 = BDWeekAcc_1 AND Ref(BDWeek,-1)<=0; BDWeekAcc_3 = BDWeekAcc_2 AND Ref(BDWeek,-2)<=0; BDWeekAcc_4 = BDWeekAcc_3 AND Ref(BDWeek,-3)<=0; BDWeekAcc_5 = BDWeekAcc_4 AND Ref(BDWeek,-4)<=0; BDWeekAcc_6 = BDWeekAcc_5 AND Ref(BDWeek,-5)<=0; BDWeekAcc_7 = BDWeekAcc_6 AND Ref(BDWeek,-6)<=0; BDWeekAcc_8 = BDWeekAcc_7 AND Ref(BDWeek,-7)<=0; BDWeekAcc_9 = BDWeekAcc_8 AND Ref(BDWeek,-8)<=0; BDWeekAcc_10 = BDWeekAcc_9 AND Ref(BDWeek,-9)<=0; BDWeekAcc_11 = BDWeekAcc_10 AND Ref(BDWeek,-10)<=0; BDWeekAcc_12 = BDWeekAcc_11 AND Ref(BDWeek,-11)<=0; BDWeekAcc_13 = BDWeekAcc_12 AND Ref(BDWeek,-12)<=0; BDWeekAcc_14 = BDWeekAcc_13 AND Ref(BDWeek,-13)<=0; BDWeekAcc_15 = BDWeekAcc_14 AND Ref(BDWeek,-14)<=0; BDWeekAcc_16 = BDWeekAcc_15 AND Ref(BDWeek,-15)<=0; BDWeekAcc_17 = BDWeekAcc_16 AND Ref(BDWeek,-16)<=0; BDWeekAcc_18 = BDWeekAcc_17 AND Ref(BDWeek,-17)<=0; BDWeekAcc_19 = BDWeekAcc_18 AND Ref(BDWeek,-18)<=0; BDWeekAcc_20 = BDWeekAcc_19 AND Ref(BDWeek,-19)<=0; BDWeekAcc_21 = BDWeekAcc_20 AND Ref(BDWeek,-20)<=0; BDWeekAcc_22 = BDWeekAcc_21 AND Ref(BDWeek,-21)<=0; BDWeekAcc_23 = BDWeekAcc_22 AND Ref(BDWeek,-22)<=0; BDWeekAcc_24 = BDWeekAcc_23 AND Ref(BDWeek,-23)<=0; BDWeekAcc_25 = BDWeekAcc_24 AND Ref(BDWeek,-24)<=0; BDWeekAcc_26 = BDWeekAcc_25 AND Ref(BDWeek,-25)<=0; BDWeekAcc_27 = BDWeekAcc_26 AND Ref(BDWeek,-26)<=0; BDWeekAcc_28 = BDWeekAcc_27 AND Ref(BDWeek,-27)<=0; BDWeekAcc_29 = BDWeekAcc_28 AND Ref(BDWeek,-28)<=0; BDWeekAcc_30 = BDWeekAcc_29 AND Ref(BDWeek,-29)<=0; BDWeekAcc= IIf(BDWeekAcc_30,30, IIf(BDWeekAcc_29,29, IIf(BDWeekAcc_28,28, IIf(BDWeekAcc_27,27, IIf(BDWeekAcc_26,26, IIf(BDWeekAcc_25,25, IIf(BDWeekAcc_24,24, IIf(BDWeekAcc_23,23, IIf(BDWeekAcc_22,22, IIf(BDWeekAcc_21,21, IIf(BDWeekAcc_20,20, IIf(BDWeekAcc_19,19, IIf(BDWeekAcc_18,18, IIf(BDWeekAcc_17,17, IIf(BDWeekAcc_16,16, IIf(BDWeekAcc_15,15, IIf(BDWeekAcc_14,14, IIf(BDWeekAcc_13,13, IIf(BDWeekAcc_12,12, IIf(BDWeekAcc_11,11, IIf(BDWeekAcc_10,10, IIf(BDWeekAcc_9,9, IIf(BDWeekAcc_8,8, IIf(BDWeekAcc_7,7, IIf(BDWeekAcc_6,6, IIf(BDWeekAcc_5,5, IIf(BDWeekAcc_4,4, IIf(BDWeekAcc_3,3, IIf(BDWeekAcc_2,2, IIf(BDWeekAcc_1,1,0)))))))))))))))))))))))))))))); BDWeekDist_1 = BDWeek>0; BDWeekDist_2 = BDWeekDist_1 AND Ref(BDWeek,-1)>0; BDWeekDist_3 = BDWeekDist_2 AND Ref(BDWeek,-2)>0; BDWeekDist_4 = BDWeekDist_3 AND Ref(BDWeek,-3)>0; BDWeekDist_5 = BDWeekDist_4 AND Ref(BDWeek,-4)>0; BDWeekDist_6 = BDWeekDist_5 AND Ref(BDWeek,-5)>0; BDWeekDist_7 = BDWeekDist_6 AND Ref(BDWeek,-6)>0; BDWeekDist_8 = BDWeekDist_7 AND Ref(BDWeek,-7)>0; BDWeekDist_9 = BDWeekDist_8 AND Ref(BDWeek,-8)>0; BDWeekDist_10 = BDWeekDist_9 AND Ref(BDWeek,-9)>0; BDWeekDist_11 = BDWeekDist_10 AND Ref(BDWeek,-10)>0; BDWeekDist_12 = BDWeekDist_11 AND Ref(BDWeek,-11)>0; BDWeekDist_13 = BDWeekDist_12 AND Ref(BDWeek,-12)>0; BDWeekDist_14 = BDWeekDist_13 AND Ref(BDWeek,-13)>0; BDWeekDist_15 = BDWeekDist_14 AND Ref(BDWeek,-14)>0; BDWeekDist_16 = BDWeekDist_15 AND Ref(BDWeek,-15)>0; BDWeekDist_17 = BDWeekDist_16 AND Ref(BDWeek,-16)>0; BDWeekDist_18 = BDWeekDist_17 AND Ref(BDWeek,-17)>0; BDWeekDist_19 = BDWeekDist_18 AND Ref(BDWeek,-18)>0; BDWeekDist_20 = BDWeekDist_19 AND Ref(BDWeek,-19)>0; BDWeekDist_21 = BDWeekDist_20 AND Ref(BDWeek,-20)>0; BDWeekDist_22 = BDWeekDist_21 AND Ref(BDWeek,-21)>0; BDWeekDist_23 = BDWeekDist_22 AND Ref(BDWeek,-22)>0; BDWeekDist_24 = BDWeekDist_23 AND Ref(BDWeek,-23)>0; BDWeekDist_25 = BDWeekDist_24 AND Ref(BDWeek,-24)>0; BDWeekDist_26 = BDWeekDist_25 AND Ref(BDWeek,-25)>0; BDWeekDist_27 = BDWeekDist_26 AND Ref(BDWeek,-26)>0; BDWeekDist_28 = BDWeekDist_27 AND Ref(BDWeek,-27)>0; BDWeekDist_29 = BDWeekDist_28 AND Ref(BDWeek,-28)>0; BDWeekDist_30 = BDWeekDist_29 AND Ref(BDWeek,-29)>0; BDWeekDist = IIf(BDWeekDist_30,30, IIf(BDWeekDist_29,29, IIf(BDWeekDist_28,28, IIf(BDWeekDist_27,27, IIf(BDWeekDist_26,26, IIf(BDWeekDist_25,25, IIf(BDWeekDist_24,24, IIf(BDWeekDist_23,23, IIf(BDWeekDist_22,22, IIf(BDWeekDist_21,21, IIf(BDWeekDist_20,20, IIf(BDWeekDist_19,19, IIf(BDWeekDist_18,18, IIf(BDWeekDist_17,17, IIf(BDWeekDist_16,16, IIf(BDWeekDist_15,15, IIf(BDWeekDist_14,14, IIf(BDWeekDist_13,13, IIf(BDWeekDist_12,12, IIf(BDWeekDist_11,11, IIf(BDWeekDist_10,10, IIf(BDWeekDist_9,9, IIf(BDWeekDist_8,8, IIf(BDWeekDist_7,7, IIf(BDWeekDist_6,6, IIf(BDWeekDist_5,5, IIf(BDWeekDist_4,4, IIf(BDWeekDist_3,3, IIf(BDWeekDist_2,2, IIf(BDWeekDist_1,1,0)))))))))))))))))))))))))))))); BDMonthAcc_1 = BDMonth<=0; BDMonthAcc_2 = BDMonthAcc_1 AND Ref(BDMonth,-1)<=0; BDMonthAcc_3 = BDMonthAcc_2 AND Ref(BDMonth,-2)<=0; BDMonthAcc_4 = BDMonthAcc_3 AND Ref(BDMonth,-3)<=0; BDMonthAcc_5 = BDMonthAcc_4 AND Ref(BDMonth,-4)<=0; BDMonthAcc_6 = BDMonthAcc_5 AND Ref(BDMonth,-5)<=0; BDMonthAcc_7 = BDMonthAcc_6 AND Ref(BDMonth,-6)<=0; BDMonthAcc_8 = BDMonthAcc_7 AND Ref(BDMonth,-7)<=0; BDMonthAcc_9 = BDMonthAcc_8 AND Ref(BDMonth,-8)<=0; BDMonthAcc_10 = BDMonthAcc_9 AND Ref(BDMonth,-9)<=0; BDMonthAcc_11 = BDMonthAcc_10 AND Ref(BDMonth,-10)<=0; BDMonthAcc_12 = BDMonthAcc_11 AND Ref(BDMonth,-11)<=0; BDMonthAcc_13 = BDMonthAcc_12 AND Ref(BDMonth,-12)<=0; BDMonthAcc_14 = BDMonthAcc_13 AND Ref(BDMonth,-13)<=0; BDMonthAcc_15 = BDMonthAcc_14 AND Ref(BDMonth,-14)<=0; BDMonthAcc_16 = BDMonthAcc_15 AND Ref(BDMonth,-15)<=0; BDMonthAcc_17 = BDMonthAcc_16 AND Ref(BDMonth,-16)<=0; BDMonthAcc_18 = BDMonthAcc_17 AND Ref(BDMonth,-17)<=0; BDMonthAcc_19 = BDMonthAcc_18 AND Ref(BDMonth,-18)<=0; BDMonthAcc_20 = BDMonthAcc_19 AND Ref(BDMonth,-19)<=0; BDMonthAcc_21 = BDMonthAcc_20 AND Ref(BDMonth,-20)<=0; BDMonthAcc_22 = BDMonthAcc_21 AND Ref(BDMonth,-21)<=0; BDMonthAcc_23 = BDMonthAcc_22 AND Ref(BDMonth,-22)<=0; BDMonthAcc_24 = BDMonthAcc_23 AND Ref(BDMonth,-23)<=0; BDMonthAcc_25 = BDMonthAcc_24 AND Ref(BDMonth,-24)<=0; BDMonthAcc_26 = BDMonthAcc_25 AND Ref(BDMonth,-25)<=0; BDMonthAcc_27 = BDMonthAcc_26 AND Ref(BDMonth,-26)<=0; BDMonthAcc_28 = BDMonthAcc_27 AND Ref(BDMonth,-27)<=0; BDMonthAcc_29 = BDMonthAcc_28 AND Ref(BDMonth,-28)<=0; BDMonthAcc_30 = BDMonthAcc_29 AND Ref(BDMonth,-29)<=0; BDMonthAcc = IIf(BDMonthAcc_30,30, IIf(BDMonthAcc_29,29, IIf(BDMonthAcc_28,28, IIf(BDMonthAcc_27,27, IIf(BDMonthAcc_26,26, IIf(BDMonthAcc_25,25, IIf(BDMonthAcc_24,24, IIf(BDMonthAcc_23,23, IIf(BDMonthAcc_22,22, IIf(BDMonthAcc_21,21, IIf(BDMonthAcc_20,20, IIf(BDMonthAcc_19,19, IIf(BDMonthAcc_18,18, IIf(BDMonthAcc_17,17, IIf(BDMonthAcc_16,16, IIf(BDMonthAcc_15,15, IIf(BDMonthAcc_14,14, IIf(BDMonthAcc_13,13, IIf(BDMonthAcc_12,12, IIf(BDMonthAcc_11,11, IIf(BDMonthAcc_10,10, IIf(BDMonthAcc_9,9, IIf(BDMonthAcc_8,8, IIf(BDMonthAcc_7,7, IIf(BDMonthAcc_6,6, IIf(BDMonthAcc_5,5, IIf(BDMonthAcc_4,4, IIf(BDMonthAcc_3,3, IIf(BDMonthAcc_2,2, IIf(BDMonthAcc_1,1,0)))))))))))))))))))))))))))))); BDMonthDist_1 = BDMonth>0; BDMonthDist_2 = BDMonthDist_1 AND Ref(BDMonth,-1)>0; BDMonthDist_3 = BDMonthDist_2 AND Ref(BDMonth,-2)>0; BDMonthDist_4 = BDMonthDist_3 AND Ref(BDMonth,-3)>0; BDMonthDist_5 = BDMonthDist_4 AND Ref(BDMonth,-4)>0; BDMonthDist_6 = BDMonthDist_5 AND Ref(BDMonth,-5)>0; BDMonthDist_7 = BDMonthDist_6 AND Ref(BDMonth,-6)>0; BDMonthDist_8 = BDMonthDist_7 AND Ref(BDMonth,-7)>0; BDMonthDist_9 = BDMonthDist_8 AND Ref(BDMonth,-8)>0; BDMonthDist_10 = BDMonthDist_9 AND Ref(BDMonth,-9)>0; BDMonthDist_11 = BDMonthDist_10 AND Ref(BDMonth,-10)>0; BDMonthDist_12 = BDMonthDist_11 AND Ref(BDMonth,-11)>0; BDMonthDist_13 = BDMonthDist_12 AND Ref(BDMonth,-12)>0; BDMonthDist_14 = BDMonthDist_13 AND Ref(BDMonth,-13)>0; BDMonthDist_15 = BDMonthDist_14 AND Ref(BDMonth,-14)>0; BDMonthDist_16 = BDMonthDist_15 AND Ref(BDMonth,-15)>0; BDMonthDist_17 = BDMonthDist_16 AND Ref(BDMonth,-16)>0; BDMonthDist_18 = BDMonthDist_17 AND Ref(BDMonth,-17)>0; BDMonthDist_19 = BDMonthDist_18 AND Ref(BDMonth,-18)>0; BDMonthDist_20 = BDMonthDist_19 AND Ref(BDMonth,-19)>0; BDMonthDist_21 = BDMonthDist_20 AND Ref(BDMonth,-20)>0; BDMonthDist_22 = BDMonthDist_21 AND Ref(BDMonth,-21)>0; BDMonthDist_23 = BDMonthDist_22 AND Ref(BDMonth,-22)>0; BDMonthDist_24 = BDMonthDist_23 AND Ref(BDMonth,-23)>0; BDMonthDist_25 = BDMonthDist_24 AND Ref(BDMonth,-24)>0; BDMonthDist_26 = BDMonthDist_25 AND Ref(BDMonth,-25)>0; BDMonthDist_27 = BDMonthDist_26 AND Ref(BDMonth,-26)>0; BDMonthDist_28 = BDMonthDist_27 AND Ref(BDMonth,-27)>0; BDMonthDist_29 = BDMonthDist_28 AND Ref(BDMonth,-28)>0; BDMonthDist_30 = BDMonthDist_29 AND Ref(BDMonth,-29)>0; BDMonthDist = IIf(BDMonthDist_30,30, IIf(BDMonthDist_29,29, IIf(BDMonthDist_28,28, IIf(BDMonthDist_27,27, IIf(BDMonthDist_26,26, IIf(BDMonthDist_25,25, IIf(BDMonthDist_24,24, IIf(BDMonthDist_23,23, IIf(BDMonthDist_22,22, IIf(BDMonthDist_21,21, IIf(BDMonthDist_20,20, IIf(BDMonthDist_19,19, IIf(BDMonthDist_18,18, IIf(BDMonthDist_17,17, IIf(BDMonthDist_16,16, IIf(BDMonthDist_15,15, IIf(BDMonthDist_14,14, IIf(BDMonthDist_13,13, IIf(BDMonthDist_12,12, IIf(BDMonthDist_11,11, IIf(BDMonthDist_10,10, IIf(BDMonthDist_9,9, IIf(BDMonthDist_8,8, IIf(BDMonthDist_7,7, IIf(BDMonthDist_6,6, IIf(BDMonthDist_5,5, IIf(BDMonthDist_4,4, IIf(BDMonthDist_3,3, IIf(BDMonthDist_2,2, IIf(BDMonthDist_1,1,0)))))))))))))))))))))))))))))); _SECTION_END(); //======================================================================================= _SECTION_BEGIN("Peak & Valley"); // E.M.Pottasch 09/06/10 //nbar =Param("nbar",3,1,5,1); nbar =5;// Param("nbar",3,1,5,1); PHigh = H > Ref(HHV(H,nbar),-1) AND Ref(HHV(H,nbar),nbar) < H; PHighPrice0 = ValueWhen(PHigh,H); PHighPrice1 = IIf(PHighPrice0 AND BarsSince(PHigh) > nbar,PHighPrice0,Null); PHighPrice2 = IIf(PHighPrice0 AND BarsSince(PHigh) <= nbar,PHighPrice0,Null); PLow = L < Ref(LLV(L,nbar),-1) AND Ref(LLV(L,nbar),nbar) > L; PLowPrice0 = ValueWhen(PLow,L); PLowPrice1 = IIf(PLowPrice0 AND BarsSince(Plow) > nbar,PLowPrice0,Null); PLowPrice2 = IIf(PLowPrice0 AND BarsSince(Plow) <= nbar,PLowPrice0,Null); //GraphXSpace = 5; //SetChartOptions(0, chartShowDates); //Plot(C,"\nLast",colorWhite,styleCandle); //Plot(PHighPrice1,"\nPHighPrice",colorOrange,styleThick); //Plot(PHighPrice2,"",colorOrange,styleDots | styleNoLine); //Plot(PLowPrice1,"\nPLowPrice",colorBrightGreen,styleThick); //Plot(PLowPrice2,"",colorBrightGreen,styleDots | styleNoLine); //Buy=H>Ref(PHighPrice0,-1); //Sell=LRef(PHighPrice0,-1); Sell_Peak_Valey=LLowerBand1 AND Ref(LowerBand1,-3) Peak --> Modified 20131227 //============================================== SupResA = 20;//Param("Sup-Res A Period",20,0,100,1); SupResB = 25;//Param("Sup-Res B Period",25,0,100,1); BuyOffSet = SupResA;//Optimize("BuyOffSet",18,15,20,1); SellOffset = BuyOffSet;//Optimize("SellOffset",2,2,14,2); RegLength = 5;//Optimize("RegLength",5, 2,11,2); BuyATRPeriod = 2;//Optimize("BuyATRPeriod",2,2,5,1); SellATRPeriod = BuyATRPeriod;//Optimize("SellATRPeriod",4,2,11,2); ATRMultiplier = 0.5;//Optimize("ATRMultiplier",1,0.7,1.25,.05); SuppA = HHV(H-ATRMultiplier*ATR(BuyATRPeriod),BuyOffset); /* RED */ RessB = LLV(L+ATRMultiplier*ATR(SellATRPeriod),SellOffset); /* GREEN */ nn=SupResB; mmm=100; TYP=(High + Low + 2*Close)/4; CI=(TYP-MA(TYP,14))/(0.015*StDev(TYP,14)); CCCI=EMA(CI,5)+mmm; Hh=HHV(H,nn); Ll=LLV(L,nn); MM=(Hh+Ll)/2; CCCC=EMA(CCCI*(Hh-Ll)/(2*mmm)+Ll,5); Buy_shr2 = Cross(H,Ref(Hh,-1)); Sell_shr2 = Cross (Ref(Ll,-1),L); Buy_shr2 =ExRem(Buy_shr2 ,Sell_shr2 );Sell_shr2 =ExRem(Sell_shr2 ,Buy_shr2 ); //Up5BarFractal = Ref(H,-3) < H AND Ref(H,-2) < H AND Ref(H,-1) < H AND Ref(H,1) < H;// AND Ref(H,2) < H; Up5BarFractal = Ref(H,-2) < H AND Ref(H,-1) < H AND Ref(H,1) < H;// AND Ref(H,2) < H; Down5BarFractal = Ref(L,-3) > L AND Ref(L,-2) > L AND Ref(L,-1) > L AND Ref(L,1) > L;// AND Ref(L,2) > L; //Down5BarFractal = Ref(L,-2) > L AND Ref(L,-1) > L AND Ref(L,1) > L;// AND Ref(L,2) > L; Up = (Up5BarFractal ); Down = (Down5BarFractal); Buy_Fractal = IIf(Down ,1,0); Sell_Fractal = IIf(Up,1,0) ; //Up5BarFractal = Ref(H,-3) < H AND Ref(H,-2) < H AND Ref(H,-1) < H AND Ref(H,1) < H;// AND Ref(H,2) < H; Up5BarFractal = Ref(H,-2) < H AND Ref(H,-1) < H AND Ref(H,1) < H AND Ref(H,2) < H; Down5BarFractal = Ref(L,-3) > L AND Ref(L,-2) > L AND Ref(L,-1) > L AND Ref(L,1) >= L;// AND Ref(L,2) > L; //Down5BarFractal = Ref(L,-2) > L AND Ref(L,-1) > L AND Ref(L,1) > L;// AND Ref(L,2) > L; Up = (Up5BarFractal ); Down = (Down5BarFractal); Buy_Fractal2 = IIf(Down ,1,0); Sell_Fractal2 = IIf(Up,1,0) ; //Up5BarFractal = Ref(H,-3) < H AND Ref(H,-2) < H AND Ref(H,-1) < H AND Ref(H,1) < H;// AND Ref(H,2) < H; Up5BarFractal = Ref(H,-3) < H AND Ref(H,-2) < H AND Ref(H,-1) < H AND Ref(H,1) <= H;// AND Ref(H,2) < H; Down5BarFractal = Ref(L,-2) > L AND Ref(L,-1) > L AND Ref(L,1) > L AND Ref(L,2) > L; //Down5BarFractal = Ref(L,-2) > L AND Ref(L,-1) > L AND Ref(L,1) > L;// AND Ref(L,2) > L; Up = (Up5BarFractal ); Down = (Down5BarFractal); Buy_Fractal3 = IIf(Down ,1,0); Sell_Fractal3 = IIf(Up,1,0) ; nbar =2;// Param("nbar",3,1,5,1); PHigh = H > Ref(HHV(H,nbar),-1) AND Ref(HHV(H,nbar),nbar) < H; PHigh = Ref(H,-2) < H AND Ref(H,-1) < H AND Ref(H,1) < H AND Ref(H,2) < H; PHighPrice0 = ValueWhen(PHigh,H); PHighPrice1 = IIf(PHighPrice0 AND BarsSince(PHigh) > nbar,PHighPrice0,Null); PHighPrice2 = IIf(PHighPrice0 AND BarsSince(PHigh) <= nbar,PHighPrice0,Null); PLow = L < Ref(LLV(L,nbar),-1) AND Ref(LLV(L,nbar),nbar) > L; PLow = Ref(L,-2) > L AND Ref(L,-1) > L AND Ref(L,1) > L AND Ref(L,2) > L; PLowPrice0 = ValueWhen(PLow,L); PLowPrice1 = IIf(PLowPrice0 AND BarsSince(Plow) > nbar,PLowPrice0,Null); PLowPrice2 = IIf(PLowPrice0 AND BarsSince(Plow) <= nbar,PLowPrice0,Null); Buy_peak=H>PHighPrice0; Sell_peak=LLowerBand2 AND IIf(Flip( Buy_shr2, Sell_shr2),1,0)==0) OR Buy_shr2 // OR (Cmidpoint AND IIf(Flip( Buy_shr2, Sell_shr2),1,0)==0) OR(IIf(Flip( Buy_shr2, Sell_shr2),1,0)==0 AND Cross(UpperBand2,C)) OR(IIf(Flip( Buy_shr2, Sell_shr2),1,0)==0 AND Cross(UpperBand3,C)) OR(IIf(Flip( Buy_shr2, Sell_shr2),1,0)==0 AND Cross(UpperBand4,C)) OR (IIf(Ref(Flip( Buy_shr2, Sell_shr2),-1),1,0)==1 AND Sell_shr2) OR (Sell_Fractal2 AND CUpperBand3); //============================================== // END //============================================== BuyDT=ExRem(BuyDT,SellDT);SellDT=ExRem(SellDT,BuyDT); //Buy=ExRem(Buy,Sell); //Sell=ExRem(Sell,Buy); //Buy_Peak_Valey=ExRem(Buy_Peak_Valey,Sell_Peak_Valey); //Sell_Peak_Valey=ExRem(Sell_Peak_Valey,Buy_Peak_Valey); Buy_Peak_Valey=BuyDT; Sell_Peak_Valey=SellDT; //Plot( Flip( Buy, Sell ), "Trade", colorDarkGreen, styleArea | styleOwnScale, 0, 1 ); //PlotShapes(IIf(Buy , shapeSmallUpTriangle, shapeNone) ,colorGreen, 0,L,-30); //PlotShapes(IIf( Sell, shapeSmallDownTriangle, shapeNone) ,colorOrange, 0,H,-25); Buy_PV_1= Ref(Flip(Buy_Peak_Valey,Sell_Peak_Valey),0)==1; Buy_PV_2= Buy_PV_1 AND Ref(Flip(Buy_Peak_Valey,Sell_Peak_Valey),-1)==1; Buy_PV_3= Buy_PV_2 AND Ref(Flip(Buy_Peak_Valey,Sell_Peak_Valey),-2)==1; Buy_PV_4= Buy_PV_3 AND Ref(Flip(Buy_Peak_Valey,Sell_Peak_Valey),-3)==1; Buy_PV_5= Buy_PV_4 AND Ref(Flip(Buy_Peak_Valey,Sell_Peak_Valey),-4)==1; Buy_PV_6= Buy_PV_5 AND Ref(Flip(Buy_Peak_Valey,Sell_Peak_Valey),-5)==1; Buy_PV_7= Buy_PV_6 AND Ref(Flip(Buy_Peak_Valey,Sell_Peak_Valey),-6)==1; Buy_PV_8= Buy_PV_7 AND Ref(Flip(Buy_Peak_Valey,Sell_Peak_Valey),-7)==1; Buy_PV_9= Buy_PV_8 AND Ref(Flip(Buy_Peak_Valey,Sell_Peak_Valey),-8)==1; Buy_PV_10= Buy_PV_9 AND Ref(Flip(Buy_Peak_Valey,Sell_Peak_Valey),-9)==1; Buy_PV_11= Buy_PV_10 AND Ref(Flip(Buy_Peak_Valey,Sell_Peak_Valey),-10)==1; Buy_PV_12= Buy_PV_11 AND Ref(Flip(Buy_Peak_Valey,Sell_Peak_Valey),-11)==1; Buy_PV_13= Buy_PV_12 AND Ref(Flip(Buy_Peak_Valey,Sell_Peak_Valey),-12)==1; Buy_PV_14= Buy_PV_13 AND Ref(Flip(Buy_Peak_Valey,Sell_Peak_Valey),-13)==1; Buy_PV_15= Buy_PV_14 AND Ref(Flip(Buy_Peak_Valey,Sell_Peak_Valey),-14)==1; Buy_PV_16= Buy_PV_15 AND Ref(Flip(Buy_Peak_Valey,Sell_Peak_Valey),-15)==1; Buy_PV_17= Buy_PV_16 AND Ref(Flip(Buy_Peak_Valey,Sell_Peak_Valey),-16)==1; Buy_PV_18= Buy_PV_17 AND Ref(Flip(Buy_Peak_Valey,Sell_Peak_Valey),-17)==1; Buy_PV_19= Buy_PV_18 AND Ref(Flip(Buy_Peak_Valey,Sell_Peak_Valey),-18)==1; Buy_PV_20= Buy_PV_19 AND Ref(Flip(Buy_Peak_Valey,Sell_Peak_Valey),-19)==1; Buy_PV_21= Buy_PV_20 AND Ref(Flip(Buy_Peak_Valey,Sell_Peak_Valey),-20)==1; Buy_PV_22= Buy_PV_21 AND Ref(Flip(Buy_Peak_Valey,Sell_Peak_Valey),-21)==1; Buy_PV_23= Buy_PV_22 AND Ref(Flip(Buy_Peak_Valey,Sell_Peak_Valey),-22)==1; Buy_PV_24= Buy_PV_23 AND Ref(Flip(Buy_Peak_Valey,Sell_Peak_Valey),-23)==1; Buy_PV_25= Buy_PV_24 AND Ref(Flip(Buy_Peak_Valey,Sell_Peak_Valey),-24)==1; Buy_PV_26= Buy_PV_25 AND Ref(Flip(Buy_Peak_Valey,Sell_Peak_Valey),-25)==1; Buy_PV_27= Buy_PV_26 AND Ref(Flip(Buy_Peak_Valey,Sell_Peak_Valey),-26)==1; Buy_PV_28= Buy_PV_27 AND Ref(Flip(Buy_Peak_Valey,Sell_Peak_Valey),-27)==1; Buy_PV_29= Buy_PV_28 AND Ref(Flip(Buy_Peak_Valey,Sell_Peak_Valey),-28)==1; Buy_PV_30= Buy_PV_29 AND Ref(Flip(Buy_Peak_Valey,Sell_Peak_Valey),-29)==1; Sell_PV_1= Ref(Flip(Buy_Peak_Valey,Sell_Peak_Valey),0)==0; Sell_PV_2= Sell_PV_1 AND Ref(Flip(Buy_Peak_Valey,Sell_Peak_Valey),-1)==0; Sell_PV_3= Sell_PV_2 AND Ref(Flip(Buy_Peak_Valey,Sell_Peak_Valey),-2)==0; Sell_PV_4= Sell_PV_3 AND Ref(Flip(Buy_Peak_Valey,Sell_Peak_Valey),-3)==0; Sell_PV_5= Sell_PV_4 AND Ref(Flip(Buy_Peak_Valey,Sell_Peak_Valey),-4)==0; Sell_PV_6= Sell_PV_5 AND Ref(Flip(Buy_Peak_Valey,Sell_Peak_Valey),-5)==0; Sell_PV_7= Sell_PV_6 AND Ref(Flip(Buy_Peak_Valey,Sell_Peak_Valey),-6)==0; Sell_PV_8= Sell_PV_7 AND Ref(Flip(Buy_Peak_Valey,Sell_Peak_Valey),-7)==0; Sell_PV_9= Sell_PV_8 AND Ref(Flip(Buy_Peak_Valey,Sell_Peak_Valey),-8)==0; Sell_PV_10= Sell_PV_9 AND Ref(Flip(Buy_Peak_Valey,Sell_Peak_Valey),-9)==0; Sell_PV_11= Sell_PV_10 AND Ref(Flip(Buy_Peak_Valey,Sell_Peak_Valey),-10)==0; Sell_PV_12= Sell_PV_11 AND Ref(Flip(Buy_Peak_Valey,Sell_Peak_Valey),-11)==0; Sell_PV_13= Sell_PV_12 AND Ref(Flip(Buy_Peak_Valey,Sell_Peak_Valey),-12)==0; Sell_PV_14= Sell_PV_13 AND Ref(Flip(Buy_Peak_Valey,Sell_Peak_Valey),-13)==0; Sell_PV_15= Sell_PV_14 AND Ref(Flip(Buy_Peak_Valey,Sell_Peak_Valey),-14)==0; Sell_PV_16= Sell_PV_15 AND Ref(Flip(Buy_Peak_Valey,Sell_Peak_Valey),-15)==0; Sell_PV_17= Sell_PV_16 AND Ref(Flip(Buy_Peak_Valey,Sell_Peak_Valey),-16)==0; Sell_PV_18= Sell_PV_17 AND Ref(Flip(Buy_Peak_Valey,Sell_Peak_Valey),-17)==0; Sell_PV_19= Sell_PV_18 AND Ref(Flip(Buy_Peak_Valey,Sell_Peak_Valey),-18)==0; Sell_PV_20= Sell_PV_19 AND Ref(Flip(Buy_Peak_Valey,Sell_Peak_Valey),-19)==0; Sell_PV_21= Sell_PV_20 AND Ref(Flip(Buy_Peak_Valey,Sell_Peak_Valey),-20)==0; Sell_PV_22= Sell_PV_21 AND Ref(Flip(Buy_Peak_Valey,Sell_Peak_Valey),-21)==0; Sell_PV_23= Sell_PV_22 AND Ref(Flip(Buy_Peak_Valey,Sell_Peak_Valey),-22)==0; Sell_PV_24= Sell_PV_23 AND Ref(Flip(Buy_Peak_Valey,Sell_Peak_Valey),-23)==0; Sell_PV_25= Sell_PV_24 AND Ref(Flip(Buy_Peak_Valey,Sell_Peak_Valey),-24)==0; Sell_PV_26= Sell_PV_25 AND Ref(Flip(Buy_Peak_Valey,Sell_Peak_Valey),-25)==0; Sell_PV_27= Sell_PV_26 AND Ref(Flip(Buy_Peak_Valey,Sell_Peak_Valey),-26)==0; Sell_PV_28= Sell_PV_27 AND Ref(Flip(Buy_Peak_Valey,Sell_Peak_Valey),-27)==0; Sell_PV_29= Sell_PV_28 AND Ref(Flip(Buy_Peak_Valey,Sell_Peak_Valey),-28)==0; Sell_PV_30= Sell_PV_29 AND Ref(Flip(Buy_Peak_Valey,Sell_Peak_Valey),-29)==0; Buy_PV= IIf(Buy_PV_30,30, IIf(Buy_PV_29,29, IIf(Buy_PV_28,28, IIf(Buy_PV_27,27, IIf(Buy_PV_26,26, IIf(Buy_PV_25,25, IIf(Buy_PV_24,24, IIf(Buy_PV_23,23, IIf(Buy_PV_22,22, IIf(Buy_PV_21,21, IIf(Buy_PV_20,20, IIf(Buy_PV_19,19, IIf(Buy_PV_18,18, IIf(Buy_PV_17,17, IIf(Buy_PV_16,16, IIf(Buy_PV_15,15, IIf(Buy_PV_14,14, IIf(Buy_PV_13,13, IIf(Buy_PV_12,12, IIf(Buy_PV_11,11, IIf(Buy_PV_10,10, IIf(Buy_PV_9,9, IIf(Buy_PV_8,8, IIf(Buy_PV_7,7, IIf(Buy_PV_6,6, IIf(Buy_PV_5,5, IIf(Buy_PV_4,4, IIf(Buy_PV_3,3, IIf(Buy_PV_2,2, IIf(Buy_PV_1,1,0)))))))))))))))))))))))))))))); Sell_PV= IIf(Sell_PV_30,30, IIf(Sell_PV_29,29, IIf(Sell_PV_28,28, IIf(Sell_PV_27,27, IIf(Sell_PV_26,26, IIf(Sell_PV_25,25, IIf(Sell_PV_24,24, IIf(Sell_PV_23,23, IIf(Sell_PV_22,22, IIf(Sell_PV_21,21, IIf(Sell_PV_20,20, IIf(Sell_PV_19,19, IIf(Sell_PV_18,18, IIf(Sell_PV_17,17, IIf(Sell_PV_16,16, IIf(Sell_PV_15,15, IIf(Sell_PV_14,14, IIf(Sell_PV_13,13, IIf(Sell_PV_12,12, IIf(Sell_PV_11,11, IIf(Sell_PV_10,10, IIf(Sell_PV_9,9, IIf(Sell_PV_8,8, IIf(Sell_PV_7,7, IIf(Sell_PV_6,6, IIf(Sell_PV_5,5, IIf(Sell_PV_4,4, IIf(Sell_PV_3,3, IIf(Sell_PV_2,2, IIf(Sell_PV_1,1,0)))))))))))))))))))))))))))))); _SECTION_END(); //======================================================================================= _SECTION_BEGIN("Fractal"); CY2 =80/2;// Param("Medium Cycle Length?" ,80, 1 ,1000 ,1 )/2; UpperBand4 =EMA( C, CY2) + ( 6.8540 * ATR(CY2)); UpperBand3 =EMA( C, CY2) + ( 4.2360 * ATR(CY2)); UpperBand2=EMA( C, CY2) + ( 2.6180 * ATR(CY2)); UpperBand1=EMA( C, CY2) + ( 1.6180 * ATR(CY2)); MidPoint=EMA(C, CY2); LowerBand1=EMA( C, CY2) - ( 1.6180 * ATR(CY2)); LowerBand2=EMA( C, CY2) - ( 2.6180 * ATR(CY2)); LowerBand3=EMA( C, CY2) - ( 4.2360 * ATR(CY2)); LowerBand4=EMA( C, CY2) - ( 6.8540 * ATR(CY2)); //============================================== //Type 30 --> Peak --> Modified 20131227 //============================================== SupResA = 20;//Param("Sup-Res A Period",20,0,100,1); SupResB = 25;//Param("Sup-Res B Period",25,0,100,1); BuyOffSet = SupResA;//Optimize("BuyOffSet",18,15,20,1); SellOffset = BuyOffSet;//Optimize("SellOffset",2,2,14,2); RegLength = 5;//Optimize("RegLength",5, 2,11,2); BuyATRPeriod = 2;//Optimize("BuyATRPeriod",2,2,5,1); SellATRPeriod = BuyATRPeriod;//Optimize("SellATRPeriod",4,2,11,2); ATRMultiplier = 0.5;//Optimize("ATRMultiplier",1,0.7,1.25,.05); SuppA = HHV(H-ATRMultiplier*ATR(BuyATRPeriod),BuyOffset); /* RED */ RessB = LLV(L+ATRMultiplier*ATR(SellATRPeriod),SellOffset); /* GREEN */ nn=SupResB; mmm=100; TYP=(High + Low + 2*Close)/4; CI=(TYP-MA(TYP,14))/(0.015*StDev(TYP,14)); CCCI=EMA(CI,5)+mmm; Hh=HHV(H,nn); Ll=LLV(L,nn); MM=(Hh+Ll)/2; CCCC=EMA(CCCI*(Hh-Ll)/(2*mmm)+Ll,5); Buy_shr2 = Cross(H,Ref(Hh,-1)); Sell_shr2 = Cross (Ref(Ll,-1),L); Buy_shr2 =ExRem(Buy_shr2 ,Sell_shr2 );Sell_shr2 =ExRem(Sell_shr2 ,Buy_shr2 ); //Up5BarFractal = Ref(H,-3) < H AND Ref(H,-2) < H AND Ref(H,-1) < H AND Ref(H,1) < H;// AND Ref(H,2) < H; Up5BarFractal = Ref(H,-2) < H AND Ref(H,-1) < H AND Ref(H,1) < H;// AND Ref(H,2) < H; Down5BarFractal = Ref(L,-3) > L AND Ref(L,-2) > L AND Ref(L,-1) > L AND Ref(L,1) > L;// AND Ref(L,2) > L; //Down5BarFractal = Ref(L,-2) > L AND Ref(L,-1) > L AND Ref(L,1) > L;// AND Ref(L,2) > L; Up = (Up5BarFractal ); Down = (Down5BarFractal); Buy_Fractal = IIf(Down ,1,0); Sell_Fractal = IIf(Up,1,0) ; //Up5BarFractal = Ref(H,-3) < H AND Ref(H,-2) < H AND Ref(H,-1) < H AND Ref(H,1) < H;// AND Ref(H,2) < H; Up5BarFractal = Ref(H,-2) < H AND Ref(H,-1) < H AND Ref(H,1) < H AND Ref(H,2) < H; Down5BarFractal = Ref(L,-3) > L AND Ref(L,-2) > L AND Ref(L,-1) > L AND Ref(L,1) >= L AND Ref(L,2) > L;// AND Ref(L,2) > L; //Down5BarFractal = Ref(L,-2) > L AND Ref(L,-1) > L AND Ref(L,1) > L;// AND Ref(L,2) > L; Up = (Up5BarFractal ); Down = (Down5BarFractal); Buy_Fractal2 = IIf(Down ,1,0); Sell_Fractal2 = IIf(Up,1,0) ; //Up5BarFractal = Ref(H,-3) < H AND Ref(H,-2) < H AND Ref(H,-1) < H AND Ref(H,1) < H;// AND Ref(H,2) < H; Up5BarFractal = Ref(H,-3) < H AND Ref(H,-2) < H AND Ref(H,-1) < H AND Ref(H,1) <= H;// AND Ref(H,2) < H; Down5BarFractal = Ref(L,-2) > L AND Ref(L,-1) > L AND Ref(L,1) > L AND Ref(L,2) > L; //Down5BarFractal = Ref(L,-2) > L AND Ref(L,-1) > L AND Ref(L,1) > L;// AND Ref(L,2) > L; Up = (Up5BarFractal ); Down = (Down5BarFractal); Buy_Fractal3 = IIf(Down ,1,0); Sell_Fractal3 = IIf(Up,1,0) ; nbar =2;// Param("nbar",3,1,5,1); PHigh = H > Ref(HHV(H,nbar),-1) AND Ref(HHV(H,nbar),nbar) < H; PHigh = Ref(H,-2) < H AND Ref(H,-1) < H AND Ref(H,1) < H AND Ref(H,2) < H; PHighPrice0 = ValueWhen(PHigh,H); PHighPrice1 = IIf(PHighPrice0 AND BarsSince(PHigh) > nbar,PHighPrice0,Null); PHighPrice2 = IIf(PHighPrice0 AND BarsSince(PHigh) <= nbar,PHighPrice0,Null); PLow = L < Ref(LLV(L,nbar),-1) AND Ref(LLV(L,nbar),nbar) > L; PLow = Ref(L,-2) > L AND Ref(L,-1) > L AND Ref(L,1) > L AND Ref(L,2) > L; PLowPrice0 = ValueWhen(PLow,L); PLowPrice1 = IIf(PLowPrice0 AND BarsSince(Plow) > nbar,PLowPrice0,Null); PLowPrice2 = IIf(PLowPrice0 AND BarsSince(Plow) <= nbar,PLowPrice0,Null); Buy_peak=H>PHighPrice0; Sell_peak=LLowerBand2 AND IIf(Flip( Buy_shr2, Sell_shr2),1,0)==0) OR Buy_shr2 // OR (C=Lowerband2 AND IIf(Flip( Buy_shr2, Sell_shr2),1,0)==0) OR(IIf(Flip( Buy_shr2, Sell_shr2),1,0)==0 AND Cross(UpperBand2,C)) OR(IIf(Flip( Buy_shr2, Sell_shr2),1,0)==0 AND Cross(UpperBand3,C)) OR(IIf(Flip( Buy_shr2, Sell_shr2),1,0)==0 AND Cross(UpperBand4,C)) OR (IIf(Ref(Flip( Buy_shr2, Sell_shr2),-1),1,0)==1 AND Sell_shr2) OR (Sell_Fractal2 AND CUpperBand3); Buy_fract1=ExRem(Buy_fract1,Sell_fract1);Sell_fract1=ExRem(Sell_fract1,Buy_fract1); //============================================== // END //============================================== Buy_Sheroune = Buy_fract1; Short_Sheroune = Sell_fract1; Cover_Sheroune = Buy_Sheroune; Sell_Sheroune = Short_Sheroune; Buy_Sheroune=ExRem(Buy_Sheroune,Sell_Sheroune); Sell_Sheroune=ExRem(Sell_Sheroune,Buy_Sheroune); PlotShapes( Buy_fract1 * shapeHollowSmallCircle, colorBlue,0,Graph0,-25); PlotShapes( Sell_fract1 * shapeHollowSmallCircle, colorBlue,0,Graph0,25); //PlotShapes( Buy_fract2 * shapeHollowSmallCircle, colorGreen,0,Graph0,-25); //PlotShapes( Sell_fract2 * shapeHollowSmallCircle, colorGreen,0,Graph0,25); //Plot( Flip( Buy, Sell ), "Trade", colorDarkGreen, styleArea | styleOwnScale, 0, 1 ); Buy_SHR_1= Ref(Flip(Buy_Sheroune,Sell_Sheroune),0)==1; Buy_SHR_2= Buy_SHR_1 AND Ref(Flip(Buy_Sheroune,Sell_Sheroune),-1)==1; Buy_SHR_3= Buy_SHR_2 AND Ref(Flip(Buy_Sheroune,Sell_Sheroune),-2)==1; Buy_SHR_4= Buy_SHR_3 AND Ref(Flip(Buy_Sheroune,Sell_Sheroune),-3)==1; Buy_SHR_5= Buy_SHR_4 AND Ref(Flip(Buy_Sheroune,Sell_Sheroune),-4)==1; Buy_SHR_6= Buy_SHR_5 AND Ref(Flip(Buy_Sheroune,Sell_Sheroune),-5)==1; Buy_SHR_7= Buy_SHR_6 AND Ref(Flip(Buy_Sheroune,Sell_Sheroune),-6)==1; Buy_SHR_8= Buy_SHR_7 AND Ref(Flip(Buy_Sheroune,Sell_Sheroune),-7)==1; Buy_SHR_9= Buy_SHR_8 AND Ref(Flip(Buy_Sheroune,Sell_Sheroune),-8)==1; Buy_SHR_10= Buy_SHR_9 AND Ref(Flip(Buy_Sheroune,Sell_Sheroune),-9)==1; Buy_SHR_11= Buy_SHR_10 AND Ref(Flip(Buy_Sheroune,Sell_Sheroune),-10)==1; Buy_SHR_12= Buy_SHR_11 AND Ref(Flip(Buy_Sheroune,Sell_Sheroune),-11)==1; Buy_SHR_13= Buy_SHR_12 AND Ref(Flip(Buy_Sheroune,Sell_Sheroune),-12)==1; Buy_SHR_14= Buy_SHR_13 AND Ref(Flip(Buy_Sheroune,Sell_Sheroune),-13)==1; Buy_SHR_15= Buy_SHR_14 AND Ref(Flip(Buy_Sheroune,Sell_Sheroune),-14)==1; Buy_SHR_16= Buy_SHR_15 AND Ref(Flip(Buy_Sheroune,Sell_Sheroune),-15)==1; Buy_SHR_17= Buy_SHR_16 AND Ref(Flip(Buy_Sheroune,Sell_Sheroune),-16)==1; Buy_SHR_18= Buy_SHR_17 AND Ref(Flip(Buy_Sheroune,Sell_Sheroune),-17)==1; Buy_SHR_19= Buy_SHR_18 AND Ref(Flip(Buy_Sheroune,Sell_Sheroune),-18)==1; Buy_SHR_20= Buy_SHR_19 AND Ref(Flip(Buy_Sheroune,Sell_Sheroune),-19)==1; Buy_SHR_21= Buy_SHR_20 AND Ref(Flip(Buy_Sheroune,Sell_Sheroune),-20)==1; Buy_SHR_22= Buy_SHR_21 AND Ref(Flip(Buy_Sheroune,Sell_Sheroune),-21)==1; Buy_SHR_23= Buy_SHR_22 AND Ref(Flip(Buy_Sheroune,Sell_Sheroune),-22)==1; Buy_SHR_24= Buy_SHR_23 AND Ref(Flip(Buy_Sheroune,Sell_Sheroune),-23)==1; Buy_SHR_25= Buy_SHR_24 AND Ref(Flip(Buy_Sheroune,Sell_Sheroune),-24)==1; Buy_SHR_26= Buy_SHR_25 AND Ref(Flip(Buy_Sheroune,Sell_Sheroune),-25)==1; Buy_SHR_27= Buy_SHR_26 AND Ref(Flip(Buy_Sheroune,Sell_Sheroune),-26)==1; Buy_SHR_28= Buy_SHR_27 AND Ref(Flip(Buy_Sheroune,Sell_Sheroune),-27)==1; Buy_SHR_29= Buy_SHR_28 AND Ref(Flip(Buy_Sheroune,Sell_Sheroune),-28)==1; Buy_SHR_30= Buy_SHR_29 AND Ref(Flip(Buy_Sheroune,Sell_Sheroune),-29)==1; Sell_SHR_1= Ref(Flip(Buy_Sheroune,Sell_Sheroune),0)==0; Sell_SHR_2= Sell_SHR_1 AND Ref(Flip(Buy_Sheroune,Sell_Sheroune),-1)==0; Sell_SHR_3= Sell_SHR_2 AND Ref(Flip(Buy_Sheroune,Sell_Sheroune),-2)==0; Sell_SHR_4= Sell_SHR_3 AND Ref(Flip(Buy_Sheroune,Sell_Sheroune),-3)==0; Sell_SHR_5= Sell_SHR_4 AND Ref(Flip(Buy_Sheroune,Sell_Sheroune),-4)==0; Sell_SHR_6= Sell_SHR_5 AND Ref(Flip(Buy_Sheroune,Sell_Sheroune),-5)==0; Sell_SHR_7= Sell_SHR_6 AND Ref(Flip(Buy_Sheroune,Sell_Sheroune),-6)==0; Sell_SHR_8= Sell_SHR_7 AND Ref(Flip(Buy_Sheroune,Sell_Sheroune),-7)==0; Sell_SHR_9= Sell_SHR_8 AND Ref(Flip(Buy_Sheroune,Sell_Sheroune),-8)==0; Sell_SHR_10= Sell_SHR_9 AND Ref(Flip(Buy_Sheroune,Sell_Sheroune),-9)==0; Sell_SHR_11= Sell_SHR_10 AND Ref(Flip(Buy_Sheroune,Sell_Sheroune),-10)==0; Sell_SHR_12= Sell_SHR_11 AND Ref(Flip(Buy_Sheroune,Sell_Sheroune),-11)==0; Sell_SHR_13= Sell_SHR_12 AND Ref(Flip(Buy_Sheroune,Sell_Sheroune),-12)==0; Sell_SHR_14= Sell_SHR_13 AND Ref(Flip(Buy_Sheroune,Sell_Sheroune),-13)==0; Sell_SHR_15= Sell_SHR_14 AND Ref(Flip(Buy_Sheroune,Sell_Sheroune),-14)==0; Sell_SHR_16= Sell_SHR_15 AND Ref(Flip(Buy_Sheroune,Sell_Sheroune),-15)==0; Sell_SHR_17= Sell_SHR_16 AND Ref(Flip(Buy_Sheroune,Sell_Sheroune),-16)==0; Sell_SHR_18= Sell_SHR_17 AND Ref(Flip(Buy_Sheroune,Sell_Sheroune),-17)==0; Sell_SHR_19= Sell_SHR_18 AND Ref(Flip(Buy_Sheroune,Sell_Sheroune),-18)==0; Sell_SHR_20= Sell_SHR_19 AND Ref(Flip(Buy_Sheroune,Sell_Sheroune),-19)==0; Sell_SHR_21= Sell_SHR_20 AND Ref(Flip(Buy_Sheroune,Sell_Sheroune),-20)==0; Sell_SHR_22= Sell_SHR_21 AND Ref(Flip(Buy_Sheroune,Sell_Sheroune),-21)==0; Sell_SHR_23= Sell_SHR_22 AND Ref(Flip(Buy_Sheroune,Sell_Sheroune),-22)==0; Sell_SHR_24= Sell_SHR_23 AND Ref(Flip(Buy_Sheroune,Sell_Sheroune),-23)==0; Sell_SHR_25= Sell_SHR_24 AND Ref(Flip(Buy_Sheroune,Sell_Sheroune),-24)==0; Sell_SHR_26= Sell_SHR_25 AND Ref(Flip(Buy_Sheroune,Sell_Sheroune),-25)==0; Sell_SHR_27= Sell_SHR_26 AND Ref(Flip(Buy_Sheroune,Sell_Sheroune),-26)==0; Sell_SHR_28= Sell_SHR_27 AND Ref(Flip(Buy_Sheroune,Sell_Sheroune),-27)==0; Sell_SHR_29= Sell_SHR_28 AND Ref(Flip(Buy_Sheroune,Sell_Sheroune),-28)==0; Sell_SHR_30= Sell_SHR_29 AND Ref(Flip(Buy_Sheroune,Sell_Sheroune),-29)==0; Buy_SHR= IIf(Buy_SHR_30,30, IIf(Buy_SHR_29,29, IIf(Buy_SHR_28,28, IIf(Buy_SHR_27,27, IIf(Buy_SHR_26,26, IIf(Buy_SHR_25,25, IIf(Buy_SHR_24,24, IIf(Buy_SHR_23,23, IIf(Buy_SHR_22,22, IIf(Buy_SHR_21,21, IIf(Buy_SHR_20,20, IIf(Buy_SHR_19,19, IIf(Buy_SHR_18,18, IIf(Buy_SHR_17,17, IIf(Buy_SHR_16,16, IIf(Buy_SHR_15,15, IIf(Buy_SHR_14,14, IIf(Buy_SHR_13,13, IIf(Buy_SHR_12,12, IIf(Buy_SHR_11,11, IIf(Buy_SHR_10,10, IIf(Buy_SHR_9,9, IIf(Buy_SHR_8,8, IIf(Buy_SHR_7,7, IIf(Buy_SHR_6,6, IIf(Buy_SHR_5,5, IIf(Buy_SHR_4,4, IIf(Buy_SHR_3,3, IIf(Buy_SHR_2,2, IIf(Buy_SHR_1,1,0)))))))))))))))))))))))))))))); Sell_SHR= IIf(Sell_SHR_30,30, IIf(Sell_SHR_29,29, IIf(Sell_SHR_28,28, IIf(Sell_SHR_27,27, IIf(Sell_SHR_26,26, IIf(Sell_SHR_25,25, IIf(Sell_SHR_24,24, IIf(Sell_SHR_23,23, IIf(Sell_SHR_22,22, IIf(Sell_SHR_21,21, IIf(Sell_SHR_20,20, IIf(Sell_SHR_19,19, IIf(Sell_SHR_18,18, IIf(Sell_SHR_17,17, IIf(Sell_SHR_16,16, IIf(Sell_SHR_15,15, IIf(Sell_SHR_14,14, IIf(Sell_SHR_13,13, IIf(Sell_SHR_12,12, IIf(Sell_SHR_11,11, IIf(Sell_SHR_10,10, IIf(Sell_SHR_9,9, IIf(Sell_SHR_8,8, IIf(Sell_SHR_7,7, IIf(Sell_SHR_6,6, IIf(Sell_SHR_5,5, IIf(Sell_SHR_4,4, IIf(Sell_SHR_3,3, IIf(Sell_SHR_2,2, IIf(Sell_SHR_1,1,0)))))))))))))))))))))))))))))); _SECTION_END(); //======================================================================================= //======================================================================================= _SECTION_BEGIN("Lower Band 2"); //Buy_LowerBand2 =C>LowerBand1 AND Ref(LowerBand1,-3)LowerBand2 AND Ref(LowerBand2,-3)LowerBand2 AND CTrixma,1,-1)==-1 AND IIf(Lower_x,1,0)==0 AND Ref(Lower,-1)>=1 AND IIf(Flip( Buy_LowerBand2, Sell_LowerBand2 ),1,0)==1; Sell=Sell_LowerBand2 OR(Ref(C,-1)>UpperBand4 AND CUpperBand3 AND CUpperBand2 AND C=1) OR (CLowerBand2 AND C=1) OR (C>LowerBand2 AND CLowerBand2 AND CTrixma,1,-1)==-1 AND IIf(Lower_x,1,0)==0 AND Ref(Lower,-1)>=1 AND IIf(Flip( Buy_LowerBand2, Sell_LowerBand2 ),1,0)==1; //Sell_trimx3=Sell_LowerBand2 OR(Ref(C,-1)>UpperBand4 AND CUpperBand3 AND CUpperBand2 AND CLowerBand2 AND C=1) OR (C>LowerBand2 AND CLowerBand2 AND C=1 AND IIf(Flip( Buy_LowerBand2, Sell_LowerBand2 ),1,0)==0) OR (C>LowerBand2 AND CLowerBand2 AND C=1 AND IIf(Flip( Buy_LowerBand2, Sell_LowerBand2 ),1,0)==0) OR (C>LowerBand2 AND C0; //Buy=ExRem(Buy,Sell); Sell=ExRem(Sell,Buy); //Buy_LowerBand2 =C>LowerBand2 AND Ref(LowerBand2,-3)0,colorGreen,colorDefault)),colorDefault); AddColumn(Jumlah_Lot, "Jml Lot", 1.2); AddColumn(Harga_Beli, "Harga (ribuan)", 1.2); //AddColumn(IIf(Trixm>Trixma,1,-1),"Cr",1.0,colorDefault,IIf(Trixm>Trixma,colorRed,colorGreen)); //AddColumn(IIf(Lower_x,1,0),"Low_x",1.0,colorDefault,IIf(Lower_x,colorGreen,colorDefault)); //AddColumn(IIf(Lower==0,Not_Lower,Lower),"Low",1.0,colorDefault,IIf(Lower_x,colorGreen,colorDefault)); //AddColumn(IIf(Upper_x,1,0),"Up_x",1.0,colorDefault,IIf(Upper_x,colorRed,colorDefault)); //AddColumn(IIf(Upper==0,Not_Upper,Upper),"Up",1.0,colorDefault,IIf(Upper_x,colorRed,colorDefault)); //AddColumn(Lower_z,"Low_z",1.0,colorDefault,IIf(Lower_xy,colorGreen,colorDefault)); //AddColumn(Upper_z,"Up_z",1.0,colorDefault,IIf(Upper_xy,colorRed,colorDefault)); //AddColumn(IIf(Trixm>0,1,-1),"Cr_0",1.0,colorDefault,IIf(Trixm>0,colorRed,colorGreen)); //AddColumn(IIf(Trixm<0 AND Trixm>=TrixMALower1,1,IIf(Trixm=TrixMALower2,2,IIf(Trixm=TrixMALower3,3,IIf(Trixm=TrixMALower4,4,IIf(Trixm=TrixMALower1,colorDarkGreen,IIf(Trixm=TrixMALower2,colorViolet,IIf(Trixm=TrixMALower3,colorDarkRed,IIf(Trixm=TrixMALower4,colorDarkGrey,IIf(Trixm0 AND Trixm<=TrixMAUpper1,1,IIf(Trixm>TrixMAUpper1 AND Trixm<=TrixMAUpper2,2,IIf(Trixm>TrixMAUpper2 AND Trixm<=TrixMAUpper3,3,IIf(Trixm>TrixMAUpper3 AND Trixm<=TrixMAUpper4,4,IIf(Trixm>TrixMAUpper4,5,0))))),"U_01",1.0,colorDefault,IIf(Trixm>0 AND Trixm<=TrixMAUpper1,colorDarkGreen,IIf(Trixm>TrixMAUpper1 AND Trixm<=TrixMAUpper2,colorViolet,IIf(Trixm>TrixMAUpper2 AND Trixm<=TrixMAUpper3,colorDarkRed,IIf(Trixm>TrixMAUpper3 AND Trixm<=TrixMAUpper4,colorDarkGrey,IIf(Trixm>TrixMAUpper4,colorDarkTeal,colorDefault)))))); AddColumn(IIf(UpperDolly_0,1,IIf(UpperDolly_1,2,IIf(UpperDolly_2,3,IIf(UpperDolly_3,4,IIf(UpperDolly_4,5,0))))),"U_02",1.0,colorDefault,IIf(UpperDolly_0,colorDarkGreen,IIf(UpperDolly_1,colorViolet,IIf(UpperDolly_2,colorDarkRed,IIf(UpperDolly_3,colorDarkGrey,IIf(UpperDolly_4,colorDarkTeal,colorDefault)))))); //AddColumn(StoRSI ,"StoRSI",1.0,colorDefault,IIf(StoRSI >50,IIf(StoRSI >70,colorRed,colorDarkRed),IIf(StoRSI <=30,colorGreen,colorDarkGreen))); //AddColumn(PR,"R",1.0,colorDefault,IIf(PR>50,IIf(PR>70,colorRed,colorDarkRed),IIf(PR<=30,colorGreen,colorDarkGreen))); //AddColumn(StochCCI,"StochCCI",1.0,colorDefault,IIf(StochCCI>50,IIf(StochCCI>80,colorRed,colorDarkRed),IIf(StochCCI<=20,colorGreen,colorDarkGreen))); //AddColumn(x1,"CCI",1.0,colorDefault,IIf(x1>0,IIf(x1>100,colorRed,colorDarkRed),IIf(x1<=-100,colorGreen,colorDarkGreen))); //AddColumn(IIf(BDMonth>0,1,0),"BDM",1.0,colorDefault,ColorBM); //AddColumn(IIf(BDMonth>0,BDMonthDist,BDMonthAcc),"BDMD",1.0,colorDefault,ColorBM); //AddColumn(IIf(BDWeek>0,1,0),"BDW",1.0,colorDefault,ColorBW); //AddColumn(IIf(BDWeek>0,BDWeekDist,BDWeekAcc),"BDWD",1.0,colorDefault,ColorBW); //AddColumn(IIf(MAuv>MAdv,1,0),"BBV",1.0,colorDefault,ColorBBV); //AddColumn(IIf(MAuv>MAdv,BBVAcc,BBVDist),"BBVD",1.0,colorDefault,ColorBBV); //AddColumn(Flip(Buy_trimx3,Sell_trimx3),"TR3",1.0,colorDefault,IIf(Flip(Buy_trimx3,Sell_trimx3)==1,colorGreen,colorRed)); //AddColumn(IIf(Flip(Buy_trimx3,Sell_trimx3)==1,Buy_TR3,Sell_TR3),"Day_TR3",1.0,colorDefault,IIf(Flip(Buy_trimx3,Sell_trimx3)==1,colorGreen,colorRed)); AddColumn(Flip(Buy_Peak_Valey,Sell_Peak_Valey),"DT",1.0,colorDefault,IIf(Flip(Buy_Peak_Valey,Sell_Peak_Valey)==1,colorGreen,colorRed)); AddColumn(IIf(Flip(Buy_Peak_Valey,Sell_Peak_Valey)==1,Buy_PV,Sell_PV),"Day_DT",1.0,colorDefault,IIf(Flip(Buy_Peak_Valey,Sell_Peak_Valey)==1,colorGreen,colorRed)); //AddColumn(Flip(Buy_Sheroune,Sell_Sheroune),"FR",1.0,colorDefault,IIf(Flip(Buy_Sheroune,Sell_Sheroune)==1,colorGreen,colorRed)); //AddColumn(IIf(Flip(Buy_Sheroune,Sell_Sheroune)==1,Buy_SHR,Sell_SHR),"Day_FR",1.0,colorDefault,IIf(Flip(Buy_Sheroune,Sell_Sheroune)==1,colorGreen,colorRed)); //AddColumn(IIf(Flip(Buy_Sheroune,Sell_Sheroune)==1,1,IIf(Sell_SHR==1,1,0)),"FR",1.0,colorDefault,IIf(Flip(Buy_Sheroune,Sell_Sheroune)==1,colorYellow,IIf(Sell_SHR==1,colorGreen,colorRed))); //AddColumn(IIf(Flip(Buy_Sheroune,Sell_Sheroune)==1,Buy_SHR,Sell_SHR),"Day_FR",1.0,colorDefault,IIf(Flip(Buy_Sheroune,Sell_Sheroune)==1,colorYellow,IIf(Sell_SHR==1,colorGreen,colorRed))); AddColumn(IIf(Flip(Buy_Sheroune,Sell_Sheroune)==1,1,0),"FR",1.0,colorDefault,IIf(Flip(Buy_Sheroune,Sell_Sheroune)==1,colorYellow,IIf(Sell_SHR==1,colorGreen,colorRed))); AddColumn(IIf(Flip(Buy_Sheroune,Sell_Sheroune)==1,Buy_SHR,Sell_SHR),"Day_FR",1.0,colorDefault,IIf(Flip(Buy_Sheroune,Sell_Sheroune)==1,colorYellow,IIf(Sell_SHR==1,colorGreen,colorRed))); AddColumn(Flip(Buy_LowerBand2,Sell_LowerBand2),"LB2",1.0,colorDefault,IIf(Flip(Buy_LowerBand2,Sell_LowerBand2)==1,colorGreen,colorRed)); AddColumn(IIf(Flip(Buy_LowerBand2,Sell_LowerBand2)==1,Buy_LB2,Sell_LB2),"Day_LB2",1.0,colorDefault,IIf(Flip(Buy_LowerBand2,Sell_LowerBand2)==1,colorGreen,colorRed)); //AddColumn(Flip(Buy_ATR_Sys,Sell_ATR_Sys),"ATR",1.0,colorDefault,IIf(Flip(Buy_ATR_Sys,Sell_ATR_Sys)==1,colorGreen,colorRed)); //AddColumn(IIf(Flip(Buy_ATR_Sys,Sell_ATR_Sys)==1,Buy_ATR,Sell_ATR),"Day_ATR",1.0,colorDefault,IIf(Flip(Buy_ATR_Sys,Sell_ATR_Sys)==1,colorGreen,colorRed)); //AddColumn(Flip(Buy_debdulal,Sell_debdulal),"DB",1.0,colorDefault,IIf(Flip(Buy_debdulal,Sell_debdulal)==1,colorGreen,colorRed)); //AddColumn(IIf(Flip(Buy_debdulal,Sell_debdulal)==1,Buy_DB,Sell_DB),"Day_DB",1.0,colorDefault,IIf(Flip(Buy_debdulal,Sell_debdulal)==1,colorGreen,colorRed)); //Close_Diff = C-Ref(C,-1); //Close_Diff_Percent = (C-Ref(C,-1))*100/Ref(C,-1); //AddColumn(O, "O", 1.0); //AddColumn(H, "H", 1.0); //AddColumn(L, "L", 1.0); //AddColumn(C, "C", 1.0); //AddColumn(V, "V", 1.0); //AddColumn(Close_Diff,"ClsD",1.0,IIf(Close_Diff_Percent<0,colorRed,IIf(Close_Diff_Percent>0,colorGreen,colorDefault)),colorDefault); //AddColumn(Close_Diff_Percent,"PctCls",1.2,IIf(Close_Diff_Percent<0,colorRed,IIf(Close_Diff_Percent>0,colorGreen,colorDefault)),colorDefault); _SECTION_END();