// Intraday Statregy - ELH5 : zerolag/////////////////
_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
SetChartBkGradientFill( ParamColor("Inner panel upper",colorBlack),ParamColor("Inner panel lower",colorBlack));
pds = Param("pds", 5,1,40);
a1=EMA(EMA(H,pds),pds); //DEMA of High
a2=EMA(a1,pds);
Difference=a1-a2;
a=a1+difference; //zerolag
b1=EMA(EMA(L,pds),pds); // DEMA of Low
b2=EMA(b1,pds);
Difference=b1-b2;
b=b1+difference; //zerolag
Plot(a,"DEHi",colorBlack,4);
Plot(b,"DELi",colorBlack,4);
//.....................................................
HiDay = TimeFrameGetPrice("H", inDaily);
LoDay = TimeFrameGetPrice("L", inDaily);
Plot(HiDay ,"",colorRed,styleLine); // ,styleOwnScale);
Plot(LoDay ,"",colorBrightGreen,styleLine); // , styleOwnScale);
//================================
HiHrly = TimeFrameGetPrice("H", inHourly);
LoHrly = TimeFrameGetPrice("L", inHourly);
Plot(HiHrly ,"",10,styleLine); //,styleOwnScale );
Plot(LoHrly ,"",50,styleLine); //,styleOwnScale );
//GraphXSpace=10;
Buy = C>a AND Ref(C,-1) > Ref(a, -1);
Sell = C<b AND Ref(C,-1) < Ref(b, -1);
Col = IIf(BarsSince(Buy) > BarsSince(Sell),colorOrange,colorBrightGreen);
Plot( C, "Cl.", Col, styleCandle );
Buy=ExRem(Buy,Sell);
Sell=ExRem(Sell,Buy);
shape=Buy*shapeUpArrow + Sell*shapeDownArrow;
PlotShapes( shape, IIf( Buy, colorBrightGreen, colorRed ),0, IIf( Buy, Low, High ),Offset=-15 );
//PlotShapes(shapeSmallCircle*(H==HiDay),colorBlue,0,H,20);
//PlotShapes(shapeSmallCircle*(L==Loday),colorBlue,0,L,-20);
PlotShapes(shapeStar*(H==HiHrly),4,0,H,20);
PlotShapes(shapeStar*(L==LoHrly),51,0,L,-20);
GraphXSpace =5;
dist = 1.5*ATR(10);
for( i = 0; i < BarCount; i++ )
{
if( Buy[i] ) PlotText( "Ln@\n" + L[ i ], i, L[ i ]-dist[i], colorBrightGreen);
if( Sell[i] ) PlotText( "Srt@\n" + H[ i ], i, H[ i ]+dist[i], colorOrange);
}
DayChange = Day() != Ref(Day(), -1);
AvgTradePrice = Null;
CurDayBars = 0;
CurDayCloseSum = 0;
for (i = 0; i < BarCount; i++)
{
if (DayChange[i])
{
CurDayCloseSum = C[i];
CurDayBars = 1;
}
else
{
CurDayCloseSum = CurDayCloseSum + C[i];
CurDayBars++;
}
AvgTradePrice[i] = CurDayCloseSum / CurDayBars;
}
Plot(AvgTradePrice, "AvgTradePrice", 11, 1);
//PlotShapes(shapeCircle * DayChange, colorBlue, 0, C, 0);
//DH = HHV(H, DayChange);
//DL = LLV(L, DayChange);
//R1=((DH-DL)*0.33)+DL;
//R2=((DH-DL)*0.67)+DL;
//Plot(R1,"\nFib1",40,styleLine,styleThick);
//Plot(R2,"\nFib2",40,styleLine,styleThick);
_SECTION_BEGIN("trending ribbon");
GraphXSpace=20;
uptrend =PDI()>MDI()AND Signal()<MACD();
downtrend =MDI()>PDI()AND Signal()>MACD();
Plot( 2, /* defines the height of the ribbon in percent of pane width*/"ribbon",
IIf( uptrend, colorBrightGreen, IIf( downtrend, colorRed, 0 )), /* choose color */styleOwnScale|styleArea|styleNoLabel, -1, 100 );
_SECTION_END();
if( ParamToggle("Tooltip shows", "All Values|Only Prices" ) )
{
ToolTip=StrFormat("Open: %g\nHigh: %g\nLow: %g\nClose: %g (%.1f%%)\nVolume: "+NumToStr( V, 1.0 ), O, H, L, C, SelectedValue( ROC( C, 1 )));
}
Title =
EncodeColor(colorBrightGreen)+ "zerolag" + " : " + Name() + " : " + EncodeColor(colorBrightGreen)+ Interval(1)
+ EncodeColor(colorBrightGreen) + " : " + Date() +" "
+"\n"+EncodeColor(10) +"Open -"+O +" ,"+" High -"+H +" ,"+" Low -"+L +" , "+ " Close -"+C +" , "+"Pr. Chng : " +StrFormat("%.2f%",C-Ref(C,-1))+ " , Volume : "+ WriteVal(V,1.0)
+EncodeColor(colorAqua)+ "\n Dz Hi : "+ EncodeColor(10)+WriteVal(a,1.2)
+EncodeColor(colorRed) + "\n Dz Lo : "+ EncodeColor(colorRed)+WriteVal(b,1.2)+"\n"+"\n"+
EncodeColor(colorBrightGreen) + "Day's Range = Rs." + EncodeColor(colorBrightGreen) + StrToNum(NumToStr((HiDay - LoDay), 1.2))+ "\n"+
EncodeColor(colorWhite) + "Hi of Day = Rs." + EncodeColor(colorWhite) + Hiday + "\n" +
EncodeColor(colorWhite) + "Lo of Day = Rs." + EncodeColor(colorWhite) + Loday + "\n" + "\n"+
EncodeColor(colorBrightGreen) + "Hourly Range = Rs." + EncodeColor(colorBrightGreen) + StrToNum(NumToStr((Hihrly - Lohrly), 1.2))+"\n"+
EncodeColor(colorWhite) + "Hi of Hr = Rs." + EncodeColor(colorWhite) + HiHrly + "\n" +
EncodeColor(colorWhite) + "Lo of Hr = Rs." + EncodeColor(colorWhite) + LoHrly + "\n" +"\n"+
EncodeColor(10)+"A.T.P : Rs. "+ EncodeColor(10)+AvgTradePrice ;
//EncodeColor(10)+"F2: Rs."+EncodeColor(10)+R2+"\n"+
//EncodeColor(10)+"F1: Rs."+EncodeColor(10)+R1+
_SECTION_BEGIN("Magnified Market Price");
//by Vidyasagar, vkunisetty@yahoo.com//
FS=Param("Font Size",28,11,100,1);
GfxSelectFont("Arial", FS, 700, italic = False, underline = False, True );
GfxSetBkMode( colorWhite );
GfxSetTextColor( ParamColor("Color",colorViolet) );
Hor=Param("Horizontal Position",766,1,1200,1);
Ver=Param("Vertical Position",1,1,1,1);
GfxTextOut("C:"+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",colorViolet) );
//GfxTextOut(""+DD+" ("+xx+"%)", Hor+5, Ver+45 );
_SECTION_END();