// Downloaded From https://www.WiseStockTrader.com SetBarsRequired(200,0); GraphXSpace = 7; SetChartOptions(0,chartShowArrows|chartShowDates); //---------------Color------------------------ per1=6; per2=2; Om=MA(O,per1); hm=MA(H,per1); lm=MA(L,per1); Cm=MA(C,per1); HACLOSE=(Om+Hm+Lm+Cm)/4; HaOpen = AMA( Ref( HaClose, -1 ), 0.5 ); HaHigh = Max( Hm, Max( HaClose, HaOpen ) ); HaLow = Min( Lm, Min( HaClose, HaOpen ) ); Of=MA(Haopen,per2); Cf=MA(Haclose,per2); Lf=IIf(haOpen Of, colorGreen, colorRed ); //---------------------------------------------------- TrailStop = HHV( C - 2 * ATR(10), 15 ); ProfitTaker = EMA( H, 13 ) + 2 * ATR(10); /* ********************************** Code to automatically identify pivots ********************************** */ // -- what will be our lookback range for the hh and ll? farback=140; //How Far back to go nBars = 12; //Number of bars // -- Create 0-initialized arrays the size of barcount aHPivs = H - H; aLPivs = L - L; // -- More for future 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 future version for (i=0; i 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 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 (MA(H,n)+MA(L,n))/2;// then Buy next bar at market; b = C < (MA(H,n)+MA(L,n))/2;// then Sell Short next bar at market; state=IIf(BarsSince(a) 0,True, False); TMM=IIf(LinRegSlope(MA(C, DTM),2) > 0,True, False); TSS=IIf(LinRegSlope(MA(C, DTS),2) > 0,True, False); //============== VOLUME ============== Vlp=30; //Volume lookback period Vrg=MA(V,Vlp); St = StDev(Vrg,Vlp); Vp3 = Vrg + 3*st; Vp2 = Vrg + 2*st;; Vp1 = Vrg + 1*st;; Vn1 = Vrg -1*st; Vn2 = Vrg -2*st; //============== WILLIAM'S %R ============== WR = ((HHV(H,14) - C) /(HHV (H,14) -LLV (L,14))) *-100; //============== A/D ============== TRH = IIf(Ref(C, -1) > H, Ref(C, -1), H); TRL = IIf(Ref(C, -1) < L, Ref(C, -1), L); ad = IIf(C > Ref(C, -1), C - TRL, IIf(C < Ref(C, -1), C - TRH, 0)); WAD = Cum(ad); wu = wad > Ref(wad,-1); wd = wad < Ref(wad,-1); //============== MACD ============== MB= Cross (MACD(), Signal()); MS = Cross( Signal(), MACD()); MB = ExRem(MB, MS); MS = ExRem(MS, MB); MB1= MACD() > Signal(); MS1= MACD() < Signal(); //============== STOCH ============== StochKval = StochK(10,5); StochDval = StochD(10,5,5); StochBuy = Cross(StochK(10,5), StochD(10,5,5)); StochSell = Cross (StochD(10,5,5), StochK(10,5)); StBuy=StochK(10,5)>StochD(10,5,5); StSell=StochK(10,5) MDI(14); adxsell1 = MDI(14)> PDI(14); //============== TMA ============== function ZeroLagTEMA( array, period ) { TMA1 = TEMA( array, period ); TMA2 = TEMA( TMA1, period ); Diff = TMA1 - TMA2; return TMA1 + Diff ; } haClose = ( haClose + haOpen + haHigh + haLow )/4; periodtm = 55; ZLHa = ZeroLagTEMA( haClose, periodtm ); ZLTyp = ZeroLagTEMA( Avg, periodtm ); TMBuy = Cross( ZLTyp, ZLHa ); TMSell = Cross( ZLHa, ZLTyp ); TMBuy1= ZLTyp> ZLHa ; TMSell1=ZLHa> ZLTyp ; //============== ZLW ============== R = ((HHV(H,14) - C) /(HHV (H,14) -LLV (L,14))) *-100; MaxGraph=10; PeriodZ= 10; EMA1= EMA(R,PeriodZ); EMA2= EMA(EMA1,5); Difference= EMA1 - EMA2; ZeroLagEMA= EMA1 + Difference; PR=100-abs(ZeroLagEMA); MoveAvg=MA(PR,5); ZBuy = Cross(PR,moveAvg) AND PR<30; ZSell = Cross(moveAvg,PR) AND PR>70; ZBuy1= PR>= MoveAvg AND PR>= Ref(PR,-1) ; ZSell1=(PR < MoveAvg) OR PR>= MoveAvg AND PR< Ref(PR,-1) ; //============== RS ============== p = (H+L+C)/3; r1 = (2*p)-L; s1 = (2*p)-H; r2 = p +(r1 - s1); s2 = p -(r2 - s1); R3 = P + (R2 - S2); S3 = P - (R3 - S2); //============== IBUY ============== Ibuy = Cross(RSI(14), EMA(RSI(14),9)); Isell = Cross(EMA(RSI(14),9), RSI(14)); Ibuy = ExRem(Ibuy, ISell); Isell = ExRem(ISell, Ibuy); BlRSI = RSI(14) > EMA(RSI(14),9); BrRSI = RSI(14) < EMA(RSI(14),9); //============== TITLE ============== _SECTION_BEGIN("Title"); if( Status("action") == actionIndicator ) ( Title = EncodeColor(colorGold)+ "Kenzie SR System" + EncodeColor(colorRose)+" (" + Name() + ") " + EncodeColor(colorGold)+ Interval(2) + " " + Date() +" " +" • Open "+WriteVal(O,1.0)+" • "+"Hi "+WriteVal(H,1.0)+" • "+"Lo "+WriteVal(L,1.0)+" • "+ "Close "+WriteVal(C,1.0)+" ("+WriteVal(C-Ref(C,-1),1,0)+" "+WriteVal((C-Ref(C,-1))*100/Ref(C,-1),1.1)+ "%) • Vol= "+ WriteVal(V,1.0) +" "+WriteIf(V>Vp2,EncodeColor(colorLime)+"(Very High)",WriteIf(V>Vp1,EncodeColor(colorLime)+"(High )",WriteIf(V>Vrg,EncodeColor(colorLime)+"(Above Average)", WriteIf(VVn1,EncodeColor(ColorRGB(255,0,128))+"(Less than Average)",WriteIf(V0 AND TS<0.3,EncodeColor(colorLime)+"Weak Up Trend", WriteIf(TS>=0.3 AND TS<0.6 ,EncodeColor(colorBrightGreen)+"Medium Up Trend", WriteIf(TS>=0.6,EncodeColor(colorGreen)+"Strong Up Trend", WriteIf(TS<0 AND TS>-0.3,EncodeColor(colorPink)+"Weak Down Trend", WriteIf(TS<=-0.3 AND TS>-0.6 ,EncodeColor(ColorRGB(255,0,128))+"Medium Down Trend", WriteIf(TS<=-0.6,EncodeColor(colorRed)+"Strong Down Trend",EncodeColor(colorGrey50)+"Sideways")))))) +"\n"+EncodeColor(colorGold)+"• Mid Term: "+ WriteIf(TM>0 AND TM<0.3,EncodeColor(colorLime)+"Weak Up Trend", WriteIf(TM>=0.3 AND TM<0.6 ,EncodeColor(colorBrightGreen)+"Medium Up Trend", WriteIf(TM>=0.6,EncodeColor(colorGreen)+"Strong Up Trend", WriteIf(TM<0 AND TM>-0.3,EncodeColor(colorPink)+"Weak Down Trend", WriteIf(TM<=-0.3 AND TM>-0.6 ,EncodeColor(ColorRGB(255,0,128))+"Medium Down Trend", WriteIf(TM<=-0.6,EncodeColor(colorRed)+"Strong Down Trend",EncodeColor(colorGrey50)+"Sideways")))))) +"\n"+EncodeColor(colorGold)+"• Long Term: "+ WriteIf(TL>0 AND TL<0.3,EncodeColor(colorLime)+"Weak Up Trend", WriteIf(TL>=0.3 AND TL<0.6 ,EncodeColor(colorBrightGreen)+"Medium Up Trend", WriteIf(TL>=0.6,EncodeColor(colorGreen)+"Strong Up Trend", WriteIf(TL<0 AND TL>-0.3,EncodeColor(colorPink)+"Weak Down Trend", WriteIf(TL<=-0.3 AND TL>-0.6 ,EncodeColor(ColorRGB(255,0,128))+"Medium Down Trend", WriteIf(TL<=-0.6,EncodeColor(colorRed)+"Strong Down Trend",EncodeColor(colorGrey50)+"Sideways")))))) +"\n"+EncodeColor(colorGrey50)+"--------------------------------------" +"\n"+EncodeColor(47)+"• AccDist(): " + WriteIf(wu,EncodeColor(colorBrightGreen)+"Accumula tion",WriteIf(wd,EncodeColor(colorRed)+"Distributi on","Neutral")) +"\n"+ EncodeColor(47) +"• RSI(14): " +WriteIf(RSI(14)>30 AND RSI(14)<70,EncodeColor(colorBrightGreen),WriteIf(RSI(14)<30 ,EncodeColor(07),EncodeColor(colorRed))) + WriteVal(RSI(14),format=1.1) +WriteIf(RSI(14)>30 AND RSI(14)<70," Range"+EncodeColor(colorBrightGreen),WriteIf(RSI(14)<30 ," OverSold"+EncodeColor(07)," OverBought"+EncodeColor(colorRed))) +"\n"+ EncodeColor(47) +"• CCI(14): " +WriteIf(CCI(14)>-100 AND CCI(14)<100,EncodeColor(colorBrightGreen),WriteIf( CCI(14)<-100 ,EncodeColor(07),EncodeColor(colorRed))) + WriteVal(CCI(14),format=1.1) +WriteIf(CCI(14)>-100 AND CCI(14)<100," Range"+EncodeColor(colorBrightGreen),WriteIf(CCI(14)<-100 ," OverSold"+EncodeColor(07)," OverBought"+EncodeColor(colorRed))) +"\n"+ EncodeColor(47) +"• ROC(C,14): " +WriteIf(ROC(C,14)>-10 AND ROC(C,14)<10,EncodeColor(colorBrightGreen),WriteIf (ROC(C,14)<-10 ,EncodeColor(07),EncodeColor(colorRed))) + WriteVal(ROC(C,14),format=1.1) +WriteIf(ROC(C,14)>-10 AND ROC(C,14)<10," Range"+EncodeColor(colorBrightGreen),WriteIf(ROC(C ,14)<-10 ," OverSold"+EncodeColor(07)," OverBought"+EncodeColor(colorRed))) +"\n"+ EncodeColor(47) +"• Wm%R(14): " +WriteIf(WR>-80 AND WR<-20,EncodeColor(colorBrightGreen),WriteIf(WR<-80 ,EncodeColor(07),EncodeColor(colorRed))) + WriteVal(WR,format=1.1) +WriteIf(WR>-80 AND WR<-20," Range"+EncodeColor(colorBrightGreen),WriteIf(WR<-80 ," OverSold"+EncodeColor(07)," OverBought"+EncodeColor(colorRed))) +"\n"+EncodeColor(colorGrey50)+"--------------------------------------" +"\n"+EncodeColor(colorGold)+"• Signal(IBuy): " + WriteIf(Ibuy,EncodeColor(colorBrightGreen)+"BuyWar ning",WriteIf(Isell,EncodeColor(colorRed)+"SellWar ning",WriteIf(BlRSI,EncodeColor(colorBrightGreen)+ "BullishZone",WriteIf(BrRSI,EncodeColor(colorRed)+ "BearishZone","Neutral")))) +"\n"+EncodeColor(colorGold)+"• Signal(TMA): " + WriteIf(TMBuy,EncodeColor(colorBrightGreen)+"Buy", WriteIf(TMSell,EncodeColor(colorRed)+"Sell",WriteIf(TMBuy1,EncodeColor(colorBrightGreen)+"Bullish",WriteIf(TMSell1,EncodeColor(colorRed)+"Bearish","Ne utral")))) +"\n"+EncodeColor(colorGold)+"• Signal(MACD): " + WriteIf(MB,EncodeColor(colorBrightGreen)+"Buy",WriteIf(MS,EncodeColor(colorRed)+"Sell",WriteIf(MB1,EncodeColor(colorBrightGreen)+"Bullish",WriteIf(MS1 ,EncodeColor(colorRed)+"Bearish","Neutral")))) +"\n"+EncodeColor(colorGold)+"• Signal(Stoch): " + WriteIf(StochBuy,EncodeColor(colorBrightGreen)+"Bu y",WriteIf(StochSell,EncodeColor(colorRed)+"Sel l", WriteIf(StBuy,EncodeColor(colorBrightGreen)+"Bulli sh",WriteIf(StSell,EncodeColor(colorRed)+"Bearis h" ,"Neutral")))) +"\n"+EncodeColor(colorGold)+"• Signal(ADX): " + WriteIf(adxBuy,EncodeColor(colorBrightGreen)+"Buy" ,WriteIf(adxSell,EncodeColor(colorRed)+"Sell",WriteIf(adxBuy1,EncodeColor(colorBrightGreen)+"Bullish ",WriteIf(adxSell1,EncodeColor(colorRed)+"Bear ish" ,"Neutral")))) +"\n"+EncodeColor(colorGrey50)+"--------------------------------------" +"\n"+ EncodeColor(47) +"• TrStop: " +EncodeColor(colorLime)+ WriteVal(TrailStop,format=1.0) + EncodeColor(47) +" TrgPrice: " + EncodeColor(colorLime)+WriteVal(Profittaker,format =1.0) +"\n"+ EncodeColor(47) +"• R1: " +EncodeColor(colorOrange)+ WriteVal(r1,format=1.0) + EncodeColor(47) +" R2: " + EncodeColor(colorOrange)+WriteVal(r2,format=1.0) + EncodeColor(47) +" R3: " + EncodeColor(colorOrange)+WriteVal(r3,format=1.0) +"\n"+ EncodeColor(47) +"• S1: " +EncodeColor(colorOrange)+ WriteVal(s1,format=1.0) + EncodeColor(47) +" S2: " + EncodeColor(colorOrange)+WriteVal(s2,format=1.0) + EncodeColor(47) +" S3: " + EncodeColor(colorOrange)+WriteVal(s3,format=1.0) +"\n"+EncodeColor(colorGrey50)+"--------------------------------------" ); //============== BACKGROUND NAME ============== //pxwidth = Status("pxwidth"); //pxheight = Status("pxheight"); //GfxSetOverlayMode(1); //GfxSetBkMode(0); // transparent //GfxSelectFont("Amienne", Status("pxheight")/15); //GfxSetTextColor( colorGrey40 ); //GfxTextOut( "Kenzie Sebastian", Status("pxwidth")/5.3, Status("pxheight")/5 ); //============================ ////BACKGROUND COLOR//////////////////////////////////////////////////////// SetChartBkColor(ColorRGB(49,79,79)); //SetChartBkGradientFill( colorPlum, colorPlum); ///////////////////////////////////////////////////////////////////////////////////// _SECTION_END(); _SECTION_BEGIN("thiru-optimum-moving"); price = ParamField("field"); n = Param("periods",34); SA=MA(Price,n); v1=(StDev(Price,n))^2; Ca=Null; Ca[n]=sa[n]; for(i=n+1; iCa)>BarsSince(Ref(Ca,-1) 0 ) a--; kd = kd + ( a * b ); } return kd; } function UzunGunTopla( Uzun ) { au = Uzun; ku = au * C; for ( iu = 0;iu < Uzun;iu++ ) { bu = Ref( C, -iu ); if ( au > 0 ) au--; ku = ku + ( au * bu ); } return ku; } Period12Toplam = KisaPeriodTopla( Kisa ); Day12Toplam = KisaGunTopla( Kisa ); LWMA12 = Day12Toplam / Period12Toplam; Period43Toplam = UzunPeriodTopla( Uzun ); Day43Toplam = UzunGunTopla( Uzun ); LWMA43 = Day43Toplam / Period43Toplam; _SECTION_END(); _SECTION_BEGIN( " TSR HESAPLANMASI" ); function XDAY( Tetik ) { X = ( ( 2 * LWMA12 ) - LWMA43 ); aX = Tetik; kX = AX * X; for ( iX = 0;iX < Tetik;iX++ ) { bX = Ref( X, -iX ); if ( aX > 0 ) aX--; kX = kX + ( aX * bX ); } return kX; } XDayToplam = XDAY( Tetik ); XPeriodToplam = TetikPeriodTopla( Tetik ); TSR = ( XDayToplam / XPeriodToplam ); _SECTION_END(); _SECTION_BEGIN( " EKRANA BASMA I.S,LEMI." ); Plot( C, "Kapanis", colorWhite, styleCandle ); tsrcolor = IIf( TSR > Ref( TSR, -1 ), colorLime, colorRed ); Plot( TSR, "TSR", tsrcolor, styleDots + styleLine ); _SECTION_END(); _SECTION_BEGIN( "EXPLORATION" ); //AL=TSR>Ref(TSR,-1); //SAT=Ref(TSR,-1)>TSR; AL = Cross( C, TSR ); SAT = Cross( TSR, C ); AL_status = WriteIf( AL, "Al?s, Yap", " " ); SAT_status = WriteIf( SAT, "Sat?s, Yap", " " ); AL_Col = IIf( AL, colorDarkGreen , colorWhite ); SAT_Col = IIf( SAT, colorRed, colorWhite ); Filter = AL OR SAT; AddColumn( C, "KAPANIS,", 1.2, IIf( C > Ref( C, -1 ), colorBlue, colorRed ) ); AddTextColumn( AL_status, "TSR ALIS,", 1.2, colorWhite, AL_col ); AddTextColumn( SAT_status, "TSR SATIS,", 1.2, colorWhite, SAT_col ); _SECTION_END(); //////////////////////////////////////////////////////////////////////////////////// TimeFrameSet(inDaily); DayHigh = LastValue(H); DayLow = LastValue(L); TimeFrameRestore(); Title = Date() + ", Op=" + Open + ", Hi=" + High + ", Lo=" + Low + ", LTP=" + Close + ", Change= " + SelectedValue( ROC( C, 1 ) ) + "%" + "\n Today`s High=" + DayHigh + ", Today`s Low=" + DayLow + " © PRIME SYSTEM" ; prev=AMA2(C,1,0); d=IIf(C>Ref(Max(Max(H,Ref(H,-20)),Max(Ref(H,-10),Ref(H,-15))),-1),Min(Min(L,Ref(L,-20)),Min(Ref(L,-10),Ref(L,-15))), IIf(CRef(state,-1); ss=stateRef(res,-1),1,IIf(CMDI(10)AND Signal(29)PDI(20)AND Signal(29)>MACD(13); Plot( 2, /* defines the height of the ribbon in percent of pane width */"ribbon", IIf( uptrend, colorGreen, IIf( downtrend, colorRed, 0 )), /* choose color */ styleOwnScale|styleArea|styleNoLabel, -0.5, 100 ); _SECTION_END(); Buy = s AND a AND uptrend ; Short = ss AND b AND downtrend ; Sell = ss AND b AND downtrend ; Cover = s AND a AND uptrend ; Buy=ExRem(Buy,Sell); Sell=ExRem(Sell,Buy); Cover=ExRem(Cover,Short); Short=ExRem(Short,Cover); Filter=Buy OR Sell; Filter= Cover OR Short; AddColumn( Buy, "Buy", 1); AddColumn(Sell, "Sell", 1); AddColumn(Close,"Close",1.2); AddColumn(Volume,"Volume",1.0); // Plot the Buy and Sell arrows. shape = Buy * shapeUpArrow + Sell * shapeDownArrow; PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorGreen, 0, L, Offset=-10); PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorLime, 0,L, Offset=-20); PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-15); PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorRed, 0, H, Offset=20); PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorOrange, 0,H, Offset=30); PlotShapes(IIf(Sell, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-25); //plot volume graph // set background gradient colours SetChartBkGradientFill( ParamColor("BgTop", ColorRGB( 172,172,172 )),ParamColor("BgBottom", ColorRGB( 102,136,187 )),ParamColor("titleblock",ColorRGB( 255,255,255 ))); GraphXSpace = 5; _SECTION_END(); _SECTION_BEGIN("Magnified Market Price"); //by Vidyasagar, vkunisetty@yahoo.com// FS=Param("Font Size",30,30,100,1); GfxSelectFont("Arial", FS, 900, italic = False, underline = False, True ); GfxSetBkMode( colorWhite ); GfxSetTextColor( ParamColor("Color",colorRed) ); Hor=Param("Horizontal Position",800,800,800,800); Ver=Param("Vertical Position",27,27,27,27); GfxTextOut(""+C,Hor , Ver ); YC=TimeFrameGetPrice("C",inDaily,-1); DD=Prec(C-YC,2); xx=Prec((DD/YC)*100,2); GfxSelectFont("Arial", 12, 700, italic = False, underline = False, True ); GfxSetBkMode( colorWhite ); GfxSetTextColor(ParamColor("Color",colorYellow) ); GfxTextOut(""+DD+" ("+xx+"%)", Hor+5, Ver+45 ); _SECTION_END();