// Downloaded From https://www.WiseStockTrader.com _SECTION_BEGIN("MA Cross"); e1=EMA(C,3); e2=EMA(C,13); Plot(e1,"",6,1); Plot(e2,"",4,1); b1=Cross(e1,e2); s1=Cross(e2,e1); Buysetup=Flip(b1,s1); Shortsetup=Flip(s1,b1); trend=IIf(BarsSince(Buysetup)Ref(res,-1),1,IIf(C1;i--) { if(Buy[i] == 1) { entry = C[i]; sig = "Buy"; sl = s5d[i]; tar1 = entry + (entry * .0050); tar2 = entry + (entry * .0092); tar3 = entry + (entry * .0179); bars = i; i = 0; } if(Sell[i] == 1) { sig = "Sell"; entry = C[i]; sl = s5d[i]; tar1 = entry - (entry * .0050); tar2 = entry - (entry * .0112); tar3 = entry - (entry * .0212); bars = i; i = 0; } } Offset = 20; Clr = IIf(sig == "Buy", colorLime, colorRed); ssl = IIf(bars == BarCount-1, s5d[BarCount-1], Ref(s5d, -1)); sl = ssl[BarCount-1]; Plot(LineArray(bars-Offset, tar1, BarCount, tar1,1), "", Clr, styleLine|styleDots, Null, Null, Offset); Plot(LineArray(bars-Offset, tar2, BarCount, tar2,1), "", Clr, styleLine|styleDots, Null, Null, Offset); Plot(LineArray(bars-Offset, tar3, BarCount, tar3,1), "", Clr, styleLine|styleDots, Null, Null, Offset); Plot(LineArray(bars-Offset, sl, BarCount, sl,1), "", colorDarkRed, styleLine|styleLine, Null, Null, Offset); Plot(LineArray(bars-Offset, entry, BarCount, entry,1), "", colorGreen, styleLine|styleLine, Null, Null, Offset); for (i=bars; i O,ParamColor("Candle UP Color", colorGreen),IIf(C<=O,ParamColor("Candle Down Color", colorRed),colorLightGrey))); Plot(C,"\nPrice",IIf(C>O,ParamColor("Wick UP Color", colorDarkGreen),IIf(C<=O,ParamColor("Wick Down Color", colorDarkRed),colorLightGrey)),64,0,0,0,0); //SetTradeDelays(1,1,1,1); SetPositionSize(100,spsShares); _N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) )); iCCI=Param("CCI Period",50,1,100,1); Multiplier = Param("Multiplier",2,1,10,1); Pd=Param("ATR Periods",5,1,10,1); price = (O+H+L)/3; iATR = ATR(Pd); CCIvalue = CCIa(price,iCCI); for (i = 0; i =0 && CCIvalue[i-1]<0) { // TrendUp[i-1]=TrendDown[i-1]; // } // if (CCIvalue[i]<=0 && CCIvalue[i-1]>0) { // TrendDown[i-1]=TrendUp[i-1]; // } if (CCIvalue[i] >= 0) { TrendUp[i] = (High[i]+Low[i])/2 - Multiplier*iATR[i]; if (TrendUp[i] < TrendUp[i- 1]) TrendUp[i] = TrendUp[i- 1]; } else { if (CCIvalue[i] <= 0) { TrendDown[i] = (High[i]+Low[i])/2 + Multiplier*iATR[i]; if (TrendDown[i] > TrendDown[i-1]) TrendDown[i] = TrendDown[i-1]; } } } //end for loop Plot(TrendUp,"Trend",colorGreen); Plot(TrendDown,"Down",colorRed); Buy = IsNull(TrendDown) AND !IsNull(TrendUP); Sell = IsNull(TrendUp) AND !IsNull(TrendDown); Buy=ExRem(Buy,Sell); Sell=ExRem(Sell,Buy); Short=Sell; Cover=Buy; BuyPrice=ValueWhen(Buy,C); SellPrice=ValueWhen(Sell,C); ShortPrice=ValueWhen(Short,C); CoverPrice=ValueWhen(Cover,C); Title = EncodeColor(colorWhite)+ "DR BHOIR G B Modified Trend Magic " + " - " + Name() + " - " + EncodeColor(colorRed)+ Interval(2) + EncodeColor(colorWhite) + " - " + Date() +" - "+"\n" +EncodeColor(colorRed) +"Op-"+O+" "+"Hi-"+H+" "+"Lo-"+L+" "+ "Cl-"+C+" "+ "Vol= "+ WriteVal(V)+"\n"+ EncodeColor(colorLime)+ WriteIf (Buy , " GO LONG / Reverse Signal at "+C+" ","")+ WriteIf (Sell , " EXIT LONG / Reverse Signal at "+C+" ","")+"\n"+EncodeColor(colorYellow)+ WriteIf(Sell , "Total Profit/Loss for the Last Trade Rs."+(C-BuyPrice)+"","")+ WriteIf(Buy , "Total Profit/Loss for the Last trade Rs."+(SellPrice-C)+"",""); PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorGreen, 0, L, Offset=-40); PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorLime, 0,L, Offset=-50); PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-45); PlotShapes(IIf(Short, shapeSquare, shapeNone),colorRed, 0, H, Offset=40); PlotShapes(IIf(Short, shapeSquare, shapeNone),colorOrange, 0,H, Offset=50); PlotShapes(IIf(Short, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-45); _SECTION_END(); _SECTION_BEGIN("Time Left"); function GetSecondNum() { Time = Now( 4 ); Seconds = int( Time % 100 ); Minutes = int( Time / 100 % 100 ); Hours = int( Time / 10000 % 100 ); SecondNum = int( Hours * 60 * 60 + Minutes * 60 + Seconds ); return SecondNum; } RequestTimedRefresh( 1 ); TimeFrame = Interval(); SecNumber = GetSecondNum(); Newperiod = SecNumber % TimeFrame == 0; SecsLeft = SecNumber - int( SecNumber / TimeFrame ) * TimeFrame; SecsToGo = TimeFrame - SecsLeft; x=Param("xposn",50,0,1000,1); y=Param("yposn",380,0,1000,1); GfxSelectSolidBrush( ColorRGB( 230, 230, 230 ) ); GfxSelectPen( ColorRGB( 230, 230, 230 ), 2 ); if ( NewPeriod ) { GfxSelectSolidBrush( colorYellow ); GfxSelectPen( colorYellow, 2 ); Say( "New period" ); } //GfxRoundRect( x+45, y+40, x-3, y-2, 0, 0 ); //GfxSetBkMode(1); GfxSelectFont( "Arial", 14, 700, False ); GfxSetTextColor( colorRed ); GfxTextOut( "Time Left :"+SecsToGo+"", x, y ); _SECTION_END();