Stock Portfolio Organizer
The ultimate porfolio management solution.
WiseTrader Toolbox
#1 Selling Amibroker Plugin featuring:
Yancedolly Bands V.5. for Amibroker (AFL)
Yancedolly Bands Rule’s
1. Choose Best50 profit stock in last 2 years from index (refresh every week/2 weeks). Use individual backtest from first graph in this screen shot.
2. Use second graph for the trend. http://www.wisestocktrader.com/indicators/1505-sharone-system
3. Rule Buy/Sell Stock
- If Trend is Up
Buy —> Price in purple or red area buy 1 coin. Price in green area buy 2 coin.
Sell —> Price in darkgrey or upper area, sell all.
- If Trend is Down
Buy —> Price in low_purple or low_red area buy 1 coin. Price in low_darkgrey or below are buy 2 coin.
Sell —> Price in green or upper area, sell all.
4. Rule for money management, see the index.
- If Trend is Up
Full Power —> Price in green area.
Half Power —> Price in darkgrey.
- If Trend is Down
Full Power —> Price in low_darkgrey or below.
Half Power —> Price in green or upper area.
5. Use explore on first graph to make “point 3” easier.
6. Dont buy only one stock. Buy as many as you can in “point 1”.
Have a nice day.
Screenshots
Similar Indicators / Formulas
Indicator / Formula
//Formula for first graph. //------------------------ _SECTION_BEGIN("Background Color"); BKswitch = ParamToggle("Background Color","On,Off"); OUTcolor =colorBlack;// ParamColor("Outer Panel Color",colorBlack); INUPcolor =colorBlack;// ParamColor("Inner Panel Upper",colorBlack); INDNcolor =colorBlack;// ParamColor("Inner Panel Lower",colorBlack); TitleColor =colorBlack;// 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("Parameter Color"); Line1=17;//ParamColor("Line Yancedolly Bands Medium Cycle Color",17); Line2=6;//ParamColor("Line Yancedolly Bands Short Cycle Color",6); Line3=9;//ParamColor("Line Floor Top Color",9); Peak_valley_color=ColorRGB(0,0,23);//ParamColor("Peak_valley_color",colorPaleBlue); Vol1=colorDarkGreen;//ParamColor("Vol Up Color",colorDarkGreen); Vol2=colorDarkRed;//ParamColor("Vol Down Color",colorDarkRed); Vol3=colorDarkGrey;//ParamColor("Vol Avarage Color",23); price1=colorRose;//ParamColor("Price Color",colorRose); price2=colorBrightGreen;//ParamColor("Price Down Color",colorBrightGreen); price3=colorRed;//ParamColor("Price Up Color",colorRed); _SECTION_END(); _SECTION_BEGIN("Peak & Valley"); // E.M.Pottasch 09/06/10 //nbar =Param("nbar",3,1,5,1); nbar =2;// 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_peak=H>PHighPrice0; Sell_peak=L<PLowPrice0; Buy_peak=ExRem(Buy_peak,Sell_peak); Sell_peak=ExRem(Sell_peak,Buy_peak); //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); _SECTION_END(); _SECTION_BEGIN("SHR"); 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 ); if (NOT ParamToggle("SHR_PEAK Line ","On,Off")) { if (NOT ParamToggle("SHR_PEAK Type ","On,Off")) { Plot(Hh,"",colorOrange,styleDashed=32); Plot(Ll,"",colorBrightGreen,styleDashed=32); //Peak_valley_color=ColorRGB(0,0,23); //Plot( Flip( Buy_shr2 , Sell_shr2 ), "", Peak_valley_color, styleArea | styleOwnScale, 0, 1 ); } else { Plot(PHighPrice0,"",colorOrange,styleDashed=32); Plot(PLowPrice0 ,"",colorBrightGreen,styleDashed=32); //Peak_valley_color=ColorRGB(0,0,23); //Plot( Flip( Buy_peak, Sell_peak ), "", Peak_valley_color, styleArea | styleOwnScale, 0, 1 ); } } /* if (NOT ParamToggle("SHR_PEAK Color ","On,Off")) { if (NOT ParamToggle("SHR_PEAK Color Type ","On,Off")) { Peak_valley_color=ColorRGB(0,0,23); Plot( Flip( Buy_shr2 , Sell_shr2 ), "", Peak_valley_color, styleArea | styleOwnScale, 0, 1 ); } else { Peak_valley_color=ColorRGB(0,0,23); Plot( Flip( Buy_peak, Sell_peak ), "", Peak_valley_color, styleArea | styleOwnScale, 0, 1 ); } }*/ _SECTION_END(); _SECTION_BEGIN("Volume"); /* 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); if (ParamToggle("Volume Switch","On,Off")) { Plot( Volume, _DEFAULT_NAME(), IIf( VType==green OR VType==blue, Vol1, Vol2), styleNoTitle | ParamStyle( "Style", styleHistogram | styleOwnScale | styleThick | styleNoLabel, maskHistogram ), 2 ); Plot(MA(Volume,5/*Param("MA Periods",5,5,50,1)*/),"",Vol3,styleLine |styleOwnScale ,5/*Param("Scale",5,1,20,1)*/); } _SECTION_END(); _SECTION_BEGIN("Price"); K1=5;// Param("EMA Periods?",5,3,50); K2=10;// Param("ATR Periods?",10,2,50); Mul=1;//Param("ATR Multiplier?",1,0.5,5,0.5); Mi=EMA(C, K1); Kel= ATR(K2)*Mul; UB= Mi + Kel; LB= Mi - Kel; GraphXSpace = 5; SetChartOptions( 0, chartShowDates | chartShowArrows | chartLogarithmic | chartWrapTitle ); _N( Title = StrFormat( "{{NAME}} - " + SectorID( 1 ) + " - {{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 ) ) ) ); Plot(C,"", IIf(L<=LB,price2,IIf(H>=UB,price3,price1)),styleCandle); _SECTION_END(); _SECTION_BEGIN("Automatic Fibonacci"); // Get values for fib levels StartBar=SelectedValue(BarIndex()); FinishBar = EndValue( BarIndex() ); i = startbar; period = FinishBar - StartBar; Lo =LLV(L,period); Hi = HHV(H,period); Line0 = 0; Line1 = 0; Line2 = 0; Line3 = 0; Line4= 0; Line5= 0; Line6= 0; Line7= 0; Line100 = 0; for( i = startbar; i < finishbar; i++ ) { if(EndValue(C)<SelectedValue(C)) { Line0 = EndValue(Lo); Line100 = EndValue(Hi); Line1 = Line0 + abs(Line100-Line0)*0.236; Line2 = Line0 + abs(Line100-Line0)*0.382; Line3 = Line0 + abs(Line100-Line0)*0.5; Line4 = Line0 + abs(Line100-Line0)*0.618; Line5 = Line0 + abs(Line100-Line0)*0.786; Line6 = Line0 + abs(Line100-Line0)*1.618; Line7 = Line0 + abs(Line100-Line0)*2.618; } else { Line100 = EndValue(Lo); Line0 = EndValue(Hi); Line1 =Line0 - abs(Line100-Line0)*0.236; Line2 = Line0 - abs(Line100-Line0)*0.382; Line3 = Line0 - abs(Line100-Line0)*0.5; Line4 = Line0 - abs(Line100-Line0)*0.618; Line5 = Line0 - abs(Line100-Line0)*0.786; Line6 = Line0 - abs(Line100-Line0)*1.618; Line7 = Line0 - abs(Line100-Line0)*2.618; } } // external fib lines begining fom selecetdbarindex() fib0= LineArray(startbar, Line0, finishbar, Line0, 0, 1); fib100 = LineArray(startbar, Line100, finishbar, Line100, 0, 1); // depth of middle lines n= round((finishbar-startbar)/2); // middle lines fib1= LineArray((finishbar-n), Line1, finishbar, Line1, 0, 1); fib2= LineArray((finishbar-n), Line2, finishbar, Line2, 0, 1); fib3= LineArray((finishbar-n), Line3, finishbar, Line3, 0, 1); fib4= LineArray((finishbar-n), Line4, finishbar, Line4, 0, 1); fib5= LineArray((finishbar-n), Line5, finishbar, Line5, 0, 1); fib6= LineArray((finishbar-n), Line6, finishbar, Line6, 0, 1); fib7= LineArray((finishbar-n), Line7, finishbar, Line7, 0, 1); if (ParamToggle("Automatic Fibonacci","On,Off")) { Plot(fib0,"", colorWhite); Plot(fib100,"", colorRed); Plot(fib1,"", colorGrey50); Plot(fib2,"", colorGrey50); Plot(fib3,"", colorOrange); Plot(fib4,"", colorGrey50); Plot(fib5,"", colorGrey50); } if (ParamToggle("Fib6","On,Off")) { Plot(fib6,"", colorDarkTeal); } if (ParamToggle("Fib7","On,Off")) { Plot(fib7,"", colorViolet); } //Title = Name() + " - FIB LEVELS "; _SECTION_END(); _SECTION_BEGIN("Yancedolly Bands"); CY2 =80/2;// Param("Medium Cycle Length?" ,80, 1 ,1000 ,1 )/2; M2 = 1;// Param("Medium Cycle Multiplyer?" ,3, 0.01 ,10 ,1 ); UpY=EMA(C, CY2)+M2*ATR(CY2); MdY=EMA(C, CY2); DnY=EMA(C, CY2)-M2*ATR(CY2); 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)); if (ParamToggle("Yancedolly Band Line ","On,Off")) { Plot(UpperBand4,"UpperBand4",colorDarkTeal,1); Plot(UpperBand3,"UpperBand3",colorDarkGrey,1); Plot(UpperBand2,"UpperBand2",colorDarkRed,1); Plot(UpperBand1,"UpperBand1",colorViolet,1); Plot(MidPoint,"MidPoint",colorDarkGreen,4); Plot(LowerBand1,"LowerBand1",colorViolet,1); Plot(LowerBand2,"LowerBand2",colorDarkRed,1); Plot(LowerBand3,"LowerBand3",colorDarkGrey,1); Plot(LowerBand4,"LowerBand4",colorDarkTeal,1); } else { Plot(UpperBand4,"",colorDarkTeal,1); Plot(UpperBand3,"",colorDarkGrey,1); Plot(UpperBand2,"",colorDarkRed,1); Plot(UpperBand1,"",colorViolet,1); Plot(MidPoint,"",colorDarkGreen,4); Plot(LowerBand1,"",colorViolet,1); Plot(LowerBand2,"",colorDarkRed,1); Plot(LowerBand3,"",colorDarkGrey,1); Plot(LowerBand4,"",colorDarkTeal,1); } //============================================== //Type 22 --> Peak --> Modified 20140109 //============================================== 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=L<PLowPrice0; Buy_peak=ExRem(Buy_peak,Sell_peak); Sell_peak=ExRem(Sell_peak,Buy_peak); Buy_shr2=Buy_peak; Sell_shr2=Sell_peak; BuyDT= //(Buy_Fractal AND C<LowerBand1 AND C>LowerBand2 AND IIf(Flip( Buy_shr2, Sell_shr2),1,0)==0) OR Buy_shr2 // OR (C<LowerBand2 AND IIf(Upper_x,1,0)==0 AND IIf(Flip( Buy_LowerBand2, Sell_LowerBand2),1,0)==0); OR (Buy_Fractal3 AND IIf(Flip( Buy_shr2, Sell_shr2),1,0)==1) //OR (Buy_Fractal3 AND C<UpperBand3 AND IIf(Flip( Buy_shr2, Sell_shr2),1,0)==1) OR (Buy_Fractal2 AND C<LowerBand1 AND IIf(Flip( Buy_shr2, Sell_shr2),1,0)==0) OR (Buy_Fractal AND IsEmpty(LowerBand2)==1 );//OR (Buy_fractal AND IIf(Flip( Buy_shr2, Sell_shr2),1,0)==1); SellDT=(Sell_Fractal2 AND C<Lowerband2 AND IIf(Flip( Buy_shr2, Sell_shr2),1,0)==0) OR (Sell_Fractal2 AND C>midpoint 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 C<UpperBand2 AND IIf(Flip( Buy_shr2, Sell_shr2),1,0)==1) OR (Sell_Fractal2 AND C>UpperBand3); //============================================== // END //============================================== BuyDT=ExRem(BuyDT,SellDT);SellDT=ExRem(SellDT,BuyDT); //PlotShapes( BuyDT* shapeHollowUpTriangle, colorDarkRed,0, L, -18); //PlotShapes( SellDT* shapeHollowDownTriangle, colorDarkRed,0, H, -18); Buy=BuyDT; Sell=SellDT; Buy=ExRem(Buy,Sell);Sell=ExRem(Sell,Buy); //============================================== //Type 32 --> Peak --> Modified 20140109 //============================================== 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=L<PLowPrice0; Buy_peak=ExRem(Buy_peak,Sell_peak); Sell_peak=ExRem(Sell_peak,Buy_peak); Buy_shr2=Buy_peak; Sell_shr2=Sell_peak; Buy_fract1= //(Buy_Fractal AND C<LowerBand1 AND C>LowerBand2 AND IIf(Flip( Buy_shr2, Sell_shr2),1,0)==0) OR Buy_shr2 // OR (C<LowerBand2 AND IIf(Upper_x,1,0)==0 AND IIf(Flip( Buy_LowerBand2, Sell_LowerBand2),1,0)==0); OR (Buy_Fractal3 AND IIf(Flip( Buy_shr2, Sell_shr2),1,0)==1) //OR (Buy_Fractal3 AND C<UpperBand3 AND IIf(Flip( Buy_shr2, Sell_shr2),1,0)==1) OR (Buy_Fractal2 AND C<LowerBand1 AND IIf(Flip( Buy_shr2, Sell_shr2),1,0)==0) OR (Buy_Fractal AND IsEmpty(LowerBand2)==1 );//OR (Buy_fractal AND IIf(Flip( Buy_shr2, Sell_shr2),1,0)==1); Sell_fract1=(Sell_Fractal2 AND C<Lowerband2 AND IIf(Flip( Buy_shr2, Sell_shr2),1,0)==0) OR (Sell_Fractal2 AND 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 C<UpperBand2 AND IIf(Flip( Buy_shr2, Sell_shr2),1,0)==1) OR (Sell_Fractal2 AND C>UpperBand3); //============================================== // END //============================================== Buy_fract1=ExRem(Buy_fract1,Sell_fract1);Sell_fract1=ExRem(Sell_fract1,Buy_fract1); //============================================== //Type 22SC --> Peak --> Modified 20140315 //============================================== 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) ; //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_Fractal4 = IIf(Down ,1,0); Sell_Fractal4 = 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=L<PLowPrice0; Buy_peak=ExRem(Buy_peak,Sell_peak); Sell_peak=ExRem(Sell_peak,Buy_peak); Buy_shr2=Buy_peak; Sell_shr2=Sell_peak; BuySC= //(Buy_Fractal AND C<LowerBand1 AND C>LowerBand2 AND IIf(Flip( Buy_shr2, Sell_shr2),1,0)==0) OR Buy_shr2 // OR (C<LowerBand2 AND IIf(Upper_x,1,0)==0 AND IIf(Flip( Buy_LowerBand2, Sell_LowerBand2),1,0)==0); OR (C<UpperBand1 AND IIf(Flip( Buy_shr2, Sell_shr2),1,0)==1) //OR (Buy_Fractal3 AND IIf(Flip( Buy_shr2, Sell_shr2),1,0)==1) OR (Buy_Fractal2 AND C<LowerBand1 AND IIf(Flip( Buy_shr2, Sell_shr2),1,0)==0) OR (Buy_Fractal AND IsEmpty(LowerBand2)==1 );//OR (Buy_fractal AND IIf(Flip( Buy_shr2, Sell_shr2),1,0)==1); SellSC=(Sell_Fractal2 AND C<Lowerband2 AND IIf(Flip( Buy_shr2, Sell_shr2),1,0)==0) OR (Sell_Fractal2 AND C>midpoint 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 C<UpperBand2 AND IIf(Flip( Buy_shr2, Sell_shr2),1,0)==1) OR (Sell_Fractal2 AND C>UpperBand3); BuySC=(Buy_Fractal4 AND IIf(Flip( Buy_shr2, Sell_shr2),1,0)==1); SellSC=(Sell_Fractal2 AND C>UpperBand3); //============================================== // END //============================================== //BuySC=ExRem(BuySC,SellSC);SellSC=ExRem(SellSC,BuySC); if (NOT ParamToggle("Smooth CCI Switch","On,Off")) { PlotShapes( BuyDT* shapeHollowUpTriangle, 11,0, L, -18); PlotShapes( SellDT* shapeHollowDownTriangle, 11,0, H, -18); //PlotShapes( Buy_fract1 * shapeHollowSmallCircle, colorBlue,0, L, -5); //PlotShapes( Sell_fract1 * shapeHollowSmallCircle, colorBlue,0, H, 5); //PlotShapes( BuySC * shapeHollowSmallCircle, colorYellow,0, L, -10); //PlotShapes( SellSC * shapeHollowSmallCircle, colorYellow,0, H, 10); } //PlotShapes( Buy_peak * shapeHollowUpTriangle, colorDarkYellow,0, L, -22); //PlotShapes( Sell_peak * shapeHollowDownTriangle, colorDarkYellow,0, H, -22); _SECTION_END(); _SECTION_BEGIN("Peak & Valley"); // E.M.Pottasch 09/06/10 //nbar =Param("nbar",3,1,5,1); nbar =2;// 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_peak=H>PHighPrice0; Sell_peak=L<PLowPrice0; Buy_peak=ExRem(Buy_peak,Sell_peak); Sell_peak=ExRem(Sell_peak,Buy_peak); //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); _SECTION_END(); _SECTION_BEGIN("SHR"); 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 ); /*if (NOT ParamToggle("SHR_PEAK Line ","On,Off")) { if (NOT ParamToggle("SHR_PEAK Type ","On,Off")) { Plot(Hh,"PHighPrice",colorOrange,styleDashed=32); Plot(Ll,"PLowPrice",colorBrightGreen,styleDashed=32); //Peak_valley_color=ColorRGB(0,0,23); //Plot( Flip( Buy_shr2 , Sell_shr2 ), "", Peak_valley_color, styleArea | styleOwnScale, 0, 1 ); } else { Plot(PHighPrice0,"PHighPrice",colorOrange,styleDashed=32); Plot(PLowPrice0 ,"PLowPrice",colorBrightGreen,styleDashed=32); //Peak_valley_color=ColorRGB(0,0,23); //Plot( Flip( Buy_peak, Sell_peak ), "", Peak_valley_color, styleArea | styleOwnScale, 0, 1 ); } } */ if (NOT ParamToggle("SHR_PEAK Color ","On,Off")) { if (NOT ParamToggle("SHR_PEAK Color Type ","On,Off")) { Peak_valley_color=ColorRGB(0,0,23); Plot( Flip( Buy_shr2 , Sell_shr2 ), "", Peak_valley_color, styleArea | styleOwnScale, 0, 1 ); } else { Peak_valley_color=ColorRGB(0,0,23); Plot( Flip( Buy_peak, Sell_peak ), "", Peak_valley_color, styleArea | styleOwnScale, 0, 1 ); } } _SECTION_END(); _SECTION_BEGIN("Yancedolly Explorer"); 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); //===================================================================================== // Type 22 Begin //===================================================================================== Buy_Peak_Valey=BuyDT; Sell_Peak_Valey=SellDT; Buy_Peak_Valey=ExRem(Buy_Peak_Valey,Sell_Peak_Valey); Sell_Peak_Valey=ExRem(Sell_Peak_Valey,Buy_Peak_Valey); 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)))))))))))))))))))))))))))))); //===================================================================================== // Type 22 End //===================================================================================== //===================================================================================== // Type 22SC Begin //===================================================================================== Buy_Scold_Field=BuySC; Sell_Scold_Field=SellSC; Buy_Scold_Field=ExRem(Buy_Scold_Field,Sell_Scold_Field); Sell_Scold_Field=ExRem(Sell_Scold_Field,Buy_Scold_Field); Buy_SC_1= Ref(Flip(Buy_Scold_Field,Sell_Scold_Field),0)==1; Buy_SC_2= Buy_SC_1 AND Ref(Flip(Buy_Scold_Field,Sell_Scold_Field),-1)==1; Buy_SC_3= Buy_SC_2 AND Ref(Flip(Buy_Scold_Field,Sell_Scold_Field),-2)==1; Buy_SC_4= Buy_SC_3 AND Ref(Flip(Buy_Scold_Field,Sell_Scold_Field),-3)==1; Buy_SC_5= Buy_SC_4 AND Ref(Flip(Buy_Scold_Field,Sell_Scold_Field),-4)==1; Buy_SC_6= Buy_SC_5 AND Ref(Flip(Buy_Scold_Field,Sell_Scold_Field),-5)==1; Buy_SC_7= Buy_SC_6 AND Ref(Flip(Buy_Scold_Field,Sell_Scold_Field),-6)==1; Buy_SC_8= Buy_SC_7 AND Ref(Flip(Buy_Scold_Field,Sell_Scold_Field),-7)==1; Buy_SC_9= Buy_SC_8 AND Ref(Flip(Buy_Scold_Field,Sell_Scold_Field),-8)==1; Buy_SC_10= Buy_SC_9 AND Ref(Flip(Buy_Scold_Field,Sell_Scold_Field),-9)==1; Buy_SC_11= Buy_SC_10 AND Ref(Flip(Buy_Scold_Field,Sell_Scold_Field),-10)==1; Buy_SC_12= Buy_SC_11 AND Ref(Flip(Buy_Scold_Field,Sell_Scold_Field),-11)==1; Buy_SC_13= Buy_SC_12 AND Ref(Flip(Buy_Scold_Field,Sell_Scold_Field),-12)==1; Buy_SC_14= Buy_SC_13 AND Ref(Flip(Buy_Scold_Field,Sell_Scold_Field),-13)==1; Buy_SC_15= Buy_SC_14 AND Ref(Flip(Buy_Scold_Field,Sell_Scold_Field),-14)==1; Buy_SC_16= Buy_SC_15 AND Ref(Flip(Buy_Scold_Field,Sell_Scold_Field),-15)==1; Buy_SC_17= Buy_SC_16 AND Ref(Flip(Buy_Scold_Field,Sell_Scold_Field),-16)==1; Buy_SC_18= Buy_SC_17 AND Ref(Flip(Buy_Scold_Field,Sell_Scold_Field),-17)==1; Buy_SC_19= Buy_SC_18 AND Ref(Flip(Buy_Scold_Field,Sell_Scold_Field),-18)==1; Buy_SC_20= Buy_SC_19 AND Ref(Flip(Buy_Scold_Field,Sell_Scold_Field),-19)==1; Buy_SC_21= Buy_SC_20 AND Ref(Flip(Buy_Scold_Field,Sell_Scold_Field),-20)==1; Buy_SC_22= Buy_SC_21 AND Ref(Flip(Buy_Scold_Field,Sell_Scold_Field),-21)==1; Buy_SC_23= Buy_SC_22 AND Ref(Flip(Buy_Scold_Field,Sell_Scold_Field),-22)==1; Buy_SC_24= Buy_SC_23 AND Ref(Flip(Buy_Scold_Field,Sell_Scold_Field),-23)==1; Buy_SC_25= Buy_SC_24 AND Ref(Flip(Buy_Scold_Field,Sell_Scold_Field),-24)==1; Buy_SC_26= Buy_SC_25 AND Ref(Flip(Buy_Scold_Field,Sell_Scold_Field),-25)==1; Buy_SC_27= Buy_SC_26 AND Ref(Flip(Buy_Scold_Field,Sell_Scold_Field),-26)==1; Buy_SC_28= Buy_SC_27 AND Ref(Flip(Buy_Scold_Field,Sell_Scold_Field),-27)==1; Buy_SC_29= Buy_SC_28 AND Ref(Flip(Buy_Scold_Field,Sell_Scold_Field),-28)==1; Buy_SC_30= Buy_SC_29 AND Ref(Flip(Buy_Scold_Field,Sell_Scold_Field),-29)==1; Sell_SC_1= Ref(Flip(Buy_Scold_Field,Sell_Scold_Field),0)==0; Sell_SC_2= Sell_SC_1 AND Ref(Flip(Buy_Scold_Field,Sell_Scold_Field),-1)==0; Sell_SC_3= Sell_SC_2 AND Ref(Flip(Buy_Scold_Field,Sell_Scold_Field),-2)==0; Sell_SC_4= Sell_SC_3 AND Ref(Flip(Buy_Scold_Field,Sell_Scold_Field),-3)==0; Sell_SC_5= Sell_SC_4 AND Ref(Flip(Buy_Scold_Field,Sell_Scold_Field),-4)==0; Sell_SC_6= Sell_SC_5 AND Ref(Flip(Buy_Scold_Field,Sell_Scold_Field),-5)==0; Sell_SC_7= Sell_SC_6 AND Ref(Flip(Buy_Scold_Field,Sell_Scold_Field),-6)==0; Sell_SC_8= Sell_SC_7 AND Ref(Flip(Buy_Scold_Field,Sell_Scold_Field),-7)==0; Sell_SC_9= Sell_SC_8 AND Ref(Flip(Buy_Scold_Field,Sell_Scold_Field),-8)==0; Sell_SC_10= Sell_SC_9 AND Ref(Flip(Buy_Scold_Field,Sell_Scold_Field),-9)==0; Sell_SC_11= Sell_SC_10 AND Ref(Flip(Buy_Scold_Field,Sell_Scold_Field),-10)==0; Sell_SC_12= Sell_SC_11 AND Ref(Flip(Buy_Scold_Field,Sell_Scold_Field),-11)==0; Sell_SC_13= Sell_SC_12 AND Ref(Flip(Buy_Scold_Field,Sell_Scold_Field),-12)==0; Sell_SC_14= Sell_SC_13 AND Ref(Flip(Buy_Scold_Field,Sell_Scold_Field),-13)==0; Sell_SC_15= Sell_SC_14 AND Ref(Flip(Buy_Scold_Field,Sell_Scold_Field),-14)==0; Sell_SC_16= Sell_SC_15 AND Ref(Flip(Buy_Scold_Field,Sell_Scold_Field),-15)==0; Sell_SC_17= Sell_SC_16 AND Ref(Flip(Buy_Scold_Field,Sell_Scold_Field),-16)==0; Sell_SC_18= Sell_SC_17 AND Ref(Flip(Buy_Scold_Field,Sell_Scold_Field),-17)==0; Sell_SC_19= Sell_SC_18 AND Ref(Flip(Buy_Scold_Field,Sell_Scold_Field),-18)==0; Sell_SC_20= Sell_SC_19 AND Ref(Flip(Buy_Scold_Field,Sell_Scold_Field),-19)==0; Sell_SC_21= Sell_SC_20 AND Ref(Flip(Buy_Scold_Field,Sell_Scold_Field),-20)==0; Sell_SC_22= Sell_SC_21 AND Ref(Flip(Buy_Scold_Field,Sell_Scold_Field),-21)==0; Sell_SC_23= Sell_SC_22 AND Ref(Flip(Buy_Scold_Field,Sell_Scold_Field),-22)==0; Sell_SC_24= Sell_SC_23 AND Ref(Flip(Buy_Scold_Field,Sell_Scold_Field),-23)==0; Sell_SC_25= Sell_SC_24 AND Ref(Flip(Buy_Scold_Field,Sell_Scold_Field),-24)==0; Sell_SC_26= Sell_SC_25 AND Ref(Flip(Buy_Scold_Field,Sell_Scold_Field),-25)==0; Sell_SC_27= Sell_SC_26 AND Ref(Flip(Buy_Scold_Field,Sell_Scold_Field),-26)==0; Sell_SC_28= Sell_SC_27 AND Ref(Flip(Buy_Scold_Field,Sell_Scold_Field),-27)==0; Sell_SC_29= Sell_SC_28 AND Ref(Flip(Buy_Scold_Field,Sell_Scold_Field),-28)==0; Sell_SC_30= Sell_SC_29 AND Ref(Flip(Buy_Scold_Field,Sell_Scold_Field),-29)==0; Buy_SC= IIf(Buy_SC_30,30, IIf(Buy_SC_29,29, IIf(Buy_SC_28,28, IIf(Buy_SC_27,27, IIf(Buy_SC_26,26, IIf(Buy_SC_25,25, IIf(Buy_SC_24,24, IIf(Buy_SC_23,23, IIf(Buy_SC_22,22, IIf(Buy_SC_21,21, IIf(Buy_SC_20,20, IIf(Buy_SC_19,19, IIf(Buy_SC_18,18, IIf(Buy_SC_17,17, IIf(Buy_SC_16,16, IIf(Buy_SC_15,15, IIf(Buy_SC_14,14, IIf(Buy_SC_13,13, IIf(Buy_SC_12,12, IIf(Buy_SC_11,11, IIf(Buy_SC_10,10, IIf(Buy_SC_9,9, IIf(Buy_SC_8,8, IIf(Buy_SC_7,7, IIf(Buy_SC_6,6, IIf(Buy_SC_5,5, IIf(Buy_SC_4,4, IIf(Buy_SC_3,3, IIf(Buy_SC_2,2, IIf(Buy_SC_1,1,0)))))))))))))))))))))))))))))); Sell_SC= IIf(Sell_SC_30,30, IIf(Sell_SC_29,29, IIf(Sell_SC_28,28, IIf(Sell_SC_27,27, IIf(Sell_SC_26,26, IIf(Sell_SC_25,25, IIf(Sell_SC_24,24, IIf(Sell_SC_23,23, IIf(Sell_SC_22,22, IIf(Sell_SC_21,21, IIf(Sell_SC_20,20, IIf(Sell_SC_19,19, IIf(Sell_SC_18,18, IIf(Sell_SC_17,17, IIf(Sell_SC_16,16, IIf(Sell_SC_15,15, IIf(Sell_SC_14,14, IIf(Sell_SC_13,13, IIf(Sell_SC_12,12, IIf(Sell_SC_11,11, IIf(Sell_SC_10,10, IIf(Sell_SC_9,9, IIf(Sell_SC_8,8, IIf(Sell_SC_7,7, IIf(Sell_SC_6,6, IIf(Sell_SC_5,5, IIf(Sell_SC_4,4, IIf(Sell_SC_3,3, IIf(Sell_SC_2,2, IIf(Sell_SC_1,1,0)))))))))))))))))))))))))))))); //===================================================================================== // Type 22SC End //===================================================================================== //===================================================================================== // Type 32 Begin //===================================================================================== Buy_Sheroune = Buy_fract1; Sell_Sheroune = Sell_fract1; Buy_Sheroune=ExRem(Buy_Sheroune,Sell_Sheroune); Sell_Sheroune=ExRem(Sell_Sheroune,Buy_Sheroune); 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)))))))))))))))))))))))))))))); //===================================================================================== // Type 32 End //===================================================================================== //===================================================================================== // BUY PEAK VALEY Begin //===================================================================================== 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=L<PLowPrice0; Buy_peak=ExRem(Buy_peak,Sell_peak); Sell_peak=ExRem(Sell_peak,Buy_peak); Buy_LowerBand2 =Buy_peak; Sell_LowerBand2 =Sell_peak; Buy_LowerBand2 =ExRem(Buy_LowerBand2,Sell_LowerBand2); Sell_LowerBand2=ExRem(Sell_LowerBand2,Buy_LowerBand2); Buy_LB2_1= Ref(Flip(Buy_LowerBand2,Sell_LowerBand2),0)==1; Buy_LB2_2= Buy_LB2_1 AND Ref(Flip(Buy_LowerBand2,Sell_LowerBand2),-1)==1; Buy_LB2_3= Buy_LB2_2 AND Ref(Flip(Buy_LowerBand2,Sell_LowerBand2),-2)==1; Buy_LB2_4= Buy_LB2_3 AND Ref(Flip(Buy_LowerBand2,Sell_LowerBand2),-3)==1; Buy_LB2_5= Buy_LB2_4 AND Ref(Flip(Buy_LowerBand2,Sell_LowerBand2),-4)==1; Buy_LB2_6= Buy_LB2_5 AND Ref(Flip(Buy_LowerBand2,Sell_LowerBand2),-5)==1; Buy_LB2_7= Buy_LB2_6 AND Ref(Flip(Buy_LowerBand2,Sell_LowerBand2),-6)==1; Buy_LB2_8= Buy_LB2_7 AND Ref(Flip(Buy_LowerBand2,Sell_LowerBand2),-7)==1; Buy_LB2_9= Buy_LB2_8 AND Ref(Flip(Buy_LowerBand2,Sell_LowerBand2),-8)==1; Buy_LB2_10= Buy_LB2_9 AND Ref(Flip(Buy_LowerBand2,Sell_LowerBand2),-9)==1; Buy_LB2_11= Buy_LB2_10 AND Ref(Flip(Buy_LowerBand2,Sell_LowerBand2),-10)==1; Buy_LB2_12= Buy_LB2_11 AND Ref(Flip(Buy_LowerBand2,Sell_LowerBand2),-11)==1; Buy_LB2_13= Buy_LB2_12 AND Ref(Flip(Buy_LowerBand2,Sell_LowerBand2),-12)==1; Buy_LB2_14= Buy_LB2_13 AND Ref(Flip(Buy_LowerBand2,Sell_LowerBand2),-13)==1; Buy_LB2_15= Buy_LB2_14 AND Ref(Flip(Buy_LowerBand2,Sell_LowerBand2),-14)==1; Buy_LB2_16= Buy_LB2_15 AND Ref(Flip(Buy_LowerBand2,Sell_LowerBand2),-15)==1; Buy_LB2_17= Buy_LB2_16 AND Ref(Flip(Buy_LowerBand2,Sell_LowerBand2),-16)==1; Buy_LB2_18= Buy_LB2_17 AND Ref(Flip(Buy_LowerBand2,Sell_LowerBand2),-17)==1; Buy_LB2_19= Buy_LB2_18 AND Ref(Flip(Buy_LowerBand2,Sell_LowerBand2),-18)==1; Buy_LB2_20= Buy_LB2_19 AND Ref(Flip(Buy_LowerBand2,Sell_LowerBand2),-19)==1; Buy_LB2_21= Buy_LB2_20 AND Ref(Flip(Buy_LowerBand2,Sell_LowerBand2),-20)==1; Buy_LB2_22= Buy_LB2_21 AND Ref(Flip(Buy_LowerBand2,Sell_LowerBand2),-21)==1; Buy_LB2_23= Buy_LB2_22 AND Ref(Flip(Buy_LowerBand2,Sell_LowerBand2),-22)==1; Buy_LB2_24= Buy_LB2_23 AND Ref(Flip(Buy_LowerBand2,Sell_LowerBand2),-23)==1; Buy_LB2_25= Buy_LB2_24 AND Ref(Flip(Buy_LowerBand2,Sell_LowerBand2),-24)==1; Buy_LB2_26= Buy_LB2_25 AND Ref(Flip(Buy_LowerBand2,Sell_LowerBand2),-25)==1; Buy_LB2_27= Buy_LB2_26 AND Ref(Flip(Buy_LowerBand2,Sell_LowerBand2),-26)==1; Buy_LB2_28= Buy_LB2_27 AND Ref(Flip(Buy_LowerBand2,Sell_LowerBand2),-27)==1; Buy_LB2_29= Buy_LB2_28 AND Ref(Flip(Buy_LowerBand2,Sell_LowerBand2),-28)==1; Buy_LB2_30= Buy_LB2_29 AND Ref(Flip(Buy_LowerBand2,Sell_LowerBand2),-29)==1; Sell_LB2_1= Ref(Flip(Buy_LowerBand2,Sell_LowerBand2),0)==0; Sell_LB2_2= Sell_LB2_1 AND Ref(Flip(Buy_LowerBand2,Sell_LowerBand2),-1)==0; Sell_LB2_3= Sell_LB2_2 AND Ref(Flip(Buy_LowerBand2,Sell_LowerBand2),-2)==0; Sell_LB2_4= Sell_LB2_3 AND Ref(Flip(Buy_LowerBand2,Sell_LowerBand2),-3)==0; Sell_LB2_5= Sell_LB2_4 AND Ref(Flip(Buy_LowerBand2,Sell_LowerBand2),-4)==0; Sell_LB2_6= Sell_LB2_5 AND Ref(Flip(Buy_LowerBand2,Sell_LowerBand2),-5)==0; Sell_LB2_7= Sell_LB2_6 AND Ref(Flip(Buy_LowerBand2,Sell_LowerBand2),-6)==0; Sell_LB2_8= Sell_LB2_7 AND Ref(Flip(Buy_LowerBand2,Sell_LowerBand2),-7)==0; Sell_LB2_9= Sell_LB2_8 AND Ref(Flip(Buy_LowerBand2,Sell_LowerBand2),-8)==0; Sell_LB2_10= Sell_LB2_9 AND Ref(Flip(Buy_LowerBand2,Sell_LowerBand2),-9)==0; Sell_LB2_11= Sell_LB2_10 AND Ref(Flip(Buy_LowerBand2,Sell_LowerBand2),-10)==0; Sell_LB2_12= Sell_LB2_11 AND Ref(Flip(Buy_LowerBand2,Sell_LowerBand2),-11)==0; Sell_LB2_13= Sell_LB2_12 AND Ref(Flip(Buy_LowerBand2,Sell_LowerBand2),-12)==0; Sell_LB2_14= Sell_LB2_13 AND Ref(Flip(Buy_LowerBand2,Sell_LowerBand2),-13)==0; Sell_LB2_15= Sell_LB2_14 AND Ref(Flip(Buy_LowerBand2,Sell_LowerBand2),-14)==0; Sell_LB2_16= Sell_LB2_15 AND Ref(Flip(Buy_LowerBand2,Sell_LowerBand2),-15)==0; Sell_LB2_17= Sell_LB2_16 AND Ref(Flip(Buy_LowerBand2,Sell_LowerBand2),-16)==0; Sell_LB2_18= Sell_LB2_17 AND Ref(Flip(Buy_LowerBand2,Sell_LowerBand2),-17)==0; Sell_LB2_19= Sell_LB2_18 AND Ref(Flip(Buy_LowerBand2,Sell_LowerBand2),-18)==0; Sell_LB2_20= Sell_LB2_19 AND Ref(Flip(Buy_LowerBand2,Sell_LowerBand2),-19)==0; Sell_LB2_21= Sell_LB2_20 AND Ref(Flip(Buy_LowerBand2,Sell_LowerBand2),-20)==0; Sell_LB2_22= Sell_LB2_21 AND Ref(Flip(Buy_LowerBand2,Sell_LowerBand2),-21)==0; Sell_LB2_23= Sell_LB2_22 AND Ref(Flip(Buy_LowerBand2,Sell_LowerBand2),-22)==0; Sell_LB2_24= Sell_LB2_23 AND Ref(Flip(Buy_LowerBand2,Sell_LowerBand2),-23)==0; Sell_LB2_25= Sell_LB2_24 AND Ref(Flip(Buy_LowerBand2,Sell_LowerBand2),-24)==0; Sell_LB2_26= Sell_LB2_25 AND Ref(Flip(Buy_LowerBand2,Sell_LowerBand2),-25)==0; Sell_LB2_27= Sell_LB2_26 AND Ref(Flip(Buy_LowerBand2,Sell_LowerBand2),-26)==0; Sell_LB2_28= Sell_LB2_27 AND Ref(Flip(Buy_LowerBand2,Sell_LowerBand2),-27)==0; Sell_LB2_29= Sell_LB2_28 AND Ref(Flip(Buy_LowerBand2,Sell_LowerBand2),-28)==0; Sell_LB2_30= Sell_LB2_29 AND Ref(Flip(Buy_LowerBand2,Sell_LowerBand2),-29)==0; Buy_LB2= IIf(Buy_LB2_30,30, IIf(Buy_LB2_29,29, IIf(Buy_LB2_28,28, IIf(Buy_LB2_27,27, IIf(Buy_LB2_26,26, IIf(Buy_LB2_25,25, IIf(Buy_LB2_24,24, IIf(Buy_LB2_23,23, IIf(Buy_LB2_22,22, IIf(Buy_LB2_21,21, IIf(Buy_LB2_20,20, IIf(Buy_LB2_19,19, IIf(Buy_LB2_18,18, IIf(Buy_LB2_17,17, IIf(Buy_LB2_16,16, IIf(Buy_LB2_15,15, IIf(Buy_LB2_14,14, IIf(Buy_LB2_13,13, IIf(Buy_LB2_12,12, IIf(Buy_LB2_11,11, IIf(Buy_LB2_10,10, IIf(Buy_LB2_9,9, IIf(Buy_LB2_8,8, IIf(Buy_LB2_7,7, IIf(Buy_LB2_6,6, IIf(Buy_LB2_5,5, IIf(Buy_LB2_4,4, IIf(Buy_LB2_3,3, IIf(Buy_LB2_2,2, IIf(Buy_LB2_1,1,0)))))))))))))))))))))))))))))); Sell_LB2= IIf(Sell_LB2_30,30, IIf(Sell_LB2_29,29, IIf(Sell_LB2_28,28, IIf(Sell_LB2_27,27, IIf(Sell_LB2_26,26, IIf(Sell_LB2_25,25, IIf(Sell_LB2_24,24, IIf(Sell_LB2_23,23, IIf(Sell_LB2_22,22, IIf(Sell_LB2_21,21, IIf(Sell_LB2_20,20, IIf(Sell_LB2_19,19, IIf(Sell_LB2_18,18, IIf(Sell_LB2_17,17, IIf(Sell_LB2_16,16, IIf(Sell_LB2_15,15, IIf(Sell_LB2_14,14, IIf(Sell_LB2_13,13, IIf(Sell_LB2_12,12, IIf(Sell_LB2_11,11, IIf(Sell_LB2_10,10, IIf(Sell_LB2_9,9, IIf(Sell_LB2_8,8, IIf(Sell_LB2_7,7, IIf(Sell_LB2_6,6, IIf(Sell_LB2_5,5, IIf(Sell_LB2_4,4, IIf(Sell_LB2_3,3, IIf(Sell_LB2_2,2, IIf(Sell_LB2_1,1,0)))))))))))))))))))))))))))))); //===================================================================================== // BUY PEAK VALEY End //===================================================================================== //===================================================================================== // BUY SHR Begin //===================================================================================== 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 ); Buy_ATR_Sys=Buy_shr2; Sell_ATR_Sys=Sell_shr2; Buy_ATR_Sys=ExRem(Buy_ATR_Sys,Sell_ATR_Sys); Sell_ATR_Sys=ExRem(Sell_ATR_Sys,Buy_ATR_Sys); Buy_ATR_1= Ref(Flip(Buy_ATR_Sys,Sell_ATR_Sys),0)==1; Buy_ATR_2= Buy_ATR_1 AND Ref(Flip(Buy_ATR_Sys,Sell_ATR_Sys),-1)==1; Buy_ATR_3= Buy_ATR_2 AND Ref(Flip(Buy_ATR_Sys,Sell_ATR_Sys),-2)==1; Buy_ATR_4= Buy_ATR_3 AND Ref(Flip(Buy_ATR_Sys,Sell_ATR_Sys),-3)==1; Buy_ATR_5= Buy_ATR_4 AND Ref(Flip(Buy_ATR_Sys,Sell_ATR_Sys),-4)==1; Buy_ATR_6= Buy_ATR_5 AND Ref(Flip(Buy_ATR_Sys,Sell_ATR_Sys),-5)==1; Buy_ATR_7= Buy_ATR_6 AND Ref(Flip(Buy_ATR_Sys,Sell_ATR_Sys),-6)==1; Buy_ATR_8= Buy_ATR_7 AND Ref(Flip(Buy_ATR_Sys,Sell_ATR_Sys),-7)==1; Buy_ATR_9= Buy_ATR_8 AND Ref(Flip(Buy_ATR_Sys,Sell_ATR_Sys),-8)==1; Buy_ATR_10= Buy_ATR_9 AND Ref(Flip(Buy_ATR_Sys,Sell_ATR_Sys),-9)==1; Buy_ATR_11= Buy_ATR_10 AND Ref(Flip(Buy_ATR_Sys,Sell_ATR_Sys),-10)==1; Buy_ATR_12= Buy_ATR_11 AND Ref(Flip(Buy_ATR_Sys,Sell_ATR_Sys),-11)==1; Buy_ATR_13= Buy_ATR_12 AND Ref(Flip(Buy_ATR_Sys,Sell_ATR_Sys),-12)==1; Buy_ATR_14= Buy_ATR_13 AND Ref(Flip(Buy_ATR_Sys,Sell_ATR_Sys),-13)==1; Buy_ATR_15= Buy_ATR_14 AND Ref(Flip(Buy_ATR_Sys,Sell_ATR_Sys),-14)==1; Buy_ATR_16= Buy_ATR_15 AND Ref(Flip(Buy_ATR_Sys,Sell_ATR_Sys),-15)==1; Buy_ATR_17= Buy_ATR_16 AND Ref(Flip(Buy_ATR_Sys,Sell_ATR_Sys),-16)==1; Buy_ATR_18= Buy_ATR_17 AND Ref(Flip(Buy_ATR_Sys,Sell_ATR_Sys),-17)==1; Buy_ATR_19= Buy_ATR_18 AND Ref(Flip(Buy_ATR_Sys,Sell_ATR_Sys),-18)==1; Buy_ATR_20= Buy_ATR_19 AND Ref(Flip(Buy_ATR_Sys,Sell_ATR_Sys),-19)==1; Buy_ATR_21= Buy_ATR_20 AND Ref(Flip(Buy_ATR_Sys,Sell_ATR_Sys),-20)==1; Buy_ATR_22= Buy_ATR_21 AND Ref(Flip(Buy_ATR_Sys,Sell_ATR_Sys),-21)==1; Buy_ATR_23= Buy_ATR_22 AND Ref(Flip(Buy_ATR_Sys,Sell_ATR_Sys),-22)==1; Buy_ATR_24= Buy_ATR_23 AND Ref(Flip(Buy_ATR_Sys,Sell_ATR_Sys),-23)==1; Buy_ATR_25= Buy_ATR_24 AND Ref(Flip(Buy_ATR_Sys,Sell_ATR_Sys),-24)==1; Buy_ATR_26= Buy_ATR_25 AND Ref(Flip(Buy_ATR_Sys,Sell_ATR_Sys),-25)==1; Buy_ATR_27= Buy_ATR_26 AND Ref(Flip(Buy_ATR_Sys,Sell_ATR_Sys),-26)==1; Buy_ATR_28= Buy_ATR_27 AND Ref(Flip(Buy_ATR_Sys,Sell_ATR_Sys),-27)==1; Buy_ATR_29= Buy_ATR_28 AND Ref(Flip(Buy_ATR_Sys,Sell_ATR_Sys),-28)==1; Buy_ATR_30= Buy_ATR_29 AND Ref(Flip(Buy_ATR_Sys,Sell_ATR_Sys),-29)==1; Sell_ATR_1= Ref(Flip(Buy_ATR_Sys,Sell_ATR_Sys),0)==0; Sell_ATR_2= Sell_ATR_1 AND Ref(Flip(Buy_ATR_Sys,Sell_ATR_Sys),-1)==0; Sell_ATR_3= Sell_ATR_2 AND Ref(Flip(Buy_ATR_Sys,Sell_ATR_Sys),-2)==0; Sell_ATR_4= Sell_ATR_3 AND Ref(Flip(Buy_ATR_Sys,Sell_ATR_Sys),-3)==0; Sell_ATR_5= Sell_ATR_4 AND Ref(Flip(Buy_ATR_Sys,Sell_ATR_Sys),-4)==0; Sell_ATR_6= Sell_ATR_5 AND Ref(Flip(Buy_ATR_Sys,Sell_ATR_Sys),-5)==0; Sell_ATR_7= Sell_ATR_6 AND Ref(Flip(Buy_ATR_Sys,Sell_ATR_Sys),-6)==0; Sell_ATR_8= Sell_ATR_7 AND Ref(Flip(Buy_ATR_Sys,Sell_ATR_Sys),-7)==0; Sell_ATR_9= Sell_ATR_8 AND Ref(Flip(Buy_ATR_Sys,Sell_ATR_Sys),-8)==0; Sell_ATR_10= Sell_ATR_9 AND Ref(Flip(Buy_ATR_Sys,Sell_ATR_Sys),-9)==0; Sell_ATR_11= Sell_ATR_10 AND Ref(Flip(Buy_ATR_Sys,Sell_ATR_Sys),-10)==0; Sell_ATR_12= Sell_ATR_11 AND Ref(Flip(Buy_ATR_Sys,Sell_ATR_Sys),-11)==0; Sell_ATR_13= Sell_ATR_12 AND Ref(Flip(Buy_ATR_Sys,Sell_ATR_Sys),-12)==0; Sell_ATR_14= Sell_ATR_13 AND Ref(Flip(Buy_ATR_Sys,Sell_ATR_Sys),-13)==0; Sell_ATR_15= Sell_ATR_14 AND Ref(Flip(Buy_ATR_Sys,Sell_ATR_Sys),-14)==0; Sell_ATR_16= Sell_ATR_15 AND Ref(Flip(Buy_ATR_Sys,Sell_ATR_Sys),-15)==0; Sell_ATR_17= Sell_ATR_16 AND Ref(Flip(Buy_ATR_Sys,Sell_ATR_Sys),-16)==0; Sell_ATR_18= Sell_ATR_17 AND Ref(Flip(Buy_ATR_Sys,Sell_ATR_Sys),-17)==0; Sell_ATR_19= Sell_ATR_18 AND Ref(Flip(Buy_ATR_Sys,Sell_ATR_Sys),-18)==0; Sell_ATR_20= Sell_ATR_19 AND Ref(Flip(Buy_ATR_Sys,Sell_ATR_Sys),-19)==0; Sell_ATR_21= Sell_ATR_20 AND Ref(Flip(Buy_ATR_Sys,Sell_ATR_Sys),-20)==0; Sell_ATR_22= Sell_ATR_21 AND Ref(Flip(Buy_ATR_Sys,Sell_ATR_Sys),-21)==0; Sell_ATR_23= Sell_ATR_22 AND Ref(Flip(Buy_ATR_Sys,Sell_ATR_Sys),-22)==0; Sell_ATR_24= Sell_ATR_23 AND Ref(Flip(Buy_ATR_Sys,Sell_ATR_Sys),-23)==0; Sell_ATR_25= Sell_ATR_24 AND Ref(Flip(Buy_ATR_Sys,Sell_ATR_Sys),-24)==0; Sell_ATR_26= Sell_ATR_25 AND Ref(Flip(Buy_ATR_Sys,Sell_ATR_Sys),-25)==0; Sell_ATR_27= Sell_ATR_26 AND Ref(Flip(Buy_ATR_Sys,Sell_ATR_Sys),-26)==0; Sell_ATR_28= Sell_ATR_27 AND Ref(Flip(Buy_ATR_Sys,Sell_ATR_Sys),-27)==0; Sell_ATR_29= Sell_ATR_28 AND Ref(Flip(Buy_ATR_Sys,Sell_ATR_Sys),-28)==0; Sell_ATR_30= Sell_ATR_29 AND Ref(Flip(Buy_ATR_Sys,Sell_ATR_Sys),-29)==0; Buy_ATR= IIf(Buy_ATR_30,30, IIf(Buy_ATR_29,29, IIf(Buy_ATR_28,28, IIf(Buy_ATR_27,27, IIf(Buy_ATR_26,26, IIf(Buy_ATR_25,25, IIf(Buy_ATR_24,24, IIf(Buy_ATR_23,23, IIf(Buy_ATR_22,22, IIf(Buy_ATR_21,21, IIf(Buy_ATR_20,20, IIf(Buy_ATR_19,19, IIf(Buy_ATR_18,18, IIf(Buy_ATR_17,17, IIf(Buy_ATR_16,16, IIf(Buy_ATR_15,15, IIf(Buy_ATR_14,14, IIf(Buy_ATR_13,13, IIf(Buy_ATR_12,12, IIf(Buy_ATR_11,11, IIf(Buy_ATR_10,10, IIf(Buy_ATR_9,9, IIf(Buy_ATR_8,8, IIf(Buy_ATR_7,7, IIf(Buy_ATR_6,6, IIf(Buy_ATR_5,5, IIf(Buy_ATR_4,4, IIf(Buy_ATR_3,3, IIf(Buy_ATR_2,2, IIf(Buy_ATR_1,1,0)))))))))))))))))))))))))))))); Sell_ATR= IIf(Sell_ATR_30,30, IIf(Sell_ATR_29,29, IIf(Sell_ATR_28,28, IIf(Sell_ATR_27,27, IIf(Sell_ATR_26,26, IIf(Sell_ATR_25,25, IIf(Sell_ATR_24,24, IIf(Sell_ATR_23,23, IIf(Sell_ATR_22,22, IIf(Sell_ATR_21,21, IIf(Sell_ATR_20,20, IIf(Sell_ATR_19,19, IIf(Sell_ATR_18,18, IIf(Sell_ATR_17,17, IIf(Sell_ATR_16,16, IIf(Sell_ATR_15,15, IIf(Sell_ATR_14,14, IIf(Sell_ATR_13,13, IIf(Sell_ATR_12,12, IIf(Sell_ATR_11,11, IIf(Sell_ATR_10,10, IIf(Sell_ATR_9,9, IIf(Sell_ATR_8,8, IIf(Sell_ATR_7,7, IIf(Sell_ATR_6,6, IIf(Sell_ATR_5,5, IIf(Sell_ATR_4,4, IIf(Sell_ATR_3,3, IIf(Sell_ATR_2,2, IIf(Sell_ATR_1,1,0)))))))))))))))))))))))))))))); //===================================================================================== // BUY SHR End //===================================================================================== //====Explorer Begin==== Filter = 1!=0; Close_Diff = C-Ref(C,-1); Close_Diff_Percent = (C-Ref(C,-1))*100/Ref(C,-1); Satuan_terkecil=1000000; Jumlah_Lot = round((satuan_terkecil/(100*C))+0.5); Harga_Beli=C*Jumlah_Lot*100/1000; AddColumn(C, "Close", 1.0); AddColumn(Close_Diff_Percent," % ",1.2,IIf(Close_Diff_Percent<0,colorRed,IIf(Close_Diff_Percent>0,colorGreen,colorDefault)),colorDefault); AddColumn(Jumlah_Lot, " JL ", 1.2); AddColumn(Harga_Beli, " Hrg ", 1.2); AddColumn(IIf(LowerDolly_0,1,IIf(LowerDolly_1,2,IIf(LowerDolly_2,3,IIf(LowerDolly_3,4,IIf(LowerDolly_4,5,0))))),"L2",1.0,colorDefault,IIf(LowerDolly_0,colorDarkGreen,IIf(LowerDolly_1,colorViolet,IIf(LowerDolly_2,colorDarkRed,IIf(LowerDolly_3,colorDarkGrey,IIf(LowerDolly_4,colorDarkTeal,colorDefault)))))); AddColumn(IIf(UpperDolly_0,1,IIf(UpperDolly_1,2,IIf(UpperDolly_2,3,IIf(UpperDolly_3,4,IIf(UpperDolly_4,5,0))))),"U2",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(Flip(Buy_Peak_Valey,Sell_Peak_Valey),"22",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),"D22",1.0,colorDefault,IIf(Flip(Buy_Peak_Valey,Sell_Peak_Valey)==1,colorGreen,colorRed)); AddColumn(Flip(Buy_Sheroune,Sell_Sheroune),"30",1.0,colorDefault,IIf(Flip(Buy_Sheroune,Sell_Sheroune)==1,colorGreen,colorRed)); AddColumn(IIf(Flip(Buy_Sheroune,Sell_Sheroune)==1,Buy_SHR,Sell_SHR),"D30",1.0,colorDefault,IIf(Flip(Buy_Sheroune,Sell_Sheroune)==1,colorGreen,colorRed)); AddColumn(Flip(Buy_Scold_Field,Sell_Scold_Field),"SC",1.0,colorDefault,IIf(Flip(Buy_Scold_Field,Sell_Scold_Field)==1,colorGreen,colorRed)); AddColumn(IIf(Flip(Buy_Scold_Field,Sell_Scold_Field)==1,Buy_SC,Sell_SC),"DSC",1.0,colorDefault,IIf(Flip(Buy_Scold_Field,Sell_Scold_Field)==1,colorGreen,colorRed)); AddColumn(Flip(Buy_LowerBand2,Sell_LowerBand2),"PK",1.0,colorDefault,IIf(Flip(Buy_LowerBand2,Sell_LowerBand2)==1,colorGreen,colorRed)); AddColumn(IIf(Flip(Buy_LowerBand2,Sell_LowerBand2)==1,Buy_LB2,Sell_LB2),"DPK",1.0,colorDefault,IIf(Flip(Buy_LowerBand2,Sell_LowerBand2)==1,colorGreen,colorRed)); AddColumn(Flip(Buy_ATR_Sys,Sell_ATR_Sys),"SR",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),"DSR",1.0,colorDefault,IIf(Flip(Buy_ATR_Sys,Sell_ATR_Sys)==1,colorGreen,colorRed)); //====Explorer End==== _SECTION_END();
13 comments
Leave Comment
Please login here to leave a comment.
Back
error
I use version 5.30. It works.
it does not work at amibroker v5.50 rc1
hi, i can use for index? or only for stocks? and “what Best50 profit stock in last 2 years from index” you mean?
regards
Wonderful job! I followed your work since V.3.
However, error message at my amibroker V5.70.2 64bit.
Error message are Ln: 101, Col: 36: Error 55. Invalid assignment. The identifier is read-only (constant) and can not be written to.
Same for Ln: 102. Hopefully this helps.
Again, thank you for the great work! Can’t wait to see it works!
rhlai228… you can remark ln 101, 102.
hi, i can use for index? or only for stocks?
> Use index indicator for money management.
and “what Best50 profit stock in last 2 years from index” you mean?
> For example: I play kompas100 index (find google). BackTest (individual backtest) all stocks in kompas100 with first graph in last 2 years. Sort on profit column. Pick Best50 profit stocks. Refresh every week or 2 weeks. Make a Group on that stocks in watchlist. Buy/Sell only in Best50 Stocks. Use kompas100 index for money management.
regards
Hi yancedolly:
Sorry that I am new to amibroker and AFL coding. What do you mean “remark” ln 101, 102? Thank you.
rhlai228
add “//” in front of that lines.
//Plot(Hh,"",colorOrange,styleDashed=32); —> Line 101
//Plot(Ll,"",colorBrightGreen,styleDashed=32); —> Line 102
//Plot(PHighPrice0,"",colorOrange,styleDashed=32); —> Line 108
//Plot(PLowPrice0 ,"",colorBrightGreen,styleDashed=32); —> Line 109
Thank you for the instruction, and now it works great!
Need to do more backtest on the strategy, but I think u got great logic here!
Regards,
rhlai228
Seems this indicator is looking into future. Signals are getting changed.
giribabu06..
Yes thats right. But the signals will not change after 2 days. Use the signals just for “Point 1”.
Regards.
this is fake auto trading system . one day we have buy signal and next day the signal is gone.