// Downloaded From https://www.WiseStockTrader.com /*optimizing factor*/ OPT1 = Optimize( "OPT1", 15, 10, 30, 2 ); OPT2= Optimize("OPT2", 30, 20, 60, 5 ); OPT3 = Optimize( "OPT3", 50, 40, 120, 10 ); OPT4= Optimize("OPT4", 10, 1, 20, 1 ); OPT5 = Optimize( "OPT5", 20, 1, 50, 1 ); OPT6= Optimize("OPT6", 9, 4, 20, 2 ); OPT7 = Optimize( "OPT7", 1, 1, 10, 2 ); OPT8= Optimize("OPT8", 2, 1, 10, 2 ); /*Buy/Sell Conditions (In Example, Long trade only)*/ Buy = ((EMA(C,OPT1)>EMA(C,OPT2)AND EMA(C,OPT2)>EMA(C,OPT3))AND(Cross(EMA(C,OPT4),EMA(C,OPT5)))) OR ((EMA(C,OPT2)>EMA(C,OPT1)AND EMA(C,OPT1)>EMA(C,OPT3))AND(Cross(StochK(OPT6,OPT7),StochD(OPT6,OPT7,OPT8)))) OR Cross(EMA(C,OPT2),EMA(C,OPT3)); Sell = Cross(EMA(C,OPT5),EMA(C,OPT4)) OR (Cross(StochD(OPT6,OPT7,OPT8),StochK(OPT6,OPT7))AND(EMA(C,OPT2)>EMA(C,OPT1)AND EMA(C,OPT1)>EMA(C,OPT3))); Short = 0; Cover = 0; /*Display Buy/Sell signal*/ shape = Buy * shapeUpArrow + Sell * shapeDownArrow; PlotShapes( shape, IIf( Buy, colorGreen, colorRed ),0, IIf( Buy, Low, High ) ); /*Display Buy/Sell price*/ GraphXSpace = 5; dist = 1.5*ATR(10); for( i = 0; i < BarCount; i++ ) { if( Buy[i] ) PlotText( "Buy\n@" + C[ i ], i, L[ i ]-dist[i], colorGreen ); if( Sell[i] ) PlotText( "Sell\n@" + C[ i ], i, H[ i ]+dist[i], colorRed); } /*Display indicators*/ Plot(EMA(C,10),"EMA short", colorGreen ); Plot(EMA(C,20),"EMA long", colorRed ); /*Trying to insert Bullish/Bearish Ribbon*/ Plot( 1,"Ribbon", IIf( EMA( Close , 15 )> EMA( Close , 30)AND EMA( Close , 30 )> EMA( Close , 50), colorGreen, IIf( (EMA( Close , 15 )< EMA( Close , 30)AND EMA( Close , 30 )> EMA( Close , 50)), colorGold, colorRed )), styleOwnScale|styleArea|styleNoLabel,0, 50 );