// Downloaded From https://www.WiseStockTrader.com _SECTION_BEGIN("1........Trend Detection"); // Trend Detection // Graham Kavanagh 11 Jan 05 // I am using version 4.66.2, but believe this will work with last offical version. function Rise( Pd, perd, Pl, perl ) { MAD = DEMA(Pd,perd); MAL = LinearReg(Pl,perl); CondR = ROC(MAD,1)>0 AND ROC(MAL,1)>0; CondF = ROC(MAD,1)<0 AND ROC(MAL,1)<0; R[0] = C[0]>(H[0]+L[0])/2; for(i=1;i 0 AND ROC(Confirm,5) > 0; Downward = ROC(Confirm,1) < 0 AND ROC(Confirm,5) < 0; Select = Rs AND Ref(Fs,-1); Caution = Fs AND Ref(Rs,-1); Change = IIf( Rs, H/ValueWhen(Fs,L)*100, L/ValueWhen(Rs,H)*100 ); Plot( C, "close", IIf( Rs, colorGreen, IIf( Fs, colorRed, colorBlack )), styleBar); PlotShapes( shapeSmallCircle* select, colorDarkGreen, 0, H, 5 ); PlotShapes( shapeSmallCircle* Caution, colorDarkRed, 0, L, -5 ); GraphXSpace=10; _N( Title = "{{NAME}} - {{INTERVAL}} {{DATE}} Trend Plot - "+prdd+" Day" ); Buy = Select ; Sell = Caution ; Filter = Select OR Caution; AddColumn( Select, "UpTurn", 1 ); AddColumn( Caution, "DownTurn", 1 ); AddColumn(IIf(Buy, 66,IIf(Sell, 83,Null )),"2LineB/S",formatChar,IIf(Buy,colorGreen,IIf(Sell,colorRed,colorDefault)),colorDefault,width = 60); AddColumn(C, "Close", 1.2); // ---indicator end--- "Rise = " + Rs; "Fall = " + Fs; "Current Trend Bars = " + Bs; "Trend Move = " + Change + " %"; _SECTION_END();