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 ....
kamal nazmy 2 for Amibroker (AFL)
Copy & Paste Friendly
Back
_SECTION_BEGIN("CNcP"); Cd1=-(O-C)/(H-L)*100; Cd=Prec((Cd1),2); ColorE=IIf(Cd>=68,colorYellow,IIf(Cd<=-68,colorRed,colorCustom12)); _SECTION_END(); _SECTION_BEGIN("Price"); BarColor = IIf((Cd>=68)OR (Cd<=-68),colorCustom11,colorCustom12); Plot(C, "", BarColor, styleNoTitle| styleThick | styleCandle|styleNoLabel); Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle | styleNoLabel | GetPriceStyle() ); _SECTION_BEGIN("Hull Moving Average"); /* Hull Moving Average (HMA) Author: Alan Hall web site: www.alanhall.com */ //user paramters prmPeriod = Param("Period", 25, 2, 100, 1); prmColor = ParamColor("Color", colorBlue); prmStyle = ParamStyle("Style", styleLine, maskAll); prmField = ParamField("Fields", 3); //calculations HMA = WMA(2 * WMA(prmField,int(prmPeriod/2)) - WMA(prmField,prmPeriod), int(sqrt(prmPeriod))); Temp = Ref(HMA,-1); // paint the chart Plot(HMA,"HMA",prmColor, prmStyle); Plot(Ref(HMA,-1), "Previous", colorCustom11, styleDashed|styleThick); Buy=Cross(HMA,Temp); Sell=Cross(Temp,HMA); PlotShapes( shapeUpArrow * Buy, colorWhite, 0, L, Offset=-50 ); PlotShapes( shapeHollowCircle * Buy, colorWhite, 0, L,Offset=-60 ); PlotShapes( shapeDownArrow * Sell, colorWhite, 0,H, Offset=-50 ); PlotShapes( shapeHollowCircle * Sell, colorWhite, 0, H, Offset=60 ); _SECTION_END(); _SECTION_BEGIN("Pivot_Finder"); /* ********************************** Code to automatically identify pivots for STAR ********************************** */ // -- what will be our lookback range for the hh and ll? farback=Param("How Far back to go",200,0,5000,10); nBars = Param("Number of bars", 5, 5, 40); // -- Create 0-initialized arrays the size of barcount aHPivs = H - H; aLPivs = L - L; // -- More for use, not necessary for basic plotting 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; // -- looking back from the current bar, how many bars // back were the hhv and llv values of the previous // n bars, etc.? aHHVBars = HHVBars(H, nBars); aLLVBars = LLVBars(L, nBars); aHHV = HHV(H, nBars); aLLV = LLV(L, nBars); // -- Would like to set this up so pivots are calculated back from // last visible bar to make it easy to "go back" and see the pivots // this code would find. However, the first instance of // _Trace output will show a value of 0 aVisBars = Status("barvisible"); nLastVisBar = LastValue(Highest(IIf(aVisBars, BarIndex(), 0))); _TRACE("Last visible bar: " + nLastVisBar); // -- Initialize value of curTrend curBar = (BarCount-1); curTrend = ""; if (aLLVBars[curBar] < aHHVBars[curBar]) { curTrend = "D"; } else { curTrend = "U"; } // -- Loop through bars. Search for // entirely array-based approach // in version for (i=0; i<farback; i++) { curBar = (BarCount - 1) - i; // -- Have we identified a pivot? If trend is down... if (aLLVBars[curBar] < aHHVBars[curBar]) { // ... and had been up, this is a trend change if (curTrend == "U") { curTrend = "D"; // -- Capture pivot information curPivBarIdx = curBar - aLLVBars[curBar]; aLPivs[curPivBarIdx] = 1; aLPivLows[nLPivs] = L[curPivBarIdx]; aLPivIdxs[nLPivs] = curPivBarIdx; nLPivs++; } // -- or current trend is up } else { if (curTrend == "D") { curTrend = "U"; curPivBarIdx = curBar - aHHVBars[curBar]; aHPivs[curPivBarIdx] = 1; aHPivHighs[nHPivs] = H[curPivBarIdx]; aHPivIdxs[nHPivs] = curPivBarIdx; nHPivs++; } // -- If curTrend is up...else... } // -- loop through bars } // -- Basic attempt to add a pivot this logic may have missed // -- OK, now I want to look at last two pivots. If the most // recent low pivot is after the last high, I could // still have a high pivot that I didn't catch // -- Start at last bar curBar = (BarCount-1); candIdx = 0; candPrc = 0; lastLPIdx = aLPivIdxs[0]; lastLPL = aLPivLows[0]; lastHPIdx = aHPivIdxs[0]; lastHPH = aHPivHighs[0]; if (lastLPIdx > lastHPIdx) { // -- Bar and price info for candidate pivot candIdx = curBar - aHHVBars[curBar]; candPrc = aHHV[curBar]; if ( lastHPH < candPrc AND candIdx > lastLPIdx AND candIdx < curBar) { // -- OK, we'll add this as a pivot... aHPivs[candIdx] = 1; // ...and then rearrange elements in the // pivot information arrays 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 { // -- Bar and price info for candidate pivot candIdx = curBar - aLLVBars[curBar]; candPrc = aLLV[curBar]; if ( lastLPL > candPrc AND candIdx > lastHPIdx AND candIdx < curBar) { // -- OK, we'll add this as a pivot... aLPivs[candIdx] = 1; // ...and then rearrange elements in the // pivot information arrays 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++; } } // -- Dump inventory of high pivots for debugging 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]); } ////////////////////////////////////////////////////////////////////////////// // -- OK, let's plot the pivots using arrows PlotShapes(IIf(aHPivs==1, shapeSmallDownTriangle, shapeNone), colorOrange, 0, High, Offset=-10); PlotShapes(IIf(aLPivs==1, shapeSmallUpTriangle , shapeNone), colorPaleGreen, 0, Low, Offset=-10); ////////////////////////////////////////////////////////////////////////////// _SECTION_BEGIN(" Box"); box1=0; box2=0; SetBarsRequired(10000,10000); procedure fillDarvas(start,end,swap,top, bottom ) { for ( j = start; j < end; j++) { if( box1[j] == swap) box1[j]= top ; else box1[j]= bottom; if(box2[j] == swap) box2[j]= bottom ; else box2[j]= top; } } BoxArr1 = 0; BoxArr2 = 0; StateArray = 0; DBuy = 0; DSell = 0; TopArray = 0; BotArray = 0; tick=0; BoxTop = High[0]; BoxBot = Low[0]; swap=0; state = 0; BoxStart = 0; for (i=0; i<BarCount; i++) { if (state==5) { TopArray[i]=BoxTop; BotArray[i]=BoxBot; if (Low[i]<(BoxBot*(1-tick/100)) || High[i]>(BoxTop*(1+tick/100))) { fillDarvas(BoxStart,i,swap,BoxTop,BoxBot); state = 1; swap = !swap; BoxTop = High[i]; BoxStart = i; } } else { if (High[i]<BoxTop) { if ((state<3) || (Low[i]>BoxBot)) { state++; } else { state=3; } if (state==3) BoxBot=Low[i]; } else { state=1; BoxTop=High[i]; } } StateArray[i] = state; } fillDarvas(BoxStart,BarCount,swap,BoxTop,BoxBot); Plot(C,"",1,64); Plot(box1, "", colorRed,styleLine); Plot(box2, "", colorBrightGreen,styleLine); numbars = SelectedValue(Cum(Status("barvisible"))); fraction= IIf(StrRight(Name(),3) == "",3.2,3.2); hts = Param ("Text Shift", -50,-100,100,10); PlotText("@" + WriteVal(C,fraction), SelectedValue(BarIndex())-(numbars/hts),SelectedValue(C),2); PlotText("" + WriteVal(box1,fraction), SelectedValue(BarIndex()+3)-(numbars/hts),SelectedValue(box1),colorWhite,colorRed); PlotText("" + WriteVal(box2,fraction), SelectedValue(BarIndex()+3)-(numbars/hts),SelectedValue(box2),colorBlack,colorBrightGreen); _SECTION_END(); _SECTION_BEGIN("AuthorName"); k = (GetPerformanceCounter()/100)%100; printf("GetPerformance Counter %g",k); GfxSelectFont("jokerman", 14,800); GfxSetBkMode(1); GfxSetTextColor(colorWhite); GfxTextOut("waleed esmail ",-10+k,20); GfxSetTextColor(colorCustom12); GfxTextOut("TSR",900+k,1); RequestTimedRefresh(10); _SECTION_END(); _SECTION_BEGIN("price"); SetChartOptions(0,chartShowArrows|chartShowDates); Plot( C, "close", ParamColor("color", colorBlack ), styleNoTitle | styleNoLabel | GetPriceStyle() ); Plot( Open, "open",0, stylehidden ); Plot(Close, "close", 0, stylehidden ); Plot(High, "high", 0, stylehidden ); Plot(Low, "low", 0, stylehidden ); _SECTION_END(); _SECTION_BEGIN("zzt"); para = ParamToggle("plot zz0","off,on"); cbar = Param("cbar",4,2,50,1); per = Param("per",5,1,30,1); zz0 = Zig(C,per); zz1 = Ref( zz0, -1 ); zz2 = Ref( zz0, -2 ); tr = ValueWhen(zz0 > zz1 AND zz1 < zz2, zz1); pk = ValueWhen(zz0 < zz1 AND zz1 > zz2, zz1); pu = tr + 0.01 * abs(tr)*per; pd = pk - 0.01 * abs(pk)*per; zzt = IIf(C>= pu AND zz0 > zz1, 1, IIf(C<= pd AND zz0 < zz1, -1, 0 ) ); zzt= ValueWhen( zzt != 0, zzt ); colorp2= IIf((C>O)OR(C<O),colorWhite,colorYellow); Plot(IIf(para,zz0,Null)," ",colorWhite,styleLine|styleNoTitle); pr=PeakBars(High,5)==0; ps =TroughBars(Low,5)==0; rf=ValueWhen(pr,High); sf=ValueWhen(ps,Low); rf1 = IIf(rf AND BarsSince(pr) <=cbar,rf,Null); sf1 = IIf(sf AND BarsSince(ps ) <=cbar,sf,Null); Plot(rf1,"",colorRed,styleDots | styleNoLine|styleNoLabel); Plot(sf1,"",colorBrightGreen,styleDots | styleNoLine|styleNoLabel); Plot(rf,"",colorLightOrange,40+16|styleNoLabel); Plot(sf,"",colorLightOrange,40+16|styleNoLabel); _SECTION_END(); numbars = SelectedValue(Cum(Status("barvisible"))); fraction= IIf(StrRight(Name(),3) == "",3.2,3.2); hts = Param ("text shift", -50,-100,100,10); PlotText("" + WriteVal(rf,fraction), SelectedValue(BarIndex()+6)-(numbars/hts),SelectedValue(rf),colorWhite,colorOrange); PlotText("" + WriteVal(sf,fraction), SelectedValue(BarIndex()+6)-(numbars/hts),SelectedValue(sf),colorWhite,colorOrange); _SECTION_END(); _SECTION_BEGIN( "BASERECTANGEL" ); GfxSelectFont( "Arial", 10, 100 ); GfxSetBkMode( 1 ); GfxSetTextColor( colorBlue ); GfxSelectSolidBrush( colorDarkTeal ); GfxSelectPen( colorBlue, 1 ); // broader color GfxRectangle(0,15,203,400); _SECTION_END(); _SECTION_BEGIN( "BASERECTANGEL" ); GfxSelectFont( "Arial", 10, 100 ); GfxSetBkMode( 1 ); GfxSetTextColor( colorBlue ); GfxSelectSolidBrush( colorDarkTeal ); GfxSelectPen( colorBlue, 1 ); // broader color GfxRectangle(202,15,300,400); _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); mycolor=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) { ColorHighliter = myColor; SetBarFillColor( ColorHighliter ); } barColor=IIf(C>Green ,colorWhite,IIf(C < RED,colorRed,colorWhite)); _SECTION_END(); _SECTION_BEGIN("Bands"); 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,"",colorCustom12,ParamStyle("ShortSupBand",styleDashed|styleNoTitle|styleThick,maskAll)); Plot(BandSup,"",colorYellow,ParamStyle("ShortResBand",styleDashed|styleNoTitle|styleThick,maskAll)); CS=BandRes; CR=BandSup; if(parmCloud == 1) PlotOHLC(CS, CS, CR,CR , "", colorDarkTeal, styleCloud | styleNoRescale|styleNoLabel, Null, Null, Null, -1 ); _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); HaClose =EMA((O+H+L+C)/4,3); // Woodie //HaClose =(O+H+L+C)/4; HaOpen = AMA( Ref( HaClose, -1 ), 0.5 ); HaHigh = Max( H, Max( HaClose, HaOpen ) ); HaLow = 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, layer = 0,yposition = HaLow, offset = -30); //PlotShapes( IIf( Buy, shapeSmallCircle, shapeNone ), colorWhite, layer = 0,yposition = HaLow, offset = -8); PlotShapes( IIf( Sell, shapeSmallDownTriangle, shapeNone ), colorRed, layer = 0, yposition = HaHigh, offset = -30); //PlotShapes( IIf( Sell, shapeSmallCircle, shapeNone ), colorRed, layer = 0, yposition = HaHigh, offset = -8); _SECTION_END(); _SECTION_BEGIN("Graphics"); GrpPrm=Param("Graphic Space",-5,-10,10); GraphXSpace=GrpPrm; _SECTION_END(); _SECTION_BEGIN("PFE"); 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); rsidn=pfe <-10 AND pfe<Ref(pfe,-1); rsiup=pfe >10 AND pfe>Ref(pfe,-1); rsiresult1 = WriteIf( rsiup,"cu", ""); rsiresult2 = WriteIf( rsidn,"cd", ""); RequestTimedRefresh( 0 ); GfxSelectFont( "Tahoma", 12, 120 ); GfxSetBkMode( 1 ); GfxSetTextColor( colorWhite ); if ( rsiresult1 =="cu") { GfxSelectSolidBrush( ColorRGB(0,90,0) ); } else if ( rsiresult2 =="cd") { GfxSelectSolidBrush( ColorRGB(90,0,0)); } else if ( rsiresult2 =="") { GfxSelectSolidBrush( colorDarkTeal ); } GfxSelectFont( "Arial", 10, 100 ); GfxSetBkMode( 1 ); GfxSetTextColor( colorBlue ); GfxCircle( 100,90,50 ); _SECTION_END(); //GfxRoundRect( 15,305,135,215, 5, 5 ); GfxCircle( 100,100,70 ); _SECTION_END(); _SECTION_BEGIN("STC"); _SECTION_BEGIN("Schaff Trend Cycle"); /* 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])); } //HT=ParamColor("HT", colorRed ); rsidn=pff <2; rsiup=pff >98; rsiresult1 = WriteIf( rsiup,"cu", ""); rsiresult2 = WriteIf( rsidn,"cd", ""); RequestTimedRefresh( 0 ); GfxSelectFont( "Tahoma", 12, 120 ); GfxSetBkMode( 1 ); GfxSetTextColor( colorWhite ); if ( rsiresult1 =="cu") { GfxSelectSolidBrush( ColorRGB(0,120,0) ); } else if ( rsiresult2 =="cd") { GfxSelectSolidBrush( ColorRGB(120,0,0)); } else if ( rsiresult2 =="") { GfxSelectSolidBrush( colorDarkTeal ); } GfxSelectFont( "Arial", 10, 100 ); GfxSetBkMode( 1 ); GfxSetTextColor( colorBlue ); GfxCircle( 100,100,60 ); _SECTION_END(); _SECTION_BEGIN("rsi"); //HT=ParamColor("HT", colorRed ); rsidn=RSI(7) <30; rsiup=RSI(7) >70; rsiresult1 = WriteIf( rsiup,"cu", ""); rsiresult2 = WriteIf( rsidn,"cd", ""); RequestTimedRefresh( 0 ); GfxSelectFont( "Tahoma", 12, 120 ); GfxSetBkMode( 1 ); GfxSetTextColor( colorWhite ); if ( rsiresult1 =="cu") { GfxSelectSolidBrush( ColorRGB(0,150,0) ); } else if ( rsiresult2 =="cd") { GfxSelectSolidBrush( ColorRGB(150,0,0)); } else if ( rsiresult2 =="") { GfxSelectSolidBrush( colorDarkTeal ); } GfxSelectFont( "Arial", 10, 100 ); GfxSetBkMode( 1 ); GfxSetTextColor( colorBlue ); GfxCircle( 100,100,50 ); _SECTION_END(); _SECTION_BEGIN("Rays"); //FT=ParamColor("FT", colorRed ); Pp1=3; Pp2=2; CS33=HHV(LLV(flowerHigh,Pp1)-ATR(Pp2),4); CR33=HHV(LLV(flowerHigh,Pp1)-ATR(Pp2),5); AtrupTrendCond1 = flowerClose> CS33 ; AtrdnTrendCond1 =CS33>flowerClose ; ATRup = WriteIf(AtrupTrendCond1,"atrup", ""); ATRdown= WriteIf( AtrdnTrendCond1,"atrdn", ""); if ( ATRup =="atrup") { GfxSelectSolidBrush( ColorRGB(0,180,0) ); } else if (ATRdown =="atrdn") { GfxSelectSolidBrush( ColorRGB(180,0,0)); } else if ( ATRdown =="") { GfxSelectSolidBrush( colorDarkTeal ); } GfxSelectFont( "Arial", 10, 100 ); GfxSetBkMode( 1 ); GfxSetTextColor( colorBlue ); GfxSelectPen( colorBlue, 1 ); // broader color GfxCircle( 100,100,40 ); _SECTION_END(); _SECTION_BEGIN("Exit_Beast-3"); //GT=ParamColor("GT", colorRed ); EntrylookbackPeriod=10; EntryATRperiod=1.9; EntrySig = C > ( LLV( flowerLow, EntrylookbackPeriod ) + EntryATRperiod * ATR( 10 ) ); ExitSig = C < ( HHV( flowerHigh, EntrylookbackPeriod ) -EntryATRperiod * ATR( 10 ) ); RequestTimedRefresh( 0 ); GfxSelectFont( "Tahoma", 12, 100 ); GfxSetBkMode( 1 ); GfxSetTextColor( colorWhite ); EntryB = WriteIf( EntrySig,"eu", ""); ExitB = WriteIf( ExitSig,"ed", ""); if ( EntryB =="eu") { GfxSelectSolidBrush( ColorRGB(0,210,0) ); // } else if ( ExitB =="ed") { GfxSelectSolidBrush( ColorRGB(210,0,0)); // } else if ( ExitB =="") { GfxSelectSolidBrush( colorDarkTeal ); } GfxSelectFont( "Arial", 10, 100 ); GfxSetBkMode( 1 ); GfxSetTextColor( colorBlue ); GfxSelectPen( colorBlue, 1 ); // broader color GfxCircle( 100,100,30 );// changing the value of x,y,rad x-70, y-90, rad-24 _SECTION_END(); _SECTION_BEGIN("CCI9-2"); //HT=ParamColor("HT", colorRed ); ccidn=CCI(8) < 0; cciup=CCI(9) > 0; ccresult1 = WriteIf( cciup,"cu", ""); ccresult2 = WriteIf( ccidn,"cd", ""); RequestTimedRefresh( 0 ); GfxSelectFont( "Tahoma", 12, 100 ); GfxSetBkMode( 1 ); GfxSetTextColor( colorWhite ); if ( ccresult1 =="cu") { GfxSelectSolidBrush( ColorRGB(0,240,0) ); } else if ( ccresult2 =="cd") { GfxSelectSolidBrush( ColorRGB(240,0,0)); } else if ( ccresult2 =="") { GfxSelectSolidBrush( colorDarkTeal ); } GfxSelectFont( "Arial", 10, 100 ); GfxSetBkMode( 1 ); GfxSetTextColor( colorBlue ); GfxSelectPen( colorBlue, 1 ); // broader color GfxCircle( 100,100,20); _SECTION_END(); _SECTION_BEGIN("%BB7-1"); //IT=ParamColor("IT", colorRed ); p=7; x=((C+2*StDev(C,p)-MA(C,p))/(4*StDev(C,p)))*100; bbdown= x < 40; bbup= x > 40; bbresult1 = WriteIf( bbup,"bu", ""); bbresult2 = WriteIf( bbdown,"bd", ""); bbresult3 = WriteIf( C,"bearishrevers", ""); RequestTimedRefresh( 0 ); GfxSelectFont( "Tahoma", 12, 100 ); GfxSetBkMode( 1 ); GfxSetTextColor( colorWhite ); if ( bbresult1 =="bu") { GfxSelectSolidBrush( ColorRGB(62,255,62) ); } else if ( bbresult2 =="bd") { GfxSelectSolidBrush( ColorRGB(255,62,62) ); } else if ( bbresult2 =="") { GfxSelectSolidBrush( colorDarkTeal ); } GfxSelectFont( "Arial", 10, 100 ); GfxSetBkMode( 1 ); GfxSetTextColor( colorBlue ); GfxSelectPen( colorBlue, 1 ); // broader color GfxCircle( 100,100,10 ); _SECTION_END(); _SECTION_BEGIN("volume1"); GfxSelectSolidBrush( colorDarkTeal ); GfxRoundRect(240,30,260,200,20,20); _SECTION_END(); _SECTION_BEGIN("volume2"); GfxSelectSolidBrush( colorDarkTeal ); GfxCircle( 250,180,23 ); _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; _SECTION_END(); _SECTION_BEGIN("vol30"); rsiup=rising; rsidn=falling; down=Converge > 0; rsiresult1 = WriteIf( rsiup,"ab", ""); rsiresult2 = WriteIf( rsidn,"cd", ""); rsiresult3 = WriteIf( down,"ef", ""); RequestTimedRefresh( 0 ); if ( rsiresult1 =="ab") { GfxSelectSolidBrush( ColorRGB(0,147,0) ); GfxSelectFont( "Arial", 10, 100 ); GfxSetBkMode( 1 ); GfxSetTextColor( colorGreen ); GfxSelectPen( colorGreen, 1 ); } else if ( rsiresult2 =="cd") { GfxSelectSolidBrush( ColorRGB(0,85,0) ); GfxSelectFont( "Arial", 10, 100 ); GfxSetBkMode( 1 ); GfxSetTextColor( colorDarkGreen ); GfxSelectPen( colorDarkGreen, 1 ); } else { GfxSelectSolidBrush( ColorRGB(255,0,0) ); GfxSelectFont( "Arial", 10, 100 ); GfxSetBkMode( 1 ); GfxSetTextColor( colorRed ); GfxSelectPen( colorRed, 1 ); } GfxRectangle(241,50,259,200); _SECTION_END(); _SECTION_BEGIN("vol31"); rsiup=rising; rsidn=falling; down=Converge > 0; rsiresult1 = WriteIf( rsiup,"ab", ""); rsiresult2 = WriteIf( rsidn,"cd", ""); rsiresult3 = WriteIf( down,"ef", ""); RequestTimedRefresh( 0 ); if ( rsiresult1 =="ab") { GfxSelectSolidBrush( ColorRGB(0,147,0) ); GfxSelectFont( "Arial", 10, 100 ); GfxSetBkMode( 1 ); GfxSetTextColor( colorGreen ); GfxSelectPen( colorGreen, 1 ); } else if ( rsiresult2 =="cd") { GfxSelectSolidBrush( ColorRGB(0,85,0) ); GfxSelectFont( "Arial", 10, 100 ); GfxSetBkMode( 1 ); GfxSetTextColor( colorDarkGreen ); GfxSelectPen( colorDarkGreen, 1 ); } else { GfxSelectSolidBrush( ColorRGB(255,0,0) ); GfxSelectFont( "Arial", 10, 100 ); GfxSetBkMode( 1 ); GfxSetTextColor( colorRed ); GfxSelectPen( colorRed, 1 ); } GfxCircle( 250,180,22 ); _SECTION_END(); _SECTION_BEGIN("res/sup-s1"); 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; GfxSelectFont("arial", 10, 700 ); GfxSetBkMode( colorWhite ); GfxSetTextColor( ParamColor("Color",colorRed) ); Hor=Param("Horizontal Position",230,10,1200,1); Ver=Param("Vertical Position",230,300,500,500); GfxTextOut(""+s1,Hor , Ver ); _SECTION_END(); _SECTION_BEGIN("res/sup-s2"); GfxSelectFont("arial", 10, 700 ); GfxSetBkMode( colorWhite ); GfxSetTextColor( ParamColor("Color",colorRed) ); Hor=Param("Horizontal Position",230,10,1200,1); Ver=Param("Vertical Position",260,300,500,500); GfxTextOut(""+s2,Hor , Ver ); _SECTION_END(); _SECTION_BEGIN("res/sup-s3"); GfxSelectFont("arial", 10, 700 ); GfxSetBkMode( colorWhite ); GfxSetTextColor( ParamColor("Color",colorRed) ); Hor=Param("Horizontal Position",230,10,1200,1); Ver=Param("Vertical Position",290,300,600,600); GfxTextOut(""+s3,Hor , Ver ); _SECTION_END(); _SECTION_BEGIN("res/sup-r1"); GfxSelectFont("arial", 10, 700 ); GfxSetBkMode( colorWhite ); GfxSetTextColor( ParamColor("Color",colorGreen) ); Hor=Param("Horizontal Position",230,10,1200,1); Ver=Param("Vertical Position",320,300,500,500); GfxTextOut(""+r1,Hor , Ver ); _SECTION_END(); _SECTION_BEGIN("res/sup-r2"); GfxSelectFont("arial", 10, 700 ); GfxSetBkMode( colorWhite ); GfxSetTextColor( ParamColor("Color",colorGreen) ); Hor=Param("Horizontal Position",230,10,1200,1); Ver=Param("Vertical Position",350,300,500,500); GfxTextOut(""+r2,Hor , Ver ); _SECTION_END(); _SECTION_BEGIN("res/sup-r3"); GfxSelectFont("arial", 10, 700 ); GfxSetBkMode( colorWhite ); GfxSetTextColor( ParamColor("Color",colorGreen) ); Hor=Param("Horizontal Position",230,10,1200,1); Ver=Param("Vertical Position",380,300,500,500); GfxTextOut(""+r3,Hor , Ver ); _SECTION_END(); _SECTION_BEGIN("MACD HIGH BULLISH"); r1 = Param( "Fast avg", 10, 2, 200, 1 ); r2 = Param( "Slow avg", 22, 2, 200, 1 ); r3 = Param( "Signal avg", 9, 2, 200, 1 ); r4 = Param( "Wk slow", 17, 2, 200, 1 ); r5 = Param( "Wk fast", 8, 2, 200, 1 ); m1=MACD(r1,r2); s1=Signal(r1,r2,r3); rsidn=m1>0 AND m1>s1; rsiresult2 = WriteIf( rsidn,"cd", ""); if ( rsiresult2 =="cd") { GfxSelectSolidBrush( ColorRGB(0,147,0)); } else if ( rsiresult2 =="") { GfxSelectSolidBrush( colorDarkTeal ); } RequestTimedRefresh( 0 ); GfxSelectFont( "Arial", 10, 100 ); GfxSetBkMode( 1 ); GfxSetTextColor( colorBlue ); GfxSelectPen( colorBlue, 1 ); // broader color GfxRectangle(80,220,120,280); _SECTION_END(); _SECTION_BEGIN("MACD LOW BULLISH"); r1 = Param( "Fast avg", 10, 2, 200, 1 ); r2 = Param( "Slow avg", 22, 2, 200, 1 ); r3 = Param( "Signal avg", 9, 2, 200, 1 ); r4 = Param( "Wk slow", 17, 2, 200, 1 ); r5 = Param( "Wk fast", 8, 2, 200, 1 ); m1=MACD(r1,r2); s1=Signal(r1,r2,r3); rsidn=m1<0 AND m1>s1; rsiresult2 = WriteIf( rsidn,"cd", ""); if ( rsiresult2 =="cd") { GfxSelectSolidBrush( ColorRGB(0,147,0)); } else if ( rsiresult2 =="") { GfxSelectSolidBrush( colorDarkTeal ); } RequestTimedRefresh( 0 ); GfxSelectFont( "Arial", 10, 100 ); GfxSetBkMode( 1 ); GfxSetTextColor( colorBlue ); GfxSelectPen( colorBlue, 1 ); // broader color GfxRectangle(120,315,180,280); _SECTION_END(); _SECTION_BEGIN("MACD LOW BEARISH"); r1 = Param( "Fast avg", 10, 2, 200, 1 ); r2 = Param( "Slow avg", 22, 2, 200, 1 ); r3 = Param( "Signal avg", 9, 2, 200, 1 ); r4 = Param( "Wk slow", 17, 2, 200, 1 ); r5 = Param( "Wk fast", 8, 2, 200, 1 ); m1=MACD(r1,r2); s1=Signal(r1,r2,r3); rsidn=m1>0 AND m1<s1; rsiresult2 = WriteIf( rsidn,"cd", ""); if ( rsiresult2 =="cd") { GfxSelectSolidBrush( ColorRGB(225,0,0)); } else if ( rsiresult2 =="") { GfxSelectSolidBrush( colorDarkTeal ); } RequestTimedRefresh( 0 ); GfxSelectFont( "Arial", 10, 100 ); GfxSetBkMode( 1 ); GfxSetTextColor( colorBlue ); GfxSelectPen( colorBlue, 1 ); // broader color GfxRectangle(20,315,80,280); _SECTION_END(); _SECTION_BEGIN("MACD HIGH HBEARISH"); r1 = Param( "Fast avg", 10, 2, 200, 1 ); r2 = Param( "Slow avg", 22, 2, 200, 1 ); r3 = Param( "Signal avg", 9, 2, 200, 1 ); r4 = Param( "Wk slow", 17, 2, 200, 1 ); r5 = Param( "Wk fast", 8, 2, 200, 1 ); m1=MACD(r1,r2); s1=Signal(r1,r2,r3); rsidn=m1<0 AND m1<s1; rsiresult2 = WriteIf( rsidn,"cd", ""); if ( rsiresult2 =="cd") { GfxSelectSolidBrush( ColorRGB(225,0,0)); } else if ( rsiresult2 =="") { GfxSelectSolidBrush( colorDarkTeal ); } RequestTimedRefresh( 0 ); GfxSelectFont( "Arial", 10, 100 ); GfxSetBkMode( 1 ); GfxSetTextColor( colorBlue ); GfxSelectPen( colorBlue, 1 ); // broader color GfxRectangle(80,375,120,315); _SECTION_END(); _SECTION_BEGIN("bearishline"); GfxSelectFont( "Arial", 10, 100 ); GfxSetBkMode( 1 ); GfxSetTextColor( colorRed ); GfxSelectPen( colorCustom12, 1 ); GfxMoveTo( 25,320 ); GfxLineTo( 75, 370 ); _SECTION_END(); _SECTION_BEGIN("bullish line"); GfxSelectFont( "Arial", 10, 100 ); GfxSetBkMode( 1 ); GfxSetTextColor( colorGreen ); GfxSelectPen( colorBrightGreen, 1 ); GfxMoveTo( 125,225 ); GfxLineTo( 175, 275 ); _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("trendlineA"); dn=g3>C; up=g3<C; bbresult1 = WriteIf( dn,"dn", ""); bbresult2 = WriteIf( up,"up", ""); RequestTimedRefresh( 0 ); if ( bbresult1 =="dn") { GfxSelectSolidBrush( ColorRGB(255,0,0) ); } else if ( bbresult2 =="up") { GfxSelectSolidBrush( ColorRGB(0,147,0) ); } GfxSelectFont( "Arial", 10, 100 ); GfxSetBkMode( 1 ); GfxSetTextColor( colorWhite ); GfxSelectPen( colorWhite, 1 ); GfxCircle( 30,229,8 ); _SECTION_END(); _SECTION_BEGIN("trendlineA"); dn=g3>C; up=g3<C; bbresult1 = WriteIf( dn,"dn", ""); bbresult2 = WriteIf( up,"up", ""); RequestTimedRefresh( 0 ); if ( bbresult1 =="dn") { GfxSelectSolidBrush( ColorRGB(255,0,0) ); } else if ( bbresult2 =="up") { GfxSelectSolidBrush( ColorRGB(0,147,0) ); } GfxSelectFont( "Arial", 10, 100 ); GfxSetBkMode( 1 ); GfxSetTextColor( colorWhite ); GfxSelectPen( colorWhite, 1 ); GfxCircle( 168,367,8 ); _SECTION_END(); _SECTION_BEGIN("TRENDLINEline"); GfxSelectFont( "Arial", 10, 100 ); GfxSetBkMode( 1 ); GfxSetTextColor( colorWhite ); GfxSelectPen( colorWhite, 1 ); GfxMoveTo( 35,234 ); GfxLineTo( 163, 362 ); _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; s1= s0 > C ; s2= s0 <C ; ccresult1 = WriteIf( s1,"cu", ""); ccresult2 = WriteIf( s2,"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 ( ccresult2 =="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("CMP"); 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("buycircle"); GfxSelectFont( "Arial", 10, 100 ); GfxSetBkMode( 1 ); GfxSetTextColor( colorBlue ); GfxSelectPen( colorBlue, 1 ); if ( ccresult2 =="cd") { GfxSelectSolidBrush( ColorRGB(0,255,0) ); } else { GfxSelectSolidBrush( ColorRGB(0,0,94) ); } GfxCircle( 20,40,7 ); _SECTION_END(); _SECTION_BEGIN("sellcircle"); GfxSelectFont( "Arial", 10, 100 ); GfxSetBkMode( 1 ); GfxSetTextColor( colorBlue ); GfxSelectPen( colorBlue, 1 ); if ( ccresult1 =="cu") { GfxSelectSolidBrush( ColorRGB(255,0,0) ); } else { GfxSelectSolidBrush( ColorRGB(0,0,94) ); } GfxCircle( 180,40,7 ); _SECTION_END(); _SECTION_BEGIN("TFS-RSI"); Fast=Param("Rsi per",14,3,20,1); TimeFrameSet(inDaily); fd=RSI(fast); TimeFrameRestore(); updy=TimeFrameExpand(fd,inDaily,expandFirst); upd=updy>50; dnd=updy<50; Cod=IIf(upd,colorBlue,IIf(dnd,colorRed,colorBlack )); TimeFrameSet(5*inDaily); fw=RSI(fast); TimeFrameRestore(); upwy=TimeFrameExpand(fw,5*inDaily,expandFirst); upw=upwy>50; dnw=upwy<50; Cow=IIf(upw,colorBlue,IIf(dnw,colorRed,colorBlack)); TimeFrameSet(20*inDaily); fm=RSI(fast); TimeFrameRestore(); upmy=TimeFrameExpand(fm,20*inDaily,expandFirst); upm=upmy>50; dnm=upmy<50; Com=IIf(upm,colorBlue,IIf(dnm,colorRed,colorBlack)); ups=( upd AND upw AND upm ); dns=( dnd AND dnw AND dnm); _SECTION_END(); _SECTION_BEGIN("Font Color"); 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 =colorWhite; Position =2* Position; x2 = Status("pxchartright"); y2 = Status("pxchartbottom"); RibbonColor =IIf(GfxConvertBarToPixelX(BarIndex()-Status("firstvisiblebarindex")) > y2/1.5 * (2/100)*10,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("Arial", y2/1 * (2.7/180),200); GfxDrawText(Label,8, y2 *1.006-(y2 * Position/100) , y2/1.6* (2/100)*10,y2,2+32+256); } multiribbon(com,1, "monthly"); multiribbon(cow,2, "5 day"); multiribbon(cod,3, "1 day"); _SECTION_END(); TrendScore = IIf(upd,1,0)+ IIf(upw,1,0) + IIf(upm,1,0) + IIf(dnd,-1,0)+ IIf(dnw,-1,0)+ IIf(dnm,-1,0); _SECTION_BEGIN(" "); { GfxSelectFont("french script mt",13, 700 ); GfxSetBkMode(1); GfxSetTextColor(colorCustom11); GfxTextOut("Score= "+WriteVal(TrendScore,format=1.2)+" ",800,1); } _SECTION_END(); _SECTION_BEGIN("Unnamed 31"); K =1; X1 = 0; Y1 = 60; GfxSelectSolidBrush( ColorRGB(30,30,30)); GfxSelectPen( colorLavender, 1 ); GfxRectangle( x1, y1-10, X1+210, y1+10 ) ; TimeFrameSet( inDaily ); for (i = BarCount-11; i < BarCount-2; i++){ //GfxTextOut(""+K+ " = " + Close[i+1], X1, Y1+(K*15)); if(!IsEmpty(Close[i])){ if(Close[i] < Close[i+1]){ GfxSelectPen( colorBrightGreen, 2 ); GfxSelectSolidBrush( colorBrightGreen ); GfxCircle( X1+(k*15), Y1, 5 ); } else { GfxSelectPen( colorRed, 2 ); GfxSelectSolidBrush( colorRed ); GfxCircle( X1+(k*15), Y1, 5 ); } } //loop k++; } GfxSetBkColor ( colorBlue ); GfxTextOut("Today", X1+(K*15), Y1-8); k++; if(Close[BarCount-2] < Close[BarCount-1]){ GfxSelectPen( colorBrightGreen, 2 ); GfxSelectSolidBrush( colorBrightGreen ); GfxCircle( X1+30+(k*15), Y1, 5 ); } else { GfxSelectPen( colorRed, 2 ); GfxSelectSolidBrush( colorRed ); GfxCircle( X1+30+(k*15), Y1, 5 ); } //GfxTextOut(""+i+ " = " + Close[BarCount-1], X1, Y1+(K*15)); TimeFrameRestore(); _SECTION_END(); _SECTION_BEGIN("Magfied Market Price"); //Magfied Market Price FS=Param("Font Size",30,11,100,1); GfxSelectFont("Times New Roman", FS, 700, True ); GfxSetBkMode( colorWhite ); GfxSetTextColor( ParamColor("Color",colorGreen) ); Hor=Param("Horizontal Position",800,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); xx=Prec((DD/YC)*100,2); GfxSelectFont("Times New Roman", 11, 700, True ); GfxSetBkMode( colorBlack ); GfxSetTextColor(ParamColor("Color",colorYellow) ); GfxTextOut(""+DD+" ("+xx+"%)", Hor , Ver+45 ); _SECTION_END();