// Downloaded From https://www.WiseStockTrader.com _SECTION_BEGIN("Price"); SetChartOptions(0,chartShowArrows|chartShowDates); _N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) )); TimeFrameSet(inDaily); MA3 = MA(C,3); Cl = C; TimeFrameRestore(); MA3=(TimeFrameExpand( MA3, inDaily)); Cl=(TimeFrameExpand( Cl, inDaily)); barcolor =IIf(C > MA3 , colorGreen,IIf(C < MA3,colorRed, colorBlack) ); Plot( C, "Close", barcolor , styleNoTitle |styleBar); //Plot(MA(C,100) , "", colorBlue, styleLine); //Plot(MA(C,200) , "", colorCustom12, styleLine); r1 = Param( "Fast avg", 12, 2, 200, 1 ); r2 = Param( "Slow avg", 26, 2, 200, 1 ); r3 = Param( "Signal avg", 9, 2, 200, 1 ); //Plot( ml = MACD(r1, r2), StrFormat(_SECTION_NAME()+"(%g,%g)", r1, r2), ParamColor("MACD color", colorRed ), ParamStyle("MACD style") ); //Plot( sl = Signal(r1,r2,r3), "Signal" + _PARAM_VALUES(), ParamColor("Signal color", colorBlue ), ParamStyle("Signal style") ); //Plot( ml-sl, "MACD Histogram", ParamColor("Histogram color", colorBlack ), styleNoTitle | ParamStyle("Histogram style", styleHistogram | styleNoLabel, maskHistogram ) ); ml = MACD(r1, r2); sl = Signal(r1,r2,r3); xx = ml-sl; Plot(ValueWhen((Cross(xx,0 )OR Cross(0,xx)), C),"", colorRed, styleDashed|styleNoRescale|styleThick); function PercentR( periods ) { return -100 * ( HHV( H, periods ) - C )/( HHV( H, periods ) - LLV( L, periods ) ); } xx= 100- abs(PercentR( 25 )); tt= (RSI( 25) + xx)/2; //Plot( EMA(tt,5) ,"PercentR", barcolor , 1+4) ; qq = EMA(tt,5); //Plot(MA(qq,34) , "", colorBlue, styleLine); per =5; x = Cum(1); s1=qq; s11=qq; pS = TroughBars( s1, per, 1 ) == 0; endt= LastValue(ValueWhen( pS, x, 1 )); startt=LastValue(ValueWhen( pS, x, 2 )); dtS =endt-startt; endS = LastValue(ValueWhen( pS, s1, 1 ) ); startS = LastValue( ValueWhen( pS, s1, 2 )); aS = (endS-startS)/dtS;bS = endS; trendlineS = aS * ( x -endt ) + bS; pR = PeakBars( s11, per, 1 ) == 0; endt1= LastValue(ValueWhen( pR, x, 1 )); startt1=LastValue(ValueWhen( pR, x, 2 )); dtR =endt1-startt1; endR = LastValue(ValueWhen( pR, s11, 1 ) ); startR = LastValue( ValueWhen( pR, s11, 2 )); aR = (endR-startR)/dtR; bR = endR; trendlineR = aR * ( x -endt1 ) + bR; //Buy = (S1==trendlineS );// AND qq <= 20; //Sell = (S11==trendlineR );// AND qq >= 70; //Buy = ExRem( Buy, Sell ); //Sell = ExRem( Sell, Buy )PlotShapes( Buy * shapeUpArrow + Sell * shapeDownArrow, IIf( Buy, colorGreen , colorRed) ); //dist = 2.5*ATR(10); //for( i = 0; i < BarCount; i++ ) { //if( Buy[i] ) PlotText( "Buy " + L[ i ], i, L[ i ]-dist[i], colorGreen ); //if( Sell[i] ) PlotText( "Sell " + H[ i ], i, H[ i ]+dist[i], colorRed); } _SECTION_END();