Stock Portfolio Organizer
The ultimate porfolio management solution.
WiseTrader Toolbox
#1 Selling Amibroker Plugin featuring:
BB & KB Squeeze & TGL CROSS NEW for Amibroker (AFL)
Using BBSqueeze in trading.
You can buy/sell at the first/second signal, as you consider.
Screenshots
Indicator / Formula
// BB & KB AREA COLOR SQUEEZE _SECTION_BEGIN("Bollinger Bands"); //P = ParamField("Price field",-1); PeriodsBB = Param("PeriodsBB", 15, 2, 300, 1 ); WidthBB = Param("WidthBB", 2, 0, 10, 0.05 ); //Color = ParamColor("Color", colorCycle ); //Style = ParamStyle("Style"); //Plot( BBandTop( P, Periods, Width ), "BBTop" + _PARAM_VALUES(), Color, Style ); //Plot( BBandBot( P, Periods, Width ), "BBBot" + _PARAM_VALUES(), Color, Style ); Plot( BBandTop( C, PeriodsBB, WidthBB ), "\nBBTop" + _PARAM_VALUES(), colorBlue , styleLine+styleThick ); Plot( BBandBot( C, PeriodsBB, WidthBB ), "\nBBBot" + _PARAM_VALUES(), colorBlue , styleLine+styleThick ); _SECTION_END(); _SECTION_BEGIN("Keltner Bands"); //P = ParamField("Price field",-1); PeriodsKB = Param("PeriodsKB", 15, 2, 300, 1 ); WidthKB = Param("WidthKB", 2, 0, 10, 0.05 ); //Color = ParamColor("Color", colorCycle ); //Style = ParamStyle("Style", styleLine | styleNoLabel); CenterLine = MA( C, PeriodsBB ); // OBSERVATIE: CenterLine= BBMid= KMid ; KTop = CenterLine + WidthKB * ATR( PeriodsKB ); KBot = CenterLine - WidthKB * ATR( PeriodsKB ); //Plot( KTop, "KBTop" + _PARAM_VALUES(), Color, Style ); //Plot( KBot, "KBBot" + _PARAM_VALUES(), Color, Style ); Plot( KTop, "\nKBTop" + _PARAM_VALUES(), colorRed , styleLine+styleThick ); Plot( KBot, "\nKBBot" + _PARAM_VALUES(), colorRed , styleLine+styleThick ); _SECTION_END(); bbupper= BBandTop( C, PeriodsBB, WidthBB ) ; bblower= BBandBot( C, PeriodsBB, WidthBB ) ; bbmid= (bbupper+bblower)/2 ; bbmidcol= IIf(bbmid>=Ref(bbmid,-1),colorBlue,colorAqua ) ; //Plot(bbmid,"\nBBMid",colorBlue,styleLine) ; Plot(bbmid,"\nBBMid",bbmidcol,styleDots+styleThick ) ; kupper= KTop ; klower= KBot ; kmid= (ktop+kbot)/2 ; //Plot(kmid,"\nKMid",colorRed,styleLine) ; //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx //XXXXXXXXXX HEIKIN ASHI DERZI EXACT FORMULA BEGIN DDDDDDDDDDDDDDDDD _SECTION_BEGIN("HA Looping ( no AMA() )"); //SetChartOptions(0,chartShowArrows|chartShowDates); /////////////////////////////////////////////////////////// // // Heikin Ashi - Calculated Properly with no use of AMA // // JF Derzi, December 2012 // // HaClose[0] = (Open[0]+High[0]+Low[0]+Close[0]) / 4; HaOpen[0] = (HaClose[0] + Open[0]) / 2; HaHigh[0] = Max( High[0], Max( HaClose[0], HaOpen[0] ) ); HaLow[0] = Min( Low[0], Min( HaClose[0], HaOpen[0] ) ); for (i=1; i<BarCount; i++) { HaClose[i] = (Open[i]+High[i]+Low[i]+Close[i]) / 4; Haopen[i] = (HaClose[i-1] + HaOpen[i-1]) / 2; // Here is the problem when using Arrays: Haopen always uses its own previous value HaHigh[i] = Max( High[i], Max( HaClose[i], HaOpen[i] ) ); Halow[i] = Min( Low[i], Min( HaClose[i], HaOpen[i] ) ); } //PlotOHLC( HaOpen, HaHigh, HaLow, HaClose, "HA", colorBlack, styleCandle ); barcolorha = IIf(HaClose>=HaOpen,colorGreen,colorRed); SetBarFillColor(IIf(HaClose>=HaOpen,colorBrightGreen,colorOrange)); PlotOHLC( HaOpen, HaHigh, HaLow, HaClose, "\nHeikinAshiDerzi", barcolorha, styleCandle ); //-------------------------------------------------------------------------------------------------------- // Heikin Ashi & C>O and C>Ref(C,-1) /* barcolorha = IIf(HaClose>=HaOpen AND C>O and C>Ref(C,-1),colorGreen, IIf(HaClose<HaOpen AND C<O and C<Ref(C,-1),colorRed,colorBlue ) ) ; SetBarFillColor(IIf(HaClose>=HaOpen AND C>O and C>Ref(C,-1),colorBrightGreen , IIf(HaClose<HaOpen AND C<O and C<Ref(C,-1),colorRed,colorBlue ) ) ); PlotOHLC( HaOpen, HaHigh, HaLow, HaClose, "\nHeikinAshiDerzi", barcolorha, styleCandle ); */ //-------------------------------------------------------------------------------------------------------------- //Title = Name()+" "+Date()+" Heikin Ashi -- HaOpen:"+NumToStr(HaOpen,1.2,True)+" / HaHigh:"+NumToStr(HaHigh,1.2,True)+ // " / HaLow:"+NumToStr(Halow,1.2,True)+" HaClose:"+NumToStr(Haclose,1.2, True); _SECTION_END(); HAup= HaClose>=HaOpen ; haDelta= HaClose-HaOpen ; MAhaDelta= MA(haDelta,3) ; haDeltaUpMA= haDelta>MA(haDelta,3) ; //XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXHEIKIN ASHI EXACT FORMULA END DDDDDDDDDDDDDDDDDDDDDDDD //PRICE _SECTION_BEGIN("Price"); //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 )) )); //Plot( C, "", ParamColor("Color", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); //barcolorc= IIf(C>O AND C>Ref(C,-1), colorBlue, // IIf(C<O AND C<Ref(C,-1), colorRed, colorTan)); //MODEL MODEL MODEL 3 CULORI //SetBarFillColor( IIf(C>O AND C>Ref(C,-1), colorBrightGreen, // IIf(C<O AND C<Ref(C,-1), colorOrange, colorTan))); //MODEL MODEL MODEL 3 CULORI //Plot( C, "", barcolorc, styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); //Plot( C, "", barcolorc, styleBar+styleThick ); _SECTION_END(); //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx // BB & KB AREA COLOR SQUEEZE //IsSignal = bbUpper <= kUpper AND bbLower >= kLower; // OBSERVATIE: KMid= BBMid ; IsSqueeze= ( bbupper<=kupper AND bblower>=klower ) ; IsSqueezeCol= IIf(issqueeze, colorAqua,colorPink) ; PlotOHLC(bbupper,bbupper,bblower,bblower,"",issqueezecol,styleCloud) ; //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx //RIBBON TMV BEGIN RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR _SECTION_BEGIN("MultipleRibbon"); // You plot a Ribbon by calling the function as follows: MultiRibbon("Color", "Ribbon Number", "Name To Display"); // The "Ribbon Number" is simply the order of the ribbon, starting with 1 as the bottom Ribbon. You can add as many // ribbons as you want, until you run out of chart space. Just keep track of the 'Serial Number' (Ribbon Number). :-) RibbonThickness = Param("RibbonThickness", 8, 1, 15, 0.1); Font = ParamList("Font:","Arial|Calibri|Futura|Tahoma|Times New Roman"); ""; function GfxConvertBarToPixelX(Bar) { lvb = Status("lastvisiblebar"); fvb = Status("firstvisiblebar"); pxchartleft = Status("pxchartleft"); pxchartwidth = Status("pxchartwidth"); return pxchartleft + Bar * pxchartwidth / (Lvb - fvb + 1); } procedure MultiRibbon(RibbonColor, Position, Label) { LineColor = colorLightGrey; Position = RibbonThickness * Position; x2 = Status("pxchartright"); y2 = Status("pxchartbottom"); RibbonColor = IIf(GfxConvertBarToPixelX(BarIndex()-Status("firstvisiblebarindex")) > y2/1.5 * (RibbonThickness/100) * 18 , RibbonColor, colorYellow); Plot(0, "", LineColor, styleOwnScale | styleNoLabel, 0, 100); Plot(Position, "", LineColor, styleOwnScale | styleNoLabel, 0, 100); Plot(Position, "", RibbonColor, styleArea | styleOwnScale | styleNoLabel, 0, 100); GfxSetTextColor(colorBlack); GfxSelectFont(Font, y2/1.5 * (RibbonThickness/100), 400); GfxDrawText(Label, 8, y2 * 1.001 -(y2 * Position/100) , y2/1.5 * (RibbonThickness/100) * 17, y2, 2 + 32 + 256); } //================================================================================================================= //================================================================================================================= //TREND ADVISOR pointer[0] = 0; /* Phase filter */ /* Cond1 = Close > MA(Close, 50)AND NOT(Close > MA(Close, 200))AND NOT(MA(Close, 50) > MA(Close, 200)); Cond2 = Close > MA(Close, 50)AND Close > MA(Close, 200)AND NOT(MA(Close, 50) > MA(Close, 200)) ; Cond3 = Close > MA(Close, 50)AND Close > MA(Close, 200)AND MA(Close, 50) > MA(Close, 200) ; Cond4 = NOT(Close > MA(Close, 50))AND Close > MA(Close, 200)AND MA(Close, 50) > MA(Close, 200); Cond5 = NOT(Close > MA(Close, 50))AND NOT(Close > MA(Close, 200))AND MA(Close, 50) > MA(Close, 200); Cond6 = NOT(Close > MA(Close, 50))AND NOT(Close > MA(Close, 200))AND NOT(MA(Close, 50) > MA(Close, 200)); */ Cond1 = C>=MA(C,50) AND C<MA(C,200) AND MA(C,50)<MA(C,200); Cond2 = C>=MA(C,50) AND C>=MA(C,200) AND MA(C,50)<MA(C,200) ; Cond3 = C>=MA(C,50) AND C>=MA(C,200) AND MA(C,50)>=MA(C,200) ; Cond4 = C<MA(C,50) AND C>=MA(C,200) AND MA(C,50)>=MA(C,200); Cond5 = C<MA(C,50) AND C<MA(C,200) AND MA(C,50)>=MA(C,200); Cond6 = C<MA(C,50) AND C<MA(C,200) AND MA(C,50)<MA(C,200); for (i = 1; i < BarCount; i++) { if (Cond1[i]) pointer[i] = 1; if (Cond2[i]) pointer[i] = 2; if (Cond3[i]) pointer[i] = 3; if (Cond4[i]) pointer[i] = 4; if (Cond5[i]) pointer[i] = 5; if (Cond6[i]) pointer[i] = 6; } /* Plot Graphic */ GraphXSpace= 15 ; dynamic_color = IIf(pointer < 4, colorGreen, colorRed); //Plot(pointer, "TrendAdvisor", dynamic_color, styleHistogram | styleThick, Null, Null, 0); //SetChartBkGradientFill(ParamColor("BgTop", colorWhite), ParamColor("BgBottom", colorLightYellow)); Cond = pointer<4 ; Condmy = pointer<=4 ; //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx //GRAPHIC MODIFIED BULL&BEAR VOLUME CHYNTHIA _SECTION_BEGIN("BullBearVolume"); C1 = Ref(C, -1); uc = C > C1; dc = C <= C1; ud = C > O; dd = C <= O; green = 1; blue = 2; yellow = 3; red = 4; white = 5; VType = IIf(ud, IIf(uc, green, yellow), IIf(dd, IIf(dc, red, blue), white)); gv = IIf(VType == green, V, 0); yv = IIf(VType == yellow, V, 0); rv = IIf(VType == red, V, 0); bv = IIf(VType == blue, V, 0); uv = gv + bv; uv1 = Ref(uv, -1); /* up volume */ dv = rv + yv; dv1 = Ref(dv, -1); /* down volume */ /* create moving average period parameters */ VolPer = Param("Adjust Vol. MA per.", 21, 1, 255, 1); ConvPer = Param("Adjust Conv. MA per.", 7, 1, 255, 1); /* create triple exponential moving avearges of separate up and down volume moving averages */ MAuv = TEMA(uv, VolPer ); mauv1 = Ref(mauv, -1); MAdv = TEMA(dv, VolPer ); madv1 = Ref(madv, -1); MAtv = TEMA(V, VolPer );//total volume /* Switch for Horizontal lines indicating current level of positive and negative volume for ease in comparing to past highs/lows - toggle via parmameter window */ OscillatorOnly = Param("ShowOscillatorOnly", 0, 0, 1, 1); CompareBullVolume = Param("ShowBullLevel", 1, 0, 1, 1); if(CompareBullvolume AND !OscillatorOnly){ //Plot(SelectedValue(MAuv), "", colorGreen, styleLine); } CompareBearVolume = Param("ShowBearLevel", 1, 0, 1, 1); if(CompareBearVolume AND !OscillatorOnly){ //Plot(SelectedValue(MAdv), "", colorRed, styleLine); } /* Volume Segment Switches - toggle via parameter window */ bullvolume = Param("ShowBullVolume", 1, 0, 1, 1); bearvolume = Param("ShowBearVolume", 1, 0, 1, 1); totalvolume = Param("ShowTEMA(TotalVolume)", 1, 0, 1, 1); /* plot volume lines and histograms if toggled on: */ bearToFront = Param("ShowBearVolinFront", 0, 0, 1, 1); if(bearToFront AND !OscillatorOnly){ //Plot(MAdv, "", colorRed, styleNoLabel); } if(bullvolume AND !OscillatorOnly){ //Plot(MAuv, "AverageBullVolume", colorGreen, styleThick+styleNoLabel); } if(bearvolume AND !OscillatorOnly){ //Plot(MAdv, "AverageBearVolume", colorRed, styleThick+styleNoLabel); } if(bearvolume AND !OscillatorOnly){ //Plot(MAdv, "", colorOrange, styleNoLabel); //PlotOHLC( 0 , MAdv , 0 , MAdv , "", colorOrange, styleCloud | styleNoRescale|styleNoLabel); } if(bullvolume AND !OscillatorOnly){ //Plot(MAuv, "", colorLime, styleNoLabel); //PlotOHLC( 0 , MAuv , O ,MAuv , "", colorLime, styleCloud | styleNoRescale|styleNoLabel); } if(totalVolume AND !OscillatorOnly){ //Plot(MAtv, "TEMA(TotalVolume)", colorLightBlue ); //PlotOHLC( 0 , MAtv , 0 , MAtv , "", colorLightBlue, styleCloud | styleNoRescale|styleNoLabel); } /* Buy=Cross(MAuv,MAdv); Sell=Cross(MAdv,MAuv); PlotShapes(IIf(Buy,shapeUpArrow,shapeNone) ,colorBlue); PlotShapes(IIf(Sell,shapeDownArrow,shapeNone),colorRed); Filter=Buy OR Sell; Buy=ExRem(Buy,Sell); Sell=ExRem(Sell,Buy); */ //AddColumn(Close,"Close");AddColumn(Volume,"Total Volume");AddColumn(Buy,"Buy"); AddColumn(Sell,"sell"); /* better visibility of zero line: */ //Plot(0, "", colorViolet, 1); /* Rise/Fall Convergence variables: */ Converge = (TEMA(MAuv - MAdv, ConvPer)); Converge1 = Ref(Converge, -1); ConvergeUp = Converge > Converge1; ConvergeOver = Converge > 0; rising = ConvergeUp AND ConvergeOver; falling = !ConvergeUp AND ConvergeOver; /* Rise/Fall Convergence Oscillator Switch - toggle via parameter window - (provides a better view of resulting combination of battling bull/bear volume forces) */ convergenceOscillator = Param("Show Oscillator", 0, 0, 1, 1); if(convergenceOscillator OR OscillatorOnly){ //Plot(Converge, "AmimalsWar", colorBrown, 1|styleLeftAxisScale|styleNoLabel|styleThick); //Plot(0,"", colorViolet, 1|styleLeftAxisScale|styleNoLabel); } /******************************************************** Convergence Rise/Fall Shadows: (provides a more easily visible display of rising and falling bull/bear volume convergence) - toggle via parameter window -posiitive Volume exceeding negative Volume: Light shadow -negative volume exceeding positive volume: dark shadow -if you use standard gray background - best shadows are: -my greys: 14 = (216, 216, 216); 15 = (168, 168, 168)); -best substitute? using AB color constants? -light: colorpalegreen; dark: colorRose;? -(depends on your color scheme - customize to your tastes) **********************************************************/ /* uncomment if you use my custom color greys: */ riseFallColor = IIf(rising, colorLime,colorOrange); //my custom shadow greys /* comment out if you use my custom color gray shadows: */ /* riseFallColor = IIf(rising, colorPaleGreen,colorRose); */ /* Rise/Fall Convergence Plot Switch - toggle via parameter window */ riseFallShadows = Param("ShowRiseFallShadows", 0, 0, 1, 1); if(riseFallShadows){ //Plot(IIf(rising OR falling, 1, 0), "", riseFallColor, styleArea|styleOwnScale|styleNoLabel); } GraphXSpace = 0.5; _SECTION_END(); /* _SECTION_BEGIN("Background"); SetChartBkColor(ParamColor("Outer panel",colorBlack)); // color of outer border SetChartBkGradientFill( ParamColor("Inner panel upper",colorBlack),ParamColor("Inner panel lower",colorBlack)); tchoice=Param("Title Selection ",2,1,2,1); _SECTION_END(); */ BullV= MAuv>MAdv ; UpV= ( MAuv>MAdv AND MFI()>MA(MFI(),7) ) ; UporV= ( MAuv>MAdv OR MFI()>MA(MFI(),7) ) ; DnV= ( MAuv<MAdv AND MFI()<MA(MFI(),7) ) ; DnorV= ( MAuv<MAdv OR MFI()<MA(MFI(),7) ) ; //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx //CLEAR METHOD //LISTING 1 upsw = 0; Hh = Lh = H[ 0 ]; Hl = Ll = L[ 0 ]; for( i = 0; i < BarCount; i++ ) { Ch = H[ i ]; Cl = L[ i ]; if( upsw == 1 ) { Hh = Max( Ch, Hh ); hL = Max( Cl, Hl ); if( Ch < Hl ) { upsw = 0; Ll = Cl; Lh = Ch; } } if( upsw == 0 ) { Ll = Min( Cl, Ll ); Lh = Min( Ch, Lh ); if( Cl > Lh ) { upsw = 1; Hh = Ch; Hl = Cl; } } Hla[ i ] = Hl; Lha[ i ] = Lh; upswa[ i ] = upsw; } //Plot( IIf( upswa == 1, Hla, Null ), "SwLine", ColorRGB( 64, 128, 128), styleThick ); //Plot( IIf( upswa == 0, Lha, Null ), "SwLine", ColorRGB( 128, 64, 128), styleThick ); //Plot( IIf( upswa == 1, Hla, Null ), "\nSwLine", colorBlue , styleDots ); //Plot( IIf( upswa == 0, Lha, Null ), "\nSwLine", colorRed , styleDots ); //Plot( C, "Price", IIf( upswa == 1, // ColorBlend( colorGreen, colorWhite ), // ColorBlend( colorRed, colorWhite )), styleBar+styleThick ); //Plot( C, "Price", IIf( upswa == 1, // ColorBlend( colorLime , colorWhite ), // ColorBlend( colorRed, colorWhite )), styleBar+styleThick ); CpClear= upswa == 1 ; VdClear= upswa == 0 ; //Buy= Cross(upswa ,0) ; //Sell= Cross(1,upswa) ; //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx //FORMULE RIBBON TREND MOMENTUM VOLUME Stochup= StochK()>StochD() ; macdup= MACD()>Signal() ; macdup0= MACD()>0 ; Hist= MACD()-Signal() ; Histup= Hist>Ref(Hist,-1) ; pdiupmdi= PDI()>MDI() ; uptrend= ( MACD()>Signal() AND PDI()>MDI() ) ; dntrend= ( MACD()<Signal() AND PDI()<MDI() ) ; rsiupma7= RSI()>MA(RSI(),7) ; CCIUP0= CCI()>0 ; MFIUPMA7= MFI()>MA(MFI(),7) ; myup= (pdiupmdi AND macdup0 AND cciup0 AND histup AND stochup AND upswa == 1 ) ; //YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY //RIBBONS TREND MOMENTUM VOLUME //R8=========================== TREND =============================================================== r1 = IIf( uptrend ,colorGreen , IIf( dntrend , colorRed,colorTan ) ) ; //--------------------------------------------------------------------------------------------------- //R1============================= MOMENTUM ==================================================== r2 = IIf( rsiupma7 AND cciup0,colorGreen , IIf( !rsiupma7 AND !cciup0, colorRed,colorTan ) ) ; //----------------------------------------------------------------------------------------------- //R1============================== VOLUME ==================================================== r3 = IIf( mfiupma7 AND bullv,colorGreen , IIf( !mfiupma7 AND !bullv, colorRed,colorTan ) ) ; //------------------------------------------------------------------------------------------- //YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx MultiRibbon( r3, 1, "VOLUME"); MultiRibbon( r2, 2, "MOMENTUM"); MultiRibbon( r1, 3, "TREND"); // RIBBON TMV END RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR //VSTOP 2 _SECTION_BEGIN("Volatility 2"); // Just Re-share // E.M.Pottasch, Jul 2010 // from Metastock formula, link: http://stocata.org/metastock/stop_trail_atr.html // added separate parameters for upward and downward market environment function vstop_func(trBull,trBear) { trailArray[ 0 ] = C[ 0 ]; // initialize for( i = 1; i < BarCount; i++ ) { prev = trailArray[ i - 1 ]; if (C[ i ] > prev AND C[ i - 1 ] > prev) { trailArray[ i ] = Max(prev,C[ i ] - trBull[ i ]); } else if (C[ i ] < prev AND C[ i - 1 ] < prev) { trailArray[ i ] = Min(prev,C[ i ] + trBear[ i ]); } else if (C[ i ] > prev) { trailArray[ i ] = C[ i ] - trBull[ i ]; } else { trailArray[ i ] = C[ i ] + trBear[ i ]; } } return trailArray; } //trailLong= Support= SellStop ; //trailShort= Resistance= BuyStop ; //per = Param("per",20, 1, 150, 1); //multBull = Param("multBull",2, 1, 4, 0.05); //multBear = Param("multBear",2, 1, 4, 0.05); per = Param("ATRper",14, 1, 150, 1); multBear = Param("kRes",1.7, 0, 4, 0.05); multBull = Param("kSup",1.7, 0, 4, 0.05); trBull = multBull * ATR(per); trBear = multBear * ATR(per); trailArray = vstop_func(trBull,trBear); //SetChartBkColor( ParamColor("ColorBG", ColorRGB( 0, 0, 0 ) ) ); GraphXSpace = 5; //SetChartOptions(0, chartShowDates); //Plot(IIf(trailArray > C,trailArray,Null),"\ntrailShort",ParamColor("ColorTrailShort",ColorRGB(255,0,0)),styleStaircase); //Plot(IIf(trailArray < C,trailArray,Null),"\ntrailLong",ParamColor("ColorTrailLong",ColorRGB(0,255,0)),styleStaircase); //Plot(IIf(trailArray > C,trailArray,Null),"\nBuyStop",colorRed,styleStaircase+styleThick); //Plot(IIf(trailArray < C,trailArray,Null),"\nSellStop",colorBlue,styleStaircase+styleThick); trailARRAYcolor= IIf(C>trailARRAY,colorBlue,colorRed) ; //Plot(trailArray,"\nVSTOP",trailARRAYcolor,styleLine+styleThick) ; //Plot(trailArray,"\nVSTOP",trailARRAYcolor,8+16) ; //Plot(trailArray,"\nVSTOP",trailARRAYcolor,styledots) ; //Plot( C, "\nCandle",colorWhite, styleCandle ); BuystopNew= C>trailARRAY ; _SECTION_END(); //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx //TRAILING STOP LOSS WITH HIGH AND LOW /* // STAMP CODE NAME GfxSelectFont("Tahoma", 15, 700 ); GfxSetBkColor( colorGreen ); GfxSetTextColor(colorBlack); GfxTextOut("High Low Trailing Stop",Status("pxwidth")/1.25,Status("pxheight")/50); GraphXSpace=5; */ //====== Original TT by X ======== //------ Setting ----------------- SetOption("InitialEquity",1000000); SetTradeDelays( 0, 0, 0, 0 ); RoundLotSize = 100; BuyPrice=Close; SellPrice=Close; SetOption("maxopenpositions",1); PositionSize=-100; PcntOffset = 0; function Hstop_func() { trailHL[ 0 ] = L[ 0 ]; // initialize for( i = 1; i < BarCount; i++ ) { prev = trailHL[ i - 1 ]; if (C[ i ] >= prev AND C[ i - 1 ] >= prev)// Long Side This Day and Previous Day > Trailing { if(H[i]>H[i-1])// Make New High trailHL[ i ] = (Max(prev,L[i-1]))*(1-PcntOffset/100); else // No New high trailHL[ i ] = prev; } else if (C[ i ] < prev AND C[ i - 1 ] < prev)// Short Side This Day and Previous Day < Trailing { if(L[i]<L[i-1])// Make New Low trailHL[ i ] = (Min(prev,H[i-1]))*(1+PcntOffset/100); else trailHL[ i ] = prev; } else if (C[ i ] < prev AND C[ i - 1 ] >= prev)// Short Point { trailHL[ i ] = (Max(H[i],H[i-1]))*(1+PcntOffset/100);//C[ i ] - trBull[ i ]; stoploss[i-1]=1; } else //Long Point { trailHL[ i ] = (L[i])*(1-PcntOffset/100);//C[ i ] + trBear[ i ]; } } return trailHL; } trailHL = Hstop_func(); //Plot( trailHL,"\nStopLossHL",IIf(C<trailHL,colorRed,colorBlue),styleLine+styleThick); CpHL= C>trailHL ; //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx //GRAPHIC MODIFIED BULL&BEAR VOLUME CHYNTHIA _SECTION_BEGIN("BullBearVolume"); C1 = Ref(C, -1); uc = C > C1; dc = C <= C1; ud = C > O; dd = C <= O; green = 1; blue = 2; yellow = 3; red = 4; white = 5; VType = IIf(ud, IIf(uc, green, yellow), IIf(dd, IIf(dc, red, blue), white)); gv = IIf(VType == green, V, 0); yv = IIf(VType == yellow, V, 0); rv = IIf(VType == red, V, 0); bv = IIf(VType == blue, V, 0); uv = gv + bv; uv1 = Ref(uv, -1); /* up volume */ dv = rv + yv; dv1 = Ref(dv, -1); /* down volume */ /* create moving average period parameters */ VolPer = Param("Adjust Vol. MA per.", 21, 1, 255, 1); ConvPer = Param("Adjust Conv. MA per.", 7, 1, 255, 1); /* create triple exponential moving avearges of separate up and down volume moving averages */ MAuv = TEMA(uv, VolPer ); mauv1 = Ref(mauv, -1); MAdv = TEMA(dv, VolPer ); madv1 = Ref(madv, -1); MAtv = TEMA(V, VolPer );//total volume /* Switch for Horizontal lines indicating current level of positive and negative volume for ease in comparing to past highs/lows - toggle via parmameter window */ OscillatorOnly = Param("ShowOscillatorOnly", 0, 0, 1, 1); CompareBullVolume = Param("ShowBullLevel", 1, 0, 1, 1); if(CompareBullvolume AND !OscillatorOnly){ //Plot(SelectedValue(MAuv), "", colorGreen, styleLine); } CompareBearVolume = Param("ShowBearLevel", 1, 0, 1, 1); if(CompareBearVolume AND !OscillatorOnly){ //Plot(SelectedValue(MAdv), "", colorRed, styleLine); } /* Volume Segment Switches - toggle via parameter window */ bullvolume = Param("ShowBullVolume", 1, 0, 1, 1); bearvolume = Param("ShowBearVolume", 1, 0, 1, 1); totalvolume = Param("ShowTEMA(TotalVolume)", 1, 0, 1, 1); /* plot volume lines and histograms if toggled on: */ bearToFront = Param("ShowBearVolinFront", 0, 0, 1, 1); if(bearToFront AND !OscillatorOnly){ //Plot(MAdv, "", colorRed, styleNoLabel); } if(bullvolume AND !OscillatorOnly){ //Plot(MAuv, "AverageBullVolume", colorGreen, styleThick+styleNoLabel); } if(bearvolume AND !OscillatorOnly){ //Plot(MAdv, "AverageBearVolume", colorRed, styleThick+styleNoLabel); } if(bearvolume AND !OscillatorOnly){ //Plot(MAdv, "", colorOrange, styleNoLabel); //PlotOHLC( 0 , MAdv , 0 , MAdv , "", colorOrange, styleCloud | styleNoRescale|styleNoLabel); } if(bullvolume AND !OscillatorOnly){ //Plot(MAuv, "", colorLime, styleNoLabel); //PlotOHLC( 0 , MAuv , O ,MAuv , "", colorLime, styleCloud | styleNoRescale|styleNoLabel); } if(totalVolume AND !OscillatorOnly){ //Plot(MAtv, "TEMA(TotalVolume)", colorLightBlue ); //PlotOHLC( 0 , MAtv , 0 , MAtv , "", colorLightBlue, styleCloud | styleNoRescale|styleNoLabel); } /* Buy=Cross(MAuv,MAdv); Sell=Cross(MAdv,MAuv); PlotShapes(IIf(Buy,shapeUpArrow,shapeNone) ,colorBlue); PlotShapes(IIf(Sell,shapeDownArrow,shapeNone),colorRed); Filter=Buy OR Sell; Buy=ExRem(Buy,Sell); Sell=ExRem(Sell,Buy); */ //AddColumn(Close,"Close");AddColumn(Volume,"Total Volume");AddColumn(Buy,"Buy"); AddColumn(Sell,"sell"); /* better visibility of zero line: */ //Plot(0, "", colorViolet, 1); /* Rise/Fall Convergence variables: */ Converge = (TEMA(MAuv - MAdv, ConvPer)); Converge1 = Ref(Converge, -1); ConvergeUp = Converge > Converge1; ConvergeOver = Converge > 0; rising = ConvergeUp AND ConvergeOver; falling = !ConvergeUp AND ConvergeOver; /* Rise/Fall Convergence Oscillator Switch - toggle via parameter window - (provides a better view of resulting combination of battling bull/bear volume forces) */ convergenceOscillator = Param("Show Oscillator", 0, 0, 1, 1); if(convergenceOscillator OR OscillatorOnly){ //Plot(Converge, "AmimalsWar", colorBrown, 1|styleLeftAxisScale|styleNoLabel|styleThick); //Plot(0,"", colorViolet, 1|styleLeftAxisScale|styleNoLabel); } /******************************************************** Convergence Rise/Fall Shadows: (provides a more easily visible display of rising and falling bull/bear volume convergence) - toggle via parameter window -posiitive Volume exceeding negative Volume: Light shadow -negative volume exceeding positive volume: dark shadow -if you use standard gray background - best shadows are: -my greys: 14 = (216, 216, 216); 15 = (168, 168, 168)); -best substitute? using AB color constants? -light: colorpalegreen; dark: colorRose;? -(depends on your color scheme - customize to your tastes) **********************************************************/ /* uncomment if you use my custom color greys: */ riseFallColor = IIf(rising, colorLime,colorOrange); //my custom shadow greys /* comment out if you use my custom color gray shadows: */ /* riseFallColor = IIf(rising, colorPaleGreen,colorRose); */ /* Rise/Fall Convergence Plot Switch - toggle via parameter window */ riseFallShadows = Param("ShowRiseFallShadows", 0, 0, 1, 1); if(riseFallShadows){ //Plot(IIf(rising OR falling, 1, 0), "", riseFallColor, styleArea|styleOwnScale|styleNoLabel); } GraphXSpace = 0.5; _SECTION_END(); /* _SECTION_BEGIN("Background"); SetChartBkColor(ParamColor("Outer panel",colorBlack)); // color of outer border SetChartBkGradientFill( ParamColor("Inner panel upper",colorBlack),ParamColor("Inner panel lower",colorBlack)); tchoice=Param("Title Selection ",2,1,2,1); _SECTION_END(); */ BullV= MAuv>MAdv ; //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx //AROON OSCILLATOR /* Description: Aroon is Sanskrit word meaning "dawn's early light" or the change from night to day. The Aroon indicator allows you to anticipate changes in security prices from trending to trading range. The indicator uses two lines: Aroon Up and Aroon Down. Aroon Down is a measure of how close the current bar is to the most recent lowest Low bar found in the last N bars. Aroon Up is a measure of how close the current bar is to the most recent highest High bar found in the last N bars. Additionally Aroon oscillator can be defined as the difference between the Aroon Up and Aroon Down indicators. For more information on the Aroon indicator see the article written by Tushar Chande in the September 1995 issue of Technical Analysis of Stocks & Commodities magazine. Aroon indicator ranges from 0 to 100 and it is drawn with additional 30/70 levels. The default period is 14 days. The indicator works as follows: if a security makes a new 14-day high, the Aroon Up = 100; when the security makes a new 14-day low, the Aroon Down = 100; when there was no new high in 14 days, the Aroon Up = 0; and consequently when there was no new low for 14 days, the Aroon Down = 0. Aroon indicator is an another way (in addition to VHF and ADX indicators) of detemining if market is trending or not. "The Aroon Oscillator indicates an upward trend when it is above zero and a downward trend when it is below zero."; "The farther away the oscillator is from the zero line, the stronger the trend."; The Aroon indicator allows you to anticipate changes in security prices from trending to trading range. The indicator uses two lines: Aroon Up AND Aroon Down. Aroon Down is a measure of how Close the current bar is to the most recent Lowest Low bar found in the last N bars. Aroon Up is a measure of how Close the current bar is to the most recent Highest High bar found in the last N bars. Additionally Aroon oscillator can be defined as the difference between the Aroon Up AND Aroon Down indicators. Aroon indicator ranges from 0 to 100 AND it is drawn with additional 30/70 levels. The default period is 14 days. The indicator works as follows: if a security makes a new 14-Day High, the Aroon Up = 100; when the security makes a new 14-Day Low, the Aroon Down = 100; when there was no new High in 14 days, the Aroon Up = 0; AND consequently when there was no new Low for 14 days, the Aroon Down = 0. Aroon indicator is an another way (in addition to VHF AND ADX indicators) of detemining if market is trending OR NOT. */ AroonPer = Param("AroonPer",14,4,45,1); AroonUp = 100 * (AroonPer - (HHVBars(H, AroonPer + 1))) / AroonPer; AroonDn = 100 * (AroonPer - (LLVBars(L, AroonPer + 1))) / AroonPer; AroonOsc = AroonUp - AroonDn; //pdimdicol= IIf(pdimdi>0 AND pdimdi>Ref(pdimdi,-1),colorGreen, // IIf(pdimdi<0 AND pdimdi<Ref(pdimdi,-1),colorRed,colorTan ) ) ; Arooncol= IIf(aroonosc>0 AND aroonosc>Ref(aroonosc,-1) OR aroonosc>=50,colorGreen, IIf(aroonosc<0 AND aroonosc<Ref(aroonosc,-1),colorRed,colorTan ) ) ; //Plot(AroonOsc, "Aroon Oscillator("+AroonPer+")", IIf(AroonOsc > 0,colorLime,colorRed), styleHistogram| styleThick); //Plot(AroonOsc, "Aroon Oscillator("+AroonPer+")", arooncol, styleDots ); //Plot(AroonOsc, "", arooncol, styleHistogram| styleThick); //PlotGrid(-50, colorBrown); //PlotGrid(50, colorBrown); //Plot(-50,"", colorBlue ,styleLine ); //Plot(50, "",colorRed ,styleLine ); //Plot(0, "",colorBrown,styleLine ); AroonOscUp0= AroonOsc>0 ; AroonOscUp50= AroonOsc>=50 ; AroonOscUp= AroonOsc>Ref(AroonOsc,-1) ; AroonOscUpUp= ( AroonOsc>0 AND AroonOsc>=Ref(AroonOsc,-1) ) ; //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx //CLEAR METHOD //LISTING 1 upsw = 0; Hh = Lh = H[ 0 ]; Hl = Ll = L[ 0 ]; for( i = 0; i < BarCount; i++ ) { Ch = H[ i ]; Cl = L[ i ]; if( upsw == 1 ) { Hh = Max( Ch, Hh ); hL = Max( Cl, Hl ); if( Ch < Hl ) { upsw = 0; Ll = Cl; Lh = Ch; } } if( upsw == 0 ) { Ll = Min( Cl, Ll ); Lh = Min( Ch, Lh ); if( Cl > Lh ) { upsw = 1; Hh = Ch; Hl = Cl; } } Hla[ i ] = Hl; Lha[ i ] = Lh; upswa[ i ] = upsw; } //Plot( IIf( upswa == 1, Hla, Null ), "SwLine", ColorRGB( 64, 128, 128), styleThick ); //Plot( IIf( upswa == 0, Lha, Null ), "SwLine", ColorRGB( 128, 64, 128), styleThick ); //Plot( IIf( upswa == 1, Hla, Null ), "\nSwLine", colorBlue , styleDots ); //Plot( IIf( upswa == 0, Lha, Null ), "\nSwLine", colorRed , styleDots ); //Plot( C, "Price", IIf( upswa == 1, // ColorBlend( colorGreen, colorWhite ), // ColorBlend( colorRed, colorWhite )), styleBar+styleThick ); //Plot( C, "Price", IIf( upswa == 1, // ColorBlend( colorLime , colorWhite ), // ColorBlend( colorRed, colorWhite )), styleBar+styleThick ); CpClear= upswa == 1 ; VdClear= upswa == 0 ; //Buy= Cross(upswa ,0) ; //Sell= Cross(1,upswa) ; //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx //COUNTBACK LINE //* Stephane Carrasset's Countback Line (CBL) popularized by Daryl Guppy //Refer to amibroker posting 30th December 2004 */ //nR=2; nR= Param("nR",2,1,20,1,0) ; Cbl[nR]=Null; bCBL=False; for( i=nR; i < BarCount; i++) { if( (Low[i-2]<Low[i-1]) && (Low[i-1]<Low[i]) ) { Cbl[i] = Low[i-2]; bCBL = True; } else if (bCBL) { if (Low[i] < Cbl[i-1]) { Cbl[i] = Cbl[i-1]; bCBL = False; } else { n = nR; minval[i] = Low[i]; breakloop= False; for (j = 1; NOT(breakloop) && j <= i; j++) { if (Low[i-j] < minval[i]) { if (n>1) { minval[i] = Low[i-j]; n--; } else { Cbl[i] = Low[i-j]; breakloop=True; } } } if (Cbl[i] < Cbl[i-1]) Cbl[i] = Cbl[i-1]; } } else { Cbl[i] = Cbl[i-1]; } if (Cbl[i]==0) Cbl[i] = Cbl[i-1]; } CBLcol= IIf(C>CBL,colorBlue,colorRed) ; //Plot(Cbl,"\nCBL",colorRed,styleLine+styleThick); //Plot(Cbl,"\nCBL",CBLcol,styleLine+styleThick); //Plot(C,"",-1,64); _SECTION_END(); CpCBL= C>CBL ; //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx //TREND ADVISOR pointer[0] = 0; /* Phase filter */ /* Cond1 = Close > MA(Close, 50)AND NOT(Close > MA(Close, 200))AND NOT(MA(Close, 50) > MA(Close, 200)); Cond2 = Close > MA(Close, 50)AND Close > MA(Close, 200)AND NOT(MA(Close, 50) > MA(Close, 200)) ; Cond3 = Close > MA(Close, 50)AND Close > MA(Close, 200)AND MA(Close, 50) > MA(Close, 200) ; Cond4 = NOT(Close > MA(Close, 50))AND Close > MA(Close, 200)AND MA(Close, 50) > MA(Close, 200); Cond5 = NOT(Close > MA(Close, 50))AND NOT(Close > MA(Close, 200))AND MA(Close, 50) > MA(Close, 200); Cond6 = NOT(Close > MA(Close, 50))AND NOT(Close > MA(Close, 200))AND NOT(MA(Close, 50) > MA(Close, 200)); */ Cond1 = C>=MA(C,50) AND C<MA(C,200) AND MA(C,50)<MA(C,200); Cond2 = C>=MA(C,50) AND C>=MA(C,200) AND MA(C,50)<MA(C,200) ; Cond3 = C>=MA(C,50) AND C>=MA(C,200) AND MA(C,50)>=MA(C,200) ; Cond4 = C<MA(C,50) AND C>=MA(C,200) AND MA(C,50)>=MA(C,200); Cond5 = C<MA(C,50) AND C<MA(C,200) AND MA(C,50)>=MA(C,200); Cond6 = C<MA(C,50) AND C<MA(C,200) AND MA(C,50)<MA(C,200); for (i = 1; i < BarCount; i++) { if (Cond1[i]) pointer[i] = 1; if (Cond2[i]) pointer[i] = 2; if (Cond3[i]) pointer[i] = 3; if (Cond4[i]) pointer[i] = 4; if (Cond5[i]) pointer[i] = 5; if (Cond6[i]) pointer[i] = 6; } /* Plot Graphic */ GraphXSpace= 15 ; dynamic_color = IIf(pointer < 4, colorGreen, colorRed); //Plot(pointer, "TrendAdvisor", dynamic_color, styleHistogram | styleThick, Null, Null, 0); //SetChartBkGradientFill(ParamColor("BgTop", colorWhite), ParamColor("BgBottom", colorLightYellow)); Cond = pointer<4 ; //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx //FORMULE stochup= StochK()>StochD() ; stochupmy= ( StochK()>StochD() OR StochK()>80) ; stochdn80= StochK()<80 ; stochup19= StochK()>19 ; MACDup= MACD()>Signal() ; MACDup0= MACD()>0 ; Hist= MACD()-Signal() ; Histup= Hist>Ref(Hist,-1) ; MFIupma7= MFI()>MA(MFI(),7) ; MFIdn80= MFI()<80 ; MFIup50= MFI()>50 ; MFIup30= MFI()>30 ; Cupo= C>O ; CCIup0= CCI()>0 ; CCIupMA7= CCI()>MA(CCI(),7) ; MA20up= MA(C,20)>=Ref(MA(C,20),-1) ; MA10upMA15= MA(C,10)>MA(C,15) ; MA5upma10= MA(C,5)>MA(C,10) ; EMA50up= (EMA(C,50)>=Ref(EMA(C,50),-1) OR C>=EMA(C,50)) ; Cupma20= C>MA(C,20) ; Cupma50= C>MA(C,50) ; PDIupmdi= PDI()>MDI() ; PDIup20= PDI()>20 ; PDIup18= PDI()>18 ; Uptrend= (MACD()>Signal() AND PDI()>MDI()) ; Dntrend= (MACD()<Signal() AND PDI()<MDI()) ; ADX50= ADX()<50 ; ADXup18= ADX()>18 ; ADXupup= (ADX()>18 AND ADX()>Ref(ADX(),-1) OR ADX()>20 ) ; HAup= haClose>=haOpen ; CupSAR= C>SAR(0.02,0.2) ; RSIup50= RSI()>50 ; RSIupMA7= RSI()>MA(RSI(),7) ; UpV= (MAuv>MAdv AND MFI()>MA(MFI(),7)) ; DnV= (MAuv<MAdv AND MFI()<MA(MFI(),7)) ; UpORV= (MAuv>MAdv OR MFI()>MA(MFI(),7)) ; CupSAR= C>SAR() ; LimADX= ADX()<49 AND ADX()>18 ; Cuptop1= C>BBandTop( C,20,1 ) ; MyUp= ( macdup0 AND pdiupmdi AND histup AND stochup AND cciup0 AND upv ) ; //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx //PARAMTOGGLE // This combines indicators into one timing Signal //function ParamOptimize( description, default, minv, maxv, step ) // { return Optimize(description, Param(description,default, minv, maxv, step ), minv, maxv, step ); } tgl = ParamToggle("Result", "AND logic|Compare"); // switch test calculation and compare the results if(tgl) { myBuy = issqueeze AND haup AND ( ( macdup AND rsiupma7 ) OR myup ) ; myShort = !buystopnew AND !cuptop1 AND !haup OR !macdup AND !cuptop1 AND !haup OR DNTREND AND DNV ; } else { myBuy = IIf( ( bbupper<=kupper AND bblower>=klower ) AND haClose>=haOpen AND ( ( MACD()>Signal() AND RSI()>MA(RSI(),7) ) OR ( macdup0 AND pdiupmdi AND histup AND stochup AND cciup0 AND upv ) ) ,1,0); myShort = IIf( C<trailARRAY AND C<BBandTop( C,20,1 ) AND haClose<haOpen OR MACD()<Signal() AND C<BBandTop( C,20,1 ) AND haClose<haOpen OR (MACD()<Signal() AND PDI()<MDI()) AND (MAuv<MAdv AND MFI()<MA(MFI(),7)) ,1,0); } //Buy = ExRem(myBuy, myShort) ; //Sell = ExRem(myShort, myBuy) ; Buy= Cross(mybuy,myshort) ; Sell= Cross(myshort,mybuy) ; StrongBuy = Buy AND Cross(MACD(),Signal()) OR Buy AND Cross(RSI(),MA(RSI(),7)) OR Buy AND Cross( C,trailARRAY ) OR Buy AND Cross(PDI(),MDI()) OR Buy AND Cross(StochK(),StochD()) AND Stochdn80 OR Buy AND Cross(C,CenterLine) ; MediumBuy = Buy AND uporv ; WeakBuy = Buy ; StrongSell = Sell AND Cross(BBandTop( C,20,1 ),C ) OR Sell AND Cross(Signal(),MACD()) OR Sell AND Cross(80,StochK() ) OR Sell AND Cross(trailARRAY,C ) OR Sell AND Cross(CenterLine,C) ; MediumSell = Sell AND !stochup AND stochdn80 AND !haup ; WeakSell = Sell ; /* PlotShapes(IIf(StrongBuy,shapeUpTriangle,shapeNone),colorBlue,0,Low,Offset=-20); PlotShapes(IIf(MediumBuy,shapeUpArrow,shapeNone),colorBlue,0,Low,Offset=-20); PlotShapes(IIf(WeakBuy,shapeHollowUpArrow,shapeNone),colorBlue,0,Low,Offset=-20); PlotShapes(IIf(StrongSell,shapeDownTriangle,shapeNone),colorRed,0,High,Offset=-20); PlotShapes(IIf(MediumSell,shapeDownArrow,shapeNone),colorRed,0,High,Offset=-20); PlotShapes(IIf(WeakSell,shapeHollowDownArrow,shapeNone),colorRed,0,High,Offset=-20); */ PlotShapes(IIf(StrongBuy,shapeUpTriangle,shapeNone),colorBlue,0,haLow,Offset=-10); PlotShapes(IIf(MediumBuy,shapeUpArrow,shapeNone),colorBlue,0,haLow,Offset=-10); PlotShapes(IIf(WeakBuy,shapeHollowUpArrow,shapeNone),colorBlue,0,haLow,Offset=-10); PlotShapes(IIf(StrongSell,shapeDownTriangle,shapeNone),colorRed,0,haHigh,Offset=-10); PlotShapes(IIf(MediumSell,shapeDownArrow,shapeNone),colorRed,0,haHigh,Offset=-10); PlotShapes(IIf(WeakSell,shapeHollowDownArrow,shapeNone),colorRed,0,haHigh,Offset=-10); //PlotShapes(IIf(Buy,shapeUpArrow,shapeNone),colorBlue,0,haLow,Offset=-10); //PlotShapes(IIf(Sell,shapeDownArrow,shapeNone),colorRed,0,haHigh,Offset=-10); //PlotShapes(IIf(Buy,shapeUpArrow,shapeNone),colorBlue,0,trailArray); //PlotShapes(IIf(Sell,shapeDownArrow,shapeNone),colorRed,0,trailArray); //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
2 comments
Leave Comment
Please login here to leave a comment.
Back
I think, this is a more reliable calculation for BBSqueeze, without Keltner Bands, for a certain specific evolution of a stock volatility :
This line: bandwidthma= MA ;
can’t be correct as written? i.e. MA (of what)?
Perhaps, it should be: bandwidthma= MA (bandwidth, bandwidthmaper); ???