//////************** By Easyalgo.in *************////// ////// +91-8448735946, Support@easyalgo.in /////////// //***************************************************// _SECTION_BEGIN("New Chart"); barcolor = ((IIf(C>O,colorGreen,colorRed))); SetBarFillColor(barcolor); Plot( C, "Price", barcolor, styleCandle ); //////************** By Easyalgo.in *************////// ////// +91-8448735946, Support@easyalgo.in /////////// //***************************************************// GfxSelectFont( "Tahoma", 11, 110 ); GfxSetBkMode( 1 ); GfxSetTextColor( colorWhite ); SetChartOptions(0,chartShowArrows|chartShowDates); SetBarsRequired(sbrAll,sbrAll); GraphXSpace=10; GfxSelectPen( colorGreen, 2 ); GfxSelectSolidBrush( colorDarkTeal); GfxRectangle( 3, 2, 1580, 53 ); GfxSelectFont( "Tahoma", 12, 350 ); GfxSetBkMode( 1 ); GfxSetTextColor( colorBrightGreen ); GfxTextOut(""+Interval(2),30,15); GfxSetTextColor(colorred ); GfxTextOut(" "+DateTimeToStr(SelectedValue(DateTime())),30*4.5,15); GfxSetTextColor( colorAqua ); GfxTextOut("Open = "+open,30*12.5,15); GfxSetTextColor( colorbrightGreen ); GfxTextOut("High = "+high,30*18,15); GfxSetTextColor( colorRed ); GfxTextOut("Low = "+low,30*23.5,15); GfxSetTextColor( colorYellow ); GfxTextOut("Close = "+close,30*30,15); GfxSetTextColor( colorTurquoise ); GfxTextOut("ROC % = "+Prec(SelectedValue( ROC( C, 1 ) ),2),30*36,15); GfxSetTextColor( colorOrange ); GfxTextOut("Volume = "+Volume,30*44,15); //////************** By Easyalgo.in *************////// ////// +91-8448735946, Support@easyalgo.in /////////// //***************************************************// _SECTION_END(); _SECTION_BEGIN("Intraday Timing Condition"); YFirstTradeTime = ParamTime( "Start Time", "09:15" ); // Earliest time to take a trade YLastTradeTime = ParamTime( "End Time", "14:45" ); // Latest time to take new trades YExitAllPositionsTime = ParamTime( "Exit Time", "15:00" ); // Exit all trades YEntrytimecondition = (TimeNum() >= YFirstTradeTime AND TimeNum() <= YLastTradeTime ); Exittimecondition = Cross(TimeNum(),YExitAllPositionsTime); SetTradeDelays(0,0,0,0); _SECTION_END(); _SECTION_BEGIN("Supertrend 1"); trend=0; function FunctionST (Period, Multiplier) { ATR_Val=ATR(Period); UpperBand=LowerBand=final_UpperBand=final_LowerBand=SuperTrend=0; ///////// CALCULATE SUPERTRENT ////////// for( i = Period; i < BarCount; i++ ) { UpperBand[i]=((High[i] + Low[i])/2) + Multiplier*ATR_Val[i]; LowerBand[i]=((High[i] + Low[i])/2) - Multiplier*ATR_Val[i]; final_UpperBand[i] = IIf( ((UpperBand[i]final_UpperBand[i-1])), (UpperBand[i]), final_UpperBand[i-1]); final_LowerBand[i] = Iif( ((LowerBand[i]>final_LowerBand[i-1]) OR (Close[i-1]=final_UpperBand[i])),final_LowerBand[i], IIf(((SuperTrend[i-1]==final_LowerBand[i-1]) AND (Close[i]>=final_LowerBand[i])),final_LowerBand[i], IIf(((SuperTrend[i-1]==final_LowerBand[i-1]) AND (Close[i]<=final_LowerBand[i])),final_UpperBand[i],0)))); } Plot( SuperTrend, "SuperTrend", (IIf( SuperTrend>Close, colorRed , colorBrightGreen )), styleLine |styleThick ); Trend = IIf(SuperTrend>Close, -1, IIf(SuperTrendfinal_UpperBand2[i-1])), (UpperBand2[i]), final_UpperBand2[i-1]); final_LowerBand2[i] = Iif( ((LowerBand2[i]>final_LowerBand2[i-1]) OR (Close[i-1]=final_UpperBand2[i])),final_LowerBand2[i], IIf(((SuperTrend2[i-1]==final_LowerBand2[i-1]) AND (Close[i]>=final_LowerBand2[i])),final_LowerBand2[i], IIf(((SuperTrend2[i-1]==final_LowerBand2[i-1]) AND (Close[i]<=final_LowerBand2[i])),final_UpperBand2[i],0)))); } //Plot( SuperTrend2, "SuperTrend2", (IIf( SuperTrend2>Close, colorRed , colorbrightGreen )), styleLine |styleThick); Trend2 = IIf(SuperTrend2>Close, -1, IIf(SuperTrend2Close, colorRed , colorbrightGreen )), styleLine |styleThick); } else { Brule2 = Ref( Trend ==1,-1); Srule2 = Ref( Trend ==-1,-1); _Sell = Ref(/*Cross(OSZ,_RSI) OR*/ ( Ref(trend==1,-1) AND trend==-1 ),-1); _Cover = Ref(/*Cross(_RSI,OBZ)OR */(Ref(trend==-1,-1) AND trend==1 ),-1); } Brule= Brule2 AND H > _high AND O< _high AND Bcandle AND penny; Srule = Srule2 AND L<_low AND O > _low AND Scandle AND penny; _buy = brule; _Short = Srule; //////************** By Easyalgo.in *************////// ////// +91-8448735946, Support@easyalgo.in /////////// //***************************************************// check=0; trailARRAY = Null; trailstop = 0; trailARRAY1 = Null; trailstop1 = 0; Stflag=Btflag=0; Buy = Sell = Short = Cover = TSL = Null; LongFlag = ShortFlag = Target = _BuyPrice = ShortTarget = 0; //Simple flags Starget= sstoploss = _Shortprice = BP=SP=BT=ST=BSL=SSL= Stoploss=BP=SP=LF=SF=0; //Using Loop to generate signals for( i = 0; i < BarCount; i++ ) { /////////////////////////////////////////Long Positions if( _Buy[ i ] AND LongFlag == 0 AND ShortFlag==0) { Buy[ i ] = 1; BuyPrice[i]=_high[i]; _BuyPrice = _high[i]; LongFlag = 1; trailstop = High[ i ] * ( 1 - Trailby / 100 ); if(type=="POINT") { Target = _BuyPrice[i] + tp ; Stoploss = Blow[i];//_BuyPrice[i] - SL; } else { Target = _BuyPrice[i] + (_BuyPrice[i]*(tp/100)) ; Stoploss = Blow[i];//_BuyPrice[i] - (_BuyPrice[i]*(SL/100)); } } if( LongFlag==1 AND High[i]>Target[i] ) { BTflag=1; } //else if( LongFlag==1 AND L[i] < stoploss[i] AND NOT _rsi[i]>OBZ) { Sell[ i ] = 1; SellPrice[i] = stoploss[i]; LongFlag = 0; trailstop = 0; BTflag=0; } if( trailstop > 0 AND Low[ i ] < trailstop AND LongFlag==1 AND Btflag==1 ) { Sell[ i ] = 1; SellPrice[ i ] = trailstop; trailstop = 0; LongFlag = 0; BTflag=0; } if( trailstop > 0 AND LongFlag==1 AND Btflag==1) { trailstop = Max( High[ i ] * ( 1 - Trailby / 100 ), trailstop ); trailARRAY[ i ] = trailstop; } // else // if(LongFlag==1 AND Exittimecondition[i]) //{ // Sell[ i ] = 1; // SellPrice[i] = Open[i]; // LongFlag = 0; //} if(LongFlag==1 AND _Sell[i]) { Sell[ i ] = 1; SellPrice[i] = Open[i]; LongFlag = 0; trailstop = 0; BTflag=0; } /////////////////////////////////////////////////Short Positions if( _Short[ i ] AND LongFlag == 0 AND ShortFlag==0) { Short[ i ] = 1; ShortPrice[i]=_low[i]; _ShortPrice = _low[i]; ShortFlag = 1; trailstop1 = low[ i ] * ( 1 + Trailby / 100 ); if(type=="POINT") { STarget = _ShortPrice - tp ; SStoploss = shigh[i];//_ShortPrice + SL; } else { STarget = _ShortPrice[i] - (_ShortPrice[i]*(tp/100)) ; SStoploss = shigh[i];//_ShortPrice[i] + (_ShortPrice[i]*(SL/100)); } } if( ShortFlag==1 AND High[i]>SStoploss[i] AND NOT _rsi[i] 0 AND high[ i ] > trailstop1 AND shortFlag==1 AND STflag==1) { Cover[ i ] = 1; coverPrice[ i ] = trailstop1; trailstop1 = 0; shortFlag = 0; STflag=0; } if( trailstop1 > 0 AND shortFlag==1 AND STflag==1) { trailstop1 = min( low[ i ] * ( 1 + Trailby / 100 ), trailstop1 ); trailARRAY1[ i ] = trailstop1[i]; Check[i] =trailstop1[i]; } if(ShortFlag==1 AND _Cover[i]) { cover[ i ] = 1; coverPrice[i] = Open[i]; ShortFlag = 0; trailstop1 = 0; STflag=0; } //////////////// Reinitiate for reverse signal/////////////////////////// BT[i] = Target[i]; ST[i] = STarget[i]; BSL[i] = Stoploss[i]; SSL[i]=SStoploss[i]; BP[i]=_buyprice[i]; SP[i]=_shortprice[i]; LF[i] = Longflag[i]; SF[i] = Shortflag[i]; BTF[i]=BTflag[i]; STF[i] = STflag[i]; } "_Buy = "+_Buy; "_Short = "+_Short; "_Sell = "+_Sell; "_cover = "+_cover; "BTF = "+BTF; "STF = "+STF; "BT = "+BT; "ST = "+ST; "BSL = "+BSL; "SSL = "+SSL; "BP = "+BP; "LF = "+LF; "SF = "+SF; "SP = "+SP; Buyflag = Flip(Buy,Sell); Shortflag11 = Flip(Short,cover); "Shortflag11 = "+Shortflag11; " Buyflag = "+Buyflag; "trailARRAY1 = "+trailARRAY1; "Check = "+check; Plot(IIf(Buyflag,trailARRAY,Null),"trailARRAY",colorBlue,styleThick); Plot(IIf(Shortflag11,trailARRAY1,Null),"trailARRAY1",colorBlue,styleThick); Plot(IIf(Buyflag,BT,Null),"BT",colorAqua,styleDots); Plot(IIf(Shortflag11,ST,Null),"ST",colorAqua,styleDots); Plot(IIf(Buyflag,BSL,Null),"BSL",colorred,styleDots); Plot(IIf(Shortflag11,SSL,Null),"SSL",colorred,styleDots); Plot(IIf(Buyflag,_High,Null),"High",colorWhite,styleDots); Plot(IIf(Shortflag11,_Low,Null),"Low",colorWhite,styleDots); 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( Sell , shapeDownArrow, shapeNone ), colorRed, 0, H+1, 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 ); PlotShapes( IIf( Cover , shapeUpArrow, shapeNone ), colorBlue, 0, L, Offset = -45 ); //////************** By Easyalgo.in *************////// ////// +91-8448735946, Support@easyalgo.in /////////// //***************************************************// GfxSetBkMode(1); _SECTION_BEGIN("NMN Chart Stamp"); SetFormulaName("NMN Chart Stamp"); GfxFont = "Times New Roman"; GfxSetOverlayMode(0); GfxSelectFont(GfxFont, Status("pxheight")/25); GfxSetTextAlign(6); // center alignment GfxSetTextColor(ColorRGB(100,100,100)); GfxSetBkMode(0); // transparent GfxTextOut(Name(), Status("pxwidth")/2, Status("pxheight")/12); GfxSetTextColor(ColorRGB(200,200,200)); GfxTextOut("Easyalgo.in", Status("pxwidth")/1.15, Status("pxheight")/1.15); //GfxSelectFont(GfxFont, Status("pxheight")/28); //GfxSelectFont(GfxFont, Status("pxheight")/18); //GfxSelectFont("Tahoma", Status("pxheight")/18); _SECTION_END();