Stock Portfolio Organizer
The ultimate porfolio management solution.
Shares, Margin, CFD's, Futures and Forex
EOD and Realtime
Dividends and Trust Distributions
And Much More ....
WiseTrader Toolbox
#1 Selling Amibroker Plugin featuring:
Advanced Adaptive Indicators
Advanced Pattern Exploration
Neural Networks
And Much More ....
free guys buy sell signal for Amibroker (AFL)
Copy & Paste Friendly
Back
_SECTION_BEGIN("Chart Settings"); //-- Modified by Kelvinhand V1. SetChartOptions(0,chartShowArrows|chartShowDates); SetChartBkColor(ParamColor("Outer Panel",colorBlack)); SetChartBkGradientFill(ParamColor("Upper Chart",colorDarkTeal),ParamColor("Lower Chart",colorBlack)); GraphXSpace=Param("GraphXSpace",10,0,100,1); dec = (Param("Decimals",2,0,7,1)/10)+1; bi = BarIndex(); Lbi = LastValue(BarIndex()); sbi = SelectedValue(bi); x1= BarCount-1; Title = EncodeColor(colorWhite)+ Title = Name () + " | " +EncodeColor(colorYellow) + Date() + " | " +EncodeColor(colorTurquoise)+ "O : "+ EncodeColor(colorLightGrey)+ O + " | " +EncodeColor(colorTurquoise)+ "H : "+ EncodeColor(colorLightGrey)+ H + " | " +EncodeColor(colorTurquoise)+ "L : "+ EncodeColor(colorLightGrey)+ L + " | " +EncodeColor(colorTurquoise)+ "C : "+ WriteIf(C> Ref(C, -1),EncodeColor(colorBrightGreen),EncodeColor(colorRed))+ C + " | " +EncodeColor(colorTurquoise)+ "Change : ("+ WriteIf(C> Ref(C, -1),EncodeColor(colorBrightGreen),EncodeColor(colorRed)) + WriteVal(C-Ref(C,-1))+" " +EncodeColor(colorTurquoise)+ " /"+ WriteIf(C> Ref(C, -1),EncodeColor(colorBrightGreen),EncodeColor(colorRed))+ WriteVal( ROC( C, 1 ))+""+ " % " +EncodeColor(colorTurquoise)+ ") | Volume : " + WriteIf(V> Ref(V, -1),EncodeColor(colorBrightGreen),EncodeColor(colorRed))+ WriteVal(V,1) ; _SECTION_END(); _SECTION_BEGIN( "Draw Display Panels" ); GfxSetBkMode( 1 ); GfxSetTextColor( colorBlue ); GfxSelectSolidBrush( colorDarkTeal ); GfxSelectPen( colorBlue, 1 ); // broader color GfxRectangle(0, 15,203,400); GfxRectangle(202,15,300,400); _SECTION_END(); _SECTION_BEGIN("Daily Pivots"); //-- Modified by Kelvinhand V1. DayH = TimeFrameGetPrice("H", inDaily, -1);// yesterdays high DayL = TimeFrameGetPrice("L", inDaily, -1);//low DayC = TimeFrameGetPrice("C", inDaily, -1);//close DayO = TimeFrameGetPrice("O", inDaily);// current day open HiDay = TimeFrameGetPrice("H", inDaily); LoDay = TimeFrameGetPrice("L", inDaily); PP = (DayH + DayL + DayO + DayO) / 4 ; R1 = (2 * PP) - DayL; S1 = (2 * PP) - DayH; R2 = PP + R1 - S1; S2 = PP + S1 - R1; R3 = R2 + (R1 - PP); S3 = S2 - (PP - S1); style = styleLine | styleThick + styleNoRescale; rcolor = colorBlue; scolor = colorRed; pcolor = colorGreen; Hor = 215; //Param("Horizontal Position",230,10,1200,1); Ver = 200; //Param("Vertical Position",230,10,500); Yoff= 20; //Param("Vertical Offset",30,0,500); IX = Hor; IY = Ver; GfxSelectFont("arial", 9, 700 ); //GfxSetBkMode( colorWhite ); ColorMisc = ParamColor("Pivot Color",colorDarkYellow); ColorRes = ParamColor("Res Color",colorRed); ColorSup = ParamColor("Sup Color",colorGreen); GfxSetTextColor(ColorRes); IY+=Yoff; GfxTextOut("R3: "+r3, IX, IY); IY+=Yoff; GfxTextOut("R2: "+r2, IX, IY); IY+=Yoff; GfxTextOut("R1: "+r1, IX, IY); GfxSetTextColor(ColorMisc); IY+=Yoff; GfxTextOut("PP: "+PP, IX, IY); GfxSetTextColor( ColorSup ); IY+=Yoff; GfxTextOut("S1: "+s1, IX, IY); IY+=Yoff; GfxTextOut("S2: "+s2, IX, IY); IY+=Yoff; GfxTextOut("S3: "+s3, IX, IY); GfxSetTextColor(ColorMisc); IY+=Yoff; GfxTextOut("YH: "+DayH, IX, IY); IY+=Yoff; GfxTextOut("YL: "+DayL, IX, IY); _SECTION_END(); _SECTION_BEGIN("Logo"); //-- Modified by Kelvinhand V1. GfxSelectFont("arial", 8, 700 ); GfxSetBkMode( colorLightBlue ); GfxSetTextColor( ParamColor("Color",colorLightBlue) ); Hor=Param("Horizontal Position",0,10,1200,1); Ver=Param("Vertical Position",385,100,50,50); GfxTextOut(" Edited by : sharemarketclass.com",Hor , Ver ); _SECTION_END(); _SECTION_BEGIN("Flower"); Show_color = ParamToggle("Display CandleColor", "No|Yes", 1); r1 = Param( "ColorFast avg", 5, 2, 200, 1 ); r2 = Param( "ColorSlow avg", 10, 2, 200, 1 ); r3 = Param( "ColorSignal avg", 5, 2, 200, 1 ); Prd1=Param("ATR Period",4,1,20,1); Prd2=Param("Look Back",7,1,20,1); green = HHV(LLV(L,Prd1)+ATR(Prd1),Prd2); red = LLV(HHV(H,Prd1)-ATR(Prd1),Prd2); flowerClose = EMA((Open+High+Low+Close)/4,3) ; flowerOpen = EMA((Ref(Open,-1) + Ref(flowerClose,-1))/2,3); Temp = Max(High, flowerOpen); flowerHigh = EMA(Max(Temp, flowerClose),3); Temp = Min(Low,flowerOpen); flowerLow = EMA(Min(Temp, flowerClose),3); m1=MACD(r1,r2); s1=Signal(r1,r2,r3); ColorHighliter= IIf(m1<0 AND m1>s1, colorYellow, IIf(m1>0 AND m1>s1, colorWhite, IIf(m1>0 AND m1<s1, colorDarkYellow, colorRed))); if(Show_color) SetBarFillColor( ColorHighliter ); barColor=IIf(C>Green ,colorWhite,IIf(C < RED,colorRed,colorWhite)); PlotOHLC( IIf(flowerOpen<flowerClose, flowerOpen, flowerClose),flowerHigh,flowerLow,IIf(flowerOpen<flowerClose, flowerClose, flowerOpen), "Close", barColor, styleNoTitle | styleCandle); _SECTION_END(); _SECTION_BEGIN("Breakout Setting"); Buyperiods=Param("Breakout periods best is usually 18",5,1,100,1,1); Sellperiods=Param("Exit Breakout",5,1,100,1,1); // ----- "Heikin-Ashi" ---- HaClose=flowerClose; HaOpen = flowerOpen;//AMA( Ref( HaClose, -1 ), 0.5 ); HaHigh = flowerHigh;//Max( H, Max( HaClose, HaOpen ) ); HaLow = flowerLow;//Min( L, Min( HaClose, HaOpen ) ); Buy= C>Ref(HHV(High,Buyperiods),-1) ; Sell= C<Ref(LLV(Low,Sellperiods),-1); /* exrem is one method to remove surplus strade signals. It removes excessive signals of arrow */ Buy = ExRem(Buy, Sell); Sell = ExRem(Sell, Buy); PlotShapes( IIf( Buy, shapeSmallUpTriangle, shapeNone ), colorWhite, 0, HaLow, -30); PlotShapes( IIf( Sell, shapeSmallDownTriangle, shapeNone ), colorRed, 0, HaHigh, -30); _SECTION_END(); _SECTION_BEGIN("Bands"); //-- Modified by Kelvinhand V1. SupResB =Param("Sup-Res Short",6,0,100,1); nn=SupResB; Bandlinecol=ParamColor("SupResLineColor",ColorRGB(82,82,82)); ParmCloud = ParamToggle("Cloud", "No|Yes", 0); BoxCloudColor=ParamColor("BoxCloudColor",ColorRGB(27,27,27)); Line2=Param("ResLineLength",100,2,500,0.1); Daysback1 = Line2; FirstBar1 = BarCount - DaysBack1; Hh=HHV(flowerHigh,nn); LL=LLV(flowerLow,nn); Res2=Hh; Sup2=LL; BandRes=IIf(BarIndex() >= Firstbar1,EndValue(Res2),Null); BandSup=IIf(BarIndex() >= Firstbar1,EndValue(Sup2),Null); Plot(BandRes,"",Bandlinecol,ParamStyle("ShortSupBand",styleLine|styleDashed|stylehidden|styleNoTitle|styleNoLabel|styleThick,maskAll)); Plot(BandSup,"",Bandlinecol,ParamStyle("ShortResBand",styleLine|styleDashed|stylehidden|styleNoTitle|styleNoLabel|styleThick,maskAll)); CS=BandRes; CR=BandSup; if(parmCloud == 1) PlotOHLC( CS, CS, CR,CR, "Band",BoxCloudColor, styleCloud | styleNoLabel|styleNoTitle); _SECTION_END(); /* -- Lord of the Ring ---- */ _SECTION_BEGIN("PFE: Ring7"); //--Ring 7th //-- Modified by Kelvinhand V1. pds=10; x=sqrt((ROC(C,9)*ROC(C,9))+100); y=Sum(sqrt((ROC(C,1)* ROC(C,1))+1),pds); z=(x/y); pfe=EMA(IIf(C>Ref(C,-9),z,-z)*100,5); result = WriteIf(pfe >10 AND pfe>Ref(pfe,-1),"Up", WriteIf(pfe <-10 AND pfe<Ref(pfe,-1), "Dn", "")); Color = IIf(result=="Up", ColorRGB(0,90,0), IIf(result=="Dn", ColorRGB(90,0,0), colorDarkTeal)); GfxSetBkMode( 1 ); GfxSelectSolidBrush( Color); GfxSelectPen( colorBlue, 1 ); // broader color GfxCircle( 100,100,70 ); RequestTimedRefresh( 0 ); _SECTION_END(); _SECTION_BEGIN("Schaff Trend Cycle: Ring6"); //--Ring 6th /* Ported directly from original STC Tradestation code results differ from other Amibroker versions that are not based directly on original EasyLanguage code http://mediaserver.fxstreet.com/Reports/99afdb5f-d41d-4a2c-802c-f5d787df886c/ebfbf387-4b27-4a0f-848c-039f4ab77c00.pdf */ MA1=23; MA2=50; TCLen=10; MA1=Param("ShortMACDLen",23,5,36); MA2=Param("LOngMACDLen",50,10,100); TCLen=Param("TCLen(StochPeriod)",10,5,20); Factor=.5; //Calculate a MACD Line XMac = MACD(MA1,MA2) ; // MACD in Amibroker always uses Close for MACD calculation //1st Stochastic: Calculate Stochastic of a MACD Value1 = LLV(XMac, TCLen); Value2 = HHV(XMac, TCLen) - Value1; //Frac1=1; // prime Frac1 to a default of 1 //Frac1 = IIf(Value2 > 0, ((XMac - Value1) / Value2) * 100, Ref(FRAC1,-1)); // have to "prime" first value so that reference to "i-1" does not result in subscript out of range // since MACD for both periods is not defined until MA2 period, 0 seems to be mathematically correct priming value frac1=0; for (i = 1; i < BarCount; i++) if (Value2[i] > 0) frac1[i] = ((XMac[i] - Value1[i])/Value2[i])*100; else frac1[i]= frac1[i-1]; //Smoothed calculation for %FastD of MACD PF[0]=frac1[0]; PF[1]=frac1[1]; for (i = 2; i < BarCount; i++) PF[i]=PF[i-1]+(Factor*(frac1[i]-PF[i-1])); //2nd Stochastic: Calculate Stochastic of Smoothed Percent FastD, above. Value3 = LLV(PF, TCLen); Value4 = HHV(PF, TCLen) - Value3; //%FastK of PF /* Frac2=1; Frac2 = IIf(Value4 > 0, ((PF - Value3) / Value4) * 100, Ref(FRAC2,-1)); */ frac2[0]=0; for (i = 1; i < BarCount; i++) if (Value4[i] > 0 ) frac2[i]=((PF[i] - Value3[i])/Value4[i])*100; else frac2[i]=frac2[i-1]; //Smoothed calculation for %FastD of PF PFF[0]=frac2[0]; PFF[1]=frac2[1]; for (i = 2; i < BarCount; i++) PFF[i]=PFF[i-1]+(Factor*(frac2[i]-PFF[i-1])); result = WriteIf( pff >98,"Up", WriteIf( pff <2, "Dn", "")); Color = IIf(result=="Up", ColorRGB(0,120,0), IIf(result=="Dn", ColorRGB(120,0,0), colorDarkTeal)); GfxSetBkMode( 1 ); GfxSelectSolidBrush( Color ); GfxCircle( 100,100,60 ); RequestTimedRefresh( 0 ); _SECTION_END(); _SECTION_BEGIN("RSI: Ring5"); // Ring 5th iRSI= RSI(7); result = WriteIf( iRSI>70,"Up", WriteIf( iRSI<30,"Dn", "")); Color = IIf(result=="Up", ColorRGB(0,150,0), IIf(result=="Dn", ColorRGB(150,0,0), colorDarkTeal)); GfxSetBkMode( 1 ); GfxSelectSolidBrush( Color ); GfxSelectPen( colorBlue, 1 ); // broader color GfxCircle( 100,100,50 ); RequestTimedRefresh( 0 ); _SECTION_END(); _SECTION_BEGIN("Rays: Ring4"); Pp1=3; Pp2=2; CS33=HHV(LLV(flowerHigh,Pp1)-ATR(Pp2),4); CR33=HHV(LLV(flowerHigh,Pp1)-ATR(Pp2),5); Result = WriteIf(flowerClose> CS33,"Up", WriteIf(CS33>flowerClose ,"Dn", "")); Color = IIf(result=="Up", ColorRGB(0,180,0), IIf(result=="Dn", ColorRGB(180,0,0), colorDarkTeal)); GfxSetBkMode( 1 ); GfxSelectSolidBrush( Color); GfxSelectPen( colorBlue, 1 ); // broader color GfxCircle( 100,100,40 ); _SECTION_END(); _SECTION_BEGIN("Entry_Exit_Sig: Ring3"); EntrylookbackPeriod=10; EntryATRperiod=1.9; EntrySig = C > ( LLV( flowerLow, EntrylookbackPeriod ) + EntryATRperiod * ATR( 10 ) ); ExitSig = C < ( HHV( flowerHigh, EntrylookbackPeriod ) -EntryATRperiod * ATR( 10 ) ); result = WriteIf( EntrySig,"Entry", WriteIf( ExitSig,"Exit", "")); Color = IIf(result=="Entry", ColorRGB(0,210,0), IIf(result=="Exit", ColorRGB(210,0,0), colorDarkTeal)); GfxSetBkMode( 1 ); GfxSelectSolidBrush( Color ); GfxSelectPen( colorBlue, 1 ); // boarder color GfxCircle( 100,100,30 );// changing the value of x,y,rad x-70, y-90, rad-24 RequestTimedRefresh( 0 ); _SECTION_END(); _SECTION_BEGIN("CCI9: Ring2"); result = WriteIf( CCI(9)>0,"Up", WriteIf( CCI(8)<0,"Dn", "")); Color = IIf(result=="Up", ColorRGB(0,240,0), IIf(result=="Dn", ColorRGB(240,0,0), colorDarkTeal)); GfxSetBkMode(1); GfxSelectSolidBrush( Color ); GfxSelectPen( colorBlue, 1 ); // broader color GfxCircle( 100,100,20); RequestTimedRefresh( 0 ); _SECTION_END(); _SECTION_BEGIN("%BB7: Ring1"); p=7; x=((C+2*StDev(C,p)-MA(C,p))/(4*StDev(C,p)))*100; result = WriteIf( x > 40,"Up", WriteIf( x < 40,"Dn", "")); Color = IIf(result=="Up", ColorRGB(62,255,62), IIf(result=="Dn", ColorRGB(255,62,62) , colorDarkTeal)); GfxSetBkMode( 1 ); GfxSelectSolidBrush( Color); GfxSelectPen( colorBlue, 1 ); // broader color GfxCircle( 100,100,10 ); RequestTimedRefresh( 0 ); _SECTION_END(); /* --- Rectangle */ _SECTION_BEGIN("MACD Bull/Bear"); r1 = Param( "Fast Avg", 12, 2, 200, 1 ); r2 = Param( "Slow Avg", 26, 2, 200, 1 ); r3 = Param( "Signal Avg", 9, 2, 200, 1 ); m1=MACD(r1,r2); s1=Signal(r1,r2,r3); GfxSetBkMode( 1 ); GfxSelectPen( colorBlue, 1 ); GfxSelectSolidBrush( colorDarkTeal ); GfxRectangle(80, 220,120,280); GfxRectangle(120,315,180,280); GfxRectangle(20, 315,80, 280); GfxRectangle(80, 375,120,315); //-- 1. North: Strong Bull => M&S above 0, M>S //-- 2. East: Weak Bull => M<0 but M>S //-- 3. West: Weak Bear => M>0 but M<S //-- 4. South: Strong Bear => M<0 but M<S Dir = WriteIf(m1>0 AND m1>s1, "N", WriteIf(m1<0 AND m1>s1, "E", WriteIf(m1>0 AND m1<s1, "W", WriteIf(m1<0 AND m1<s1, "S", "")))); if (Dir=="N") { GfxSelectSolidBrush( ColorRGB(0,147,0)); GfxRectangle(80,220,120,280); } else if (Dir=="E") { GfxSelectSolidBrush( ColorRGB(0,147,0)); GfxRectangle(120,315,180,280); } else if (Dir=="W") { GfxSelectSolidBrush( ColorRGB(225,0,0)); GfxRectangle(20,315,80,280); } else if (Dir=="S") { GfxSelectSolidBrush( ColorRGB(225,0,0)); GfxRectangle(80,375,120,315); } //--Bear trendline GfxSelectPen( colorRed, 1 ); GfxMoveTo( 25,320 ); GfxLineTo( 75, 370 ); //SW //--Bull trendline GfxSelectPen( colorGreen, 1 ); GfxMoveTo( 125,225 ); GfxLineTo( 175, 275 ); //NE RequestTimedRefresh( 0 ); _SECTION_END(); _SECTION_BEGIN("Spiker"); 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)); // 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); uv = gv + bv; uv1 = Ref(uv, -1); // up volume dv = rv + yv; dv1 = Ref(dv, -1); // down volume VolPer = Param("Adjust Vol. MA per.", 10, 1, 255, 1); ConvPer = Param("Adjust Conv. MA per.", 4, 1, 255, 1); MAuv = TEMA(uv, VolPer ); mauv1 = Ref(mauv, -1); MAdv = TEMA(dv, VolPer ); madv1 = Ref(madv, -1); MAtv = TEMA(V, VolPer );//total volume Converge = (TEMA(MAuv - MAdv, ConvPer)); Converge1 = Ref(Converge, -1); ConvergeUp = Converge > Converge1; ConvergeOver = Converge > 0; rising = ConvergeUp AND ConvergeOver; falling = !ConvergeUp AND ConvergeOver; GfxSelectSolidBrush( colorDarkTeal ); GfxRoundRect(240,30,260,200,20,20); //Tube Top GfxSelectSolidBrush( colorDarkTeal ); GfxCircle( 250,180,23 ); result = WriteIf( rising,"ab", WriteIf( falling,"cd", WriteIf( Converge>0,"ef", ""))); GfxSetBkMode( 1 ); if ( result =="ab") { GfxSelectSolidBrush( ColorRGB(0,147,0) ); GfxSelectPen( colorGreen, 1 ); } else if ( result =="cd") { GfxSelectSolidBrush( ColorRGB(0,85,0) ); GfxSelectPen( colorDarkGreen, 1 ); } else { GfxSelectSolidBrush( ColorRGB(255,0,0) ); GfxSelectPen( colorRed, 1 ); } GfxRectangle(241,50,259,200); //Tube Neck GfxCircle(250,180,22 ); //Tube Bottom RequestTimedRefresh( 0 ); _SECTION_END(); _SECTION_BEGIN("fuctions"); function xMA(Type,P,Periods) { m = 0; if( Type == "Weighted" ) m= WMA( P, Periods ); if( Type == "Lagless-21" ) m= 2*EMA(P, Periods)-EMA(EMA(P, Periods), Periods); if( Type == "Hull-26" ) m= WMA(2*(WMA(P, Periods/2))-WMA(P, Periods) ,4 ); if( Type == "Linear Regression-45" ) m= LinearReg( P, Periods ); if( Type == "Exponential" ) m = EMA( P, Periods ); if( Type == "Double Exponential" ) m = DEMA( P, Periods ); if( Type == "Tripple Exponential" ) m = TEMA( P, Periods ); if( Type == "Wilders" ) m = Wilders( P, Periods ); if( Type == "Simple" ) m = MA( P, Periods ); return m; } _SECTION_END(); _SECTION_BEGIN("MA1"); Type = ParamList("Type", "Weighted,Lagless-21,Hull-26,Linear Regression-45,Exponential,Double Exponential,Tripple Exponential,Wilders,Simple"); Periods = Param("Periods", 20, 2, 200 ); Displacement = Param("Displacement", 1, -50, 50 ); Plot( xMA(Type,HaClose,Periods), _DEFAULT_NAME(), ParamColor("Color", colorBlack),ParamStyle("Style",styleLine |styleThick|styleNoTitle ,maskAll),Displacement ); _SECTION_END(); _SECTION_BEGIN("MA2"); Type = ParamList("Type", "Weighted,Lagless-21,Hull-26,Linear Regression-45,Exponential,Double Exponential,Tripple Exponential,Wilders,Simple"); Periods = Param("Periods", 60, 2, 200 ); Displacement = Param("Displacement", 1, -50, 50 ); Plot( xMA(Type,HaClose,Periods), _DEFAULT_NAME(), ParamColor("Color", colorBlack),ParamStyle("Style",styleLine |styleNoTitle ,maskAll),Displacement ); _SECTION_END(); _SECTION_BEGIN("MA3"); Type = ParamList("Type", "Weighted,Lagless-21,Hull-26,Linear Regression-45,Exponential,Double Exponential,Tripple Exponential,Wilders,Simple"); Periods = Param("Periods", 120 ,2, 200 ); Displacement = Param("Displacement", 1, -50, 50 ); Plot( xMA(Type,HaClose,Periods), _DEFAULT_NAME(), ParamColor("Color", colorBlack),ParamStyle("Style",styleLine |styleNoTitle ,maskAll),Displacement ); _SECTION_END(); _SECTION_BEGIN("MA4"); Type = ParamList("Type", "Weighted,Lagless-21,Hull-26,Linear Regression-45,Exponential,Double Exponential,Tripple Exponential,Wilders,Simple"); Periods = Param("Periods", 180, 2, 800 ); Displacement = Param("Displacement", 1, -50, 50 ); Plot( xMA(Type,HaClose,Periods), _DEFAULT_NAME(), ParamColor("Color", ColorRGB(40,40,40)),ParamStyle("Style",styleLine |styleNoTitle ,maskAll),Displacement ); _SECTION_END(); _SECTION_BEGIN("TrendLine"); farback=Param("How Far back to go",100,50,5000,10); nBars = Param("Number of bars", 12, 5, 40); aHPivs = H - H; aLPivs = L - L; aHPivHighs = H - H; aLPivLows = L - L; aHPivIdxs = H - H; aLPivIdxs = L - L; nHPivs = 0; nLPivs = 0; lastHPIdx = 0; lastLPIdx = 0; lastHPH = 0; lastLPL = 0; curPivBarIdx = 0; aHHVBars = HHVBars(H, nBars); aLLVBars = LLVBars(L, nBars); aHHV = HHV(H, nBars); aLLV = LLV(L, nBars); aVisBars = Status("barvisible"); nLastVisBar = LastValue(Highest(IIf(aVisBars, BarIndex(), 0))); _TRACE("Last visible bar: " + nLastVisBar); curBar = (BarCount-1); curTrend = ""; if (aLLVBars[curBar] < aHHVBars[curBar]) curTrend = "D"; else curTrend = "U"; for (i=0; i<farback; i++) { curBar = (BarCount - 1) - i; if (aLLVBars[curBar] < aHHVBars[curBar]) { if (curTrend == "U") { curTrend = "D"; curPivBarIdx = curBar - aLLVBars[curBar]; aLPivs[curPivBarIdx] = 1; aLPivLows[nLPivs] = L[curPivBarIdx]; aLPivIdxs[nLPivs] = curPivBarIdx;nLPivs++;} } else { if (curTrend == "D") { curTrend = "U"; curPivBarIdx = curBar - aHHVBars[curBar]; aHPivs[curPivBarIdx] = 1; aHPivHighs[nHPivs] = H[curPivBarIdx]; aHPivIdxs[nHPivs] = curPivBarIdx;nHPivs++; } } } curBar = (BarCount-1); candIdx = 0; candPrc = 0; lastLPIdx = aLPivIdxs[0]; lastLPL = aLPivLows[0]; lastHPIdx = aHPivIdxs[0]; lastHPH = aHPivHighs[0]; if (lastLPIdx > lastHPIdx) { candIdx = curBar - aHHVBars[curBar]; candPrc = aHHV[curBar]; if (lastHPH < candPrc AND candIdx > lastLPIdx AND candIdx < curBar) { aHPivs[candIdx] = 1; for (j=0; j<nHPivs; j++) { aHPivHighs[nHPivs-j] = aHPivHighs[nHPivs-(j+1)]; aHPivIdxs[nHPivs-j] = aHPivIdxs[nHPivs-(j+1)]; } aHPivHighs[0] = candPrc ; aHPivIdxs[0] = candIdx;nHPivs++; } } else { candIdx = curBar - aLLVBars[curBar]; candPrc = aLLV[curBar]; if (lastLPL > candPrc AND candIdx > lastHPIdx AND candIdx < curBar) { aLPivs[candIdx] = 1; for (j=0; j<nLPivs; j++) { aLPivLows[nLPivs-j] = aLPivLows[nLPivs-(j+1)]; aLPivIdxs[nLPivs-j] = aLPivIdxs[nLPivs-(j+1)]; } aLPivLows[0] = candPrc; aLPivIdxs[0] = candIdx;nLPivs++;}} for (k=0; k<nHPivs; k++) { _TRACE("High pivot no. " + k+ " at barindex: " + aHPivIdxs[k] + ", "+ WriteVal(ValueWhen(BarIndex()==aHPivIdxs[k],DateTime(), 1), formatDateTime)+ ", " + aHPivHighs[k]); } a1=ahpivs==1;a2=alpivs==1; x = Cum(1);s1=L;s11=H;pS = a2 == 1; endt= SelectedValue(ValueWhen( pS, x, 1 )); startt=SelectedValue(ValueWhen( pS, x, 2 )); dtS =endt-startt; endS = SelectedValue(ValueWhen( pS, s1, 1 ) ); startS = SelectedValue( ValueWhen( pS, s1, 2 )); aS = (endS-startS)/dtS; bS = endS; trendlineS = aS * ( x -endt ) + bS; g3= IIf(x>startt-10,trendlineS,-1e10); pR = a1== 1;endt1= SelectedValue(ValueWhen( pR, x, 1 )); startt1=SelectedValue(ValueWhen( pR, x, 2 )); dtR =endt1-startt1;endR = SelectedValue(ValueWhen( pR, s11, 1 ) ); startR = SelectedValue( ValueWhen( pR, s11, 2 )); aR = (endR-startR)/dtR;bR = endR; trendlineR = aR * ( x -endt1 ) + bR; g4= IIf(x>startT1-10,trendlineR,-1e10); //_SECTION_END(); //_SECTION_BEGIN("DrawTL_AToB"); result = WriteIf( g3>C,"Dn", WriteIf( g3<C,"Up", "")); if (result =="Dn") GfxSelectSolidBrush( ColorRGB(255,0,0) ); else if (result =="Up") GfxSelectSolidBrush( ColorRGB(0,147,0) ); GfxSetBkMode( 1 ); GfxSelectPen( colorWhite, 1 ); GfxCircle( 30,229,8 ); //Connector A GfxCircle( 168,367,8 ); //Connector B GfxMoveTo( 35,234 ); //Line A to B GfxLineTo( 163, 362 ); RequestTimedRefresh( 0 ); _SECTION_END(); _SECTION_BEGIN("traing sl"); 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; } per = Param("per",20, 1, 150, 1); multBull = Param("multBull",2, 1, 4, 0.05); multBear = Param("multBear",2, 1, 4, 0.05); trBull = multBull * ATR(per); trBear = multBear * ATR(per); trailArray = vstop_func(trBull,trBear); s0=trailArray; s1= s0 > C ; s2= s0 <C ; ccresult1 = WriteIf( s1,"cu", ""); ccresult2 = WriteIf( s2,"cd", ""); GfxSelectFont("arial", 13, 700 ); GfxSetBkMode( colorRed); GfxSetTextColor( ParamColor("Color",colorRed) ); Hor=Param("Horizontal Position",30,10,1200,1); Ver=Param("Vertical Position",185,100,50,50); if ( ccresult1 =="cu") { GfxTextOut(""+s0,Hor , Ver ); } else GfxSelectFont("arial", 13, 700 ); GfxSetBkMode( colorGreen ); GfxSetTextColor( ParamColor("Color",colorGreen) ); Hor=Param("Horizontal Position",75,10,1200,1); Ver=Param("Vertical Position",185,100,50,50); if ( ccresult2 =="") { GfxTextOut(""+s0,Hor , Ver ); } _SECTION_END(); _SECTION_BEGIN("traing s2"); s0=trailArray; ccresult1 = WriteIf( s0 > C ,"cu", WriteIf( s0 <C,"cd", "")); GfxSelectFont("arial", 13, 700 ); GfxSetBkMode( colorBrightGreen ); GfxSetTextColor( ParamColor("Color",colorBrightGreen) ); Hor=Param("Horizontal Position",30,10,1200,1); Ver=Param("Vertical Position",185,100,50,50); if ( ccresult1 =="cd") GfxTextOut(""+s0,Hor , Ver ); else GfxSelectFont("arial", 13, 700 ); GfxSetBkMode( colorWhite ); GfxSetTextColor( ParamColor("Color",colorWhite) ); Hor=Param("Horizontal Position",75,10,1200,1); Ver=Param("Vertical Position",185,100,50,50); if ( ccresult1 =="") GfxTextOut(""+s0,Hor , Ver ); _SECTION_END(); _SECTION_BEGIN("GFXClosePrice"); GfxSelectFont("arial", 13, 700 ); GfxSetBkMode( colorWhite ); GfxSetTextColor( ParamColor("Color",colorWhite) ); Hor=Param("Horizontal Position",120,10,1200,1); Ver=Param("Vertical Position",185,100,50,50); GfxTextOut(""+C,Hor , Ver ); _SECTION_END(); _SECTION_BEGIN("Buy/Sell Circle"); GfxSetBkMode( 1 ); GfxSelectPen( colorBlue, 1 ); //-- Buy Circle on Top Left, Sell Circle on Top Right on Panel 1 ColorBuy = IIf(ccresult2 =="cd", colorLime, ColorRGB(0,0,94)); GfxSelectSolidBrush( ColorBuy ); GfxCircle( 20,40,7 ); ColorSell = IIf(ccresult1 =="cu", colorRed, ColorRGB(0,0,94)); GfxSelectSolidBrush( ColorSell); GfxCircle( 180,40,7 ); _SECTION_END(); //-- Modified by Nagaraj 2014 SetChartBkGradientFill( ParamColor("BgTop", ColorRGB( 31,31,31 )),ParamColor("BgBottom", ColorRGB( 0,0,0 )),ParamColor("titleblock",ColorRGB( 0,0,0 )));uptrend=PDI()>MDI()AND Signal()<MACD();downtrend=MDI()>PDI()AND Signal()>MACD();Plot( 3, "",IIf( uptrend, colorGreen, IIf( downtrend, colorRed, 0 )),styleOwnScale|styleArea|styleNoLabel, -0.10, 100 );_SECTION_END(); DayH = SelectedValue(TimeFrameGetPrice("H", inDaily));// yesterdays high DayL = SelectedValue(TimeFrameGetPrice("L", inDaily));//low DayH1 = SelectedValue(TimeFrameGetPrice("H", inDaily, -1));// yesterdays high DayL1 = SelectedValue(TimeFrameGetPrice("L", inDaily, -1));//low DayH2 = SelectedValue(TimeFrameGetPrice("H", inDaily, -2));// yesterdays high DayL2 = SelectedValue(TimeFrameGetPrice("L", inDaily, -2));//low Range = ((DayH +DayH1 +DayH2)/3 - (DayL+DayL1+DayL2)/3); sr3= (Range *0.702)+DayL; sr4= DayH-(Range *0.655); style = styleLine | styleNoRescale|styleLine; Plot(sr3, "SR3",colorGreen , styleLine|styleNoRescale|styleThick); Plot(sr4, "SR4",colorRed ,styleLine|styleNoRescale|styleThick); //Magfied Market Price FS=Param("Font Size",20,11,100,1); GfxSelectFont("Arial", 18, 700, True ); GfxSetBkMode( colorWhite ); GfxSetTextColor( ParamColor("Color",colorWhite) ); Hor=Param("Horizontal Position",470,1,1200,1); Ver=Param("Vertical Position",12,1,830,1); GfxTextOut(""+C, Hor , Ver ); YC=TimeFrameGetPrice("C",inDaily,-1); DD=Prec(C-YC,2); _SECTION_BEGIN("Support & Resistance"); //Support and resistance levels using RSI. //graham Kavanagh May 2003 //Load into Indicator Builder //Sensitivity of the levels can be changed with the variables //Can test different numbers live with the Param function ctrl-R with open pane RSIperiod = 5; // Param("RSI p",3,14,30,1); Percent = 5; // Param("ZIG %",8,9,15,1); EMAperiod = 5; //Param("EMA p",4,5,10,1); HHVperiod = 5; //Param("HHV p",3,5,10,1); NumLine = 1; //Param("Num Lines",3,1,20,1); Base = DEMA(RSI(RSIperiod),EMAperiod); GraphXSpace=0.5; Plot(C,"",colorGrey40,styleLine); for( i = 1; i <= numline; i++ ) { ResBase = LastValue(Peak(Base,Percent,i)); SupBase = LastValue(Trough(Base,Percent,i)); Filter2 = Param ("filter",2,0,20,0.5); up = ValueWhen( ResBase==Base, HHV(H,HHVperiod))+Filter2; down = ValueWhen( supbase==Base, LLV(L,HHVperiod) )-Filter2; Plot(up , "Resist Level", colorRed, styleLine); Plot(down, "Support Level", colorGreen, styleLine); } Title = Name() + "; " + Date() + ": Support & Resistance Levels using RSI: " + /*EncodeColor(colorGreen)+ "Support Levels are Green; "+EncodeColor(colorRed)+ "Resistance Levels are Red: "+EncodeColor(colorBlack)+*/ "Num lines ="+WriteVal(numline,1) ; _SECTION_END(); _SECTION_BEGIN("Nagaraj system"); P = ParamField( "Price field" ); //T3MA toggle T3MAT=ParamToggle("Moving Average","No|Yes",defaultval=1 ); //T3MA Check Periods T3MAP = Param("T3MA Periods", 21, 2, 300, 1, 10 ); function T3(price,periods) { s = 0.84; e1=EMA(price,periods); e2=EMA(e1,Periods); e3=EMA(e2,Periods); e4=EMA(e3,Periods); e5=EMA(e4,Periods); e6=EMA(e5,Periods); c1=-s*s*s; c2=3*s*s+3*s*s*s; c3=-6*s*s-3*s-3*s*s*s; c4=1+3*s+s*s*s+3*s*s; Ti3=c1*e6+c2*e5+c3*e4+c4*e3; return ti3; } T3MA = T3(P,T3MAP); for( i = 1; i < BarCount; i++ ) { //assignments NvadaOpen[i] = Close[i-1]; NvadaClose[i]=Close[i]; NvadaHigh[i]=IIf(NvadaOpen[i]>=NvadaClose[i],NvadaOpen[i],NvadaClose[i]); NvadaLow[i]=IIf(NvadaOpen[i]>=NvadaClose[i],NvadaClose[i],NvadaOpen[i]); averagechange[i]=(NvadaOpen[i]+NvadaClose[i])/2; //============================= //CHECKS //check1= uptrend and upbar as referred for last 2 bars Check1[i]=averagechange[i]>T3MA[i] AND NvadaClose[i]>=NvadaOpen[i-2]; //check2= uptrend and downbar as referred for last 2 bars Check2[i]=averagechange[i]>T3MA[i] AND NvadaClose[i]<NvadaOpen[i-2]; //check3= downtrend and downbar as referred for last 2 bars Check3[i]=averagechange[i]<T3MA[i] AND NvadaClose[i]<=NvadaOpen[i-2]; //check4= downtrend and upbar as referred for last 2 bars Check4[i]=averagechange[i]<T3MA[i] AND NvadaClose[i]>NvadaOpen[i-2]; //check5=check2 or check 4 => possible corrections! Check5[i]=Check2[i] OR Check4[i]; //Color assignment if(Check1[i]==1){pricolor[i] =colorGreen;} if(Check3[i]==1){pricolor[i] =colorRed;} if(Check5[i]==1){pricolor[i] =colorYellow;} //Pricolor = IIf(NvadaClose>Ref(NvadaOpen,-2),colorGreen,colorRed); } //T3MA Display if(T3MAT==1) { T3MAcolor = IIf(C>=T3MA,colorGreen,colorRed); Plot(T3MA,"T3MA",T3MAcolor,styleThick); } _SECTION_END(); //Candles or bars colored by trend //identifying trends with EMA and MACD Period = Optimize("Period", 17, 2, 200, 1); EMACALC = EMA(C, Period); cond1 = Close > EMACALC AND MACD() > Signal(); cond2 = Close > EMACALC AND MACD() < Signal() OR Close < EMACALC AND MACD() > Signal(); cond3 = Close < EMACALC AND MACD() < Signal(); //============== TITLE ============== Plot(EMACALC, "EMACALC", colorBlack, styleLine,0,0,0,0,2); _SECTION_BEGIN("Suri-FibBands"); //******************************************Suri-FibBands***********************// MALength = Param("MALength",100,0,100,1); //MALength=100; mov = MA(Close,MALength); tr = MA(ATR(14)*1.3, MALength); upperBand1 = mov+4.62*tr; upperBand2 = mov+2.62*tr; upperBand3 = mov+1.62*tr; lowerBand1 = mov-1.62*tr; lowerBand2 = mov-2.62*tr; lowerBand3 = mov-4.62*tr; Plot(upperBand1 ,"ProfitStop",colorGreen,styleDashed); Plot(upperBand2 ,"ProfitStop",colorGreen,styleDashed); Plot(upperBand3 ,"ProfitStop",colorGreen,styleDashed); Plot(mov ,"ProfitStop",colorLightGrey,styleDashed); Plot(lowerBand1 ,"ProfitStop",colorRed,styleDashed); Plot(lowerBand2 ,"ProfitStop",colorRed,styleDashed); Plot(lowerBand3 ,"ProfitStop",colorRed,styleDashed); Plot(C ,"Price",colorBlack,styleDashed); _SECTION_END(); _SECTION_BEGIN("FIBONACCI HIGH PROBABILITY ZONES"); ShowFibHiProbZone=ParamToggle("Show FIb High-Probability Zone","No|Yes",1); HpzColor = ParamColor("Line Color",colorBlack); Periodicity = inDaily; if(ShowFibHiProbZone AND Interval()<inHourly) { Periodicity = inDaily; } else if(ShowFibHiProbZone AND Interval()==inHourly) { Periodicity = inWeekly; } else if (ShowFibHiProbZone AND Interval()>=inDaily AND Interval()<inMonthly) { Periodicity = inMonthly; } else if(ShowFibHiProbZone AND Interval()>inWeekly AND Interval()<inYearly) { Periodicity = inYearly; } else // Default just to silence the compiler. This will never occur. { Hi=Ref(H,-1); Lo=Ref(L,-1); Cl=Ref(C,-1); } Hi=TimeFrameGetPrice("H",Periodicity,-1); Lo=TimeFrameGetPrice("L",Periodicity ,-1); Cl=TimeFrameGetPrice("C",Periodicity ,-1); p=(Hi+Lo+Cl)/3; r1=p+((Hi-Lo)/2); s1=p-((Hi-Lo)/2); r2=p+(Hi-Lo); s2=p-(Hi-Lo); //Bands s1b=((Hi-Lo)*0.618)-p; s2b=((Hi-Lo)*1.382)-p; r1b=((Hi-Lo)*0.618)+p; r2b=((Hi-Lo)*1.382)+p; extnd=0; sty=styleNoLabel|styleStaircase|styleDashed|styleNoRescale; Plot(r1-extnd,"",HpzColor ,sty,Null,Null,extnd,1000); //PlotOHLC(r1,r1,r1b,r1b,"",Col,sty|styleClipMinMax|styleCloud|styleNoLine,Null,Null,extnd,1000); Plot(s1-extnd,"",HpzColor ,sty,Null,Null,extnd,1000); //PlotOHLC(s1,s1b,s1,s1b,"",Col,sty|styleClipMinMax|styleCloud|styleNoLine,Null,Null,extnd,1000); Plot(p-extnd,"",HpzColor ,styleNoLabel|styleStaircase|styleNoRescale,Null,Null,extnd,1000); Plot(r2-extnd,"",HpzColor ,sty,Null,Null,extnd,1000); Plot(s2-extnd,"",HpzColor ,sty,Null,Null,extnd,1000); //Daily Range Hi Lo //Plot(Hi-extnd,"",ColorBlend(colorLime,colorBrightGreen) ,styleNoLabel|styleStaircase|styleNoRescale,Null,Null,extnd,1000); //Plot(Lo-extnd,"",ColorBlend(colorCustom12,colorRed) ,styleNoLabel|styleStaircase|styleNoRescale,Null,Null,extnd,1000); _SECTION_END(); _SECTION_BEGIN("NagarajSwing"); no=Param( "Swing", 20, 1, 100,1 ); res=HHV(H,no); sup=LLV(L,no); avd=IIf(C>Ref(res,-1),1,IIf(C<Ref(sup,-1),-1,0)); avn=ValueWhen(avd!=0,avd,1); tsl=IIf(avn==1,sup,res); Plot(tsl, _DEFAULT_NAME(), colorWhite, styleStaircase); arrows=Cross(C,Ref(res,-1))*shapeNone + Cross(Ref(sup,-1),C)*shapeNone; PlotShapes(arrows,IIf(C>tsl,colorGreen,colorIndigo),0,IIf(Cross(C,Ref(res,-1)),Low,High)); //Scanner mode Buy=Cross(C,Ref(res,-1)); Sell=Cross(Ref(sup,-1),C); _SECTION_END(); DayH = SelectedValue(TimeFrameGetPrice("H", inDaily));// yesterdays high DayL = SelectedValue(TimeFrameGetPrice("L", inDaily));//low DayH1 = SelectedValue(TimeFrameGetPrice("H", inDaily, -1));// yesterdays high DayL1 = SelectedValue(TimeFrameGetPrice("L", inDaily, -1));//low DayH2 = SelectedValue(TimeFrameGetPrice("H", inDaily, -2));// yesterdays high DayL2 = SelectedValue(TimeFrameGetPrice("L", inDaily, -2));//low Range = ((DayH +DayH1 +DayH2)/3 - (DayL+DayL1+DayL2)/3); sr3= (Range *0.702)+DayL; sr4= DayH-(Range *0.655); style = styleLine | styleNoRescale|styleLine; Plot(sr3, "SR3",colorGreen , styleLine|styleNoRescale|styleThick); Plot(sr4, "SR4",colorRed ,styleLine|styleNoRescale|styleThick); //Magfied Market Price FS=Param("Font Size",20,11,100,1); GfxSelectFont("Arial", 18, 700, True ); GfxSetBkMode( colorWhite ); GfxSetTextColor( ParamColor("Color",colorWhite) ); Hor=Param("Horizontal Position",470,1,1200,1); Ver=Param("Vertical Position",12,1,830,1); GfxTextOut(""+C, Hor , Ver ); YC=TimeFrameGetPrice("C",inDaily,-1); DD=Prec(C-YC,2); SetChartBkGradientFill( ParamColor("BgTop", ColorRGB( 31,31,31 )),ParamColor("BgBottom", ColorRGB( 0,0,0 )),ParamColor("titleblock",ColorRGB( 0,0,0 )));uptrend=PDI()>MDI()AND Signal()<MACD();downtrend=MDI()>PDI()AND Signal()>MACD();Plot( 3, "",IIf( uptrend, colorGreen, IIf( downtrend, colorRed, 0 )),styleOwnScale|styleArea|styleNoLabel, -0.10, 100 );_SECTION_END(); DayH = SelectedValue(TimeFrameGetPrice("H", inDaily));// yesterdays high DayL = SelectedValue(TimeFrameGetPrice("L", inDaily));//low DayH1 = SelectedValue(TimeFrameGetPrice("H", inDaily, -1));// yesterdays high DayL1 = SelectedValue(TimeFrameGetPrice("L", inDaily, -1));//low DayH2 = SelectedValue(TimeFrameGetPrice("H", inDaily, -2));// yesterdays high DayL2 = SelectedValue(TimeFrameGetPrice("L", inDaily, -2));//low Range = ((DayH +DayH1 +DayH2)/3 - (DayL+DayL1+DayL2)/3); sr3= (Range *0.702)+DayL; sr4= DayH-(Range *0.655); style = styleLine | styleNoRescale|styleLine; Plot(sr3, "SR3",colorGreen , styleLine|styleNoRescale|styleThick); Plot(sr4, "SR4",colorRed ,styleLine|styleNoRescale|styleThick); //Magfied Market Price FS=Param("Font Size",20,11,100,1); GfxSelectFont("Arial", 18, 700, True ); GfxSetBkMode( colorWhite ); GfxSetTextColor( ParamColor("Color",colorWhite) ); Hor=Param("Horizontal Position",470,1,1200,1); Ver=Param("Vertical Position",12,1,830,1); GfxTextOut(""+C, Hor , Ver ); YC=TimeFrameGetPrice("C",inDaily,-1); DD=Prec(C-YC,2); SetChartBkGradientFill( ParamColor("BgTop", ColorRGB( 31,31,31 )),ParamColor("BgBottom", ColorRGB( 0,0,0 )),ParamColor("titleblock",ColorRGB( 0,0,0 )));uptrend=PDI()>MDI()AND Signal()<MACD();downtrend=MDI()>PDI()AND Signal()>MACD();Plot( 3, "",IIf( uptrend, colorGreen, IIf( downtrend, colorRed, 0 )),styleOwnScale|styleArea|styleNoLabel, -0.10, 100 );_SECTION_END();