Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* wayneL's Daytrading Template - To be plotted on intraday charts */
- GraphXSpace = 0;
- /* This plots the price bars. Select whether you want candlesticks or ordinary bars via th "view" menu */
- _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 ) ) ));
- Plot( C, "Close", ParamColor("Color", colorWhite ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
- _SECTION_END();
- /* The next section calculates and plots the dynamic 3 day pivots */
- _SECTION_BEGIN("3 Day Pivots");
- Hi1 = IIf(Day()!=Ref(Day(),-1),Ref(HighestSince(Day()!=Ref(Day(),-1),H,3),-1),0);
- Hi = ValueWhen(Day()!=Ref(Day(),-1),Hi1,1);
- Lo1 = IIf(Day()!=Ref(Day(),-1),Ref(LowestSince(Day()!=Ref(Day(),-1),L,3),-1),0);
- Lo = ValueWhen(Day()!=Ref(Day(),-1),Lo1,1);
- Cl1 = IIf(Day()!=Ref(Day(),-1),Ref(C,-1),0);
- Cl = ValueWhen(Day()!=Ref(Day(),-1),Cl1,1);
- rg = (Hi - Lo);
- bp = (Hi + Lo + Cl)/3;
- r1 = (bp*2)-Lo;
- s1 = (bp*2)-Hi;
- r2 = bp + r1 - s1;
- s2 = bp - r1 + s1;
- Plot(s2,"",colorYellow,styleLine|styleNoRescale|styleNoLabel);
- Plot(r2,"",colorOrange,styleLine|styleNoRescale|styleNoLabel);
- Plot(s1,"",colorYellow,styleLine|styleNoRescale|styleNoLabel);
- Plot(r1,"",colorOrange,styleLine|styleNoRescale|styleNoLabel);
- _SECTION_END();
- /* This next section calculates and plots the daily pivots using fibonacci ranges */
- _SECTION_BEGIN("Daily Fib Pivots");
- Hi1 = IIf(Day()!=Ref(Day(),-1),Ref(HighestSince(Day()!=Ref(Day(),-1),H,1),-1),0);
- Hi = ValueWhen(Day()!=Ref(Day(),-1),Hi1,1);
- Lo1 = IIf(Day()!=Ref(Day(),-1),Ref(LowestSince(Day()!=Ref(Day(),-1),L,1),-1),0);
- Lo = ValueWhen(Day()!=Ref(Day(),-1),Lo1,1);
- Cl1 = IIf(Day()!=Ref(Day(),-1),Ref(C,-1),0);
- Cl = ValueWhen(Day()!=Ref(Day(),-1),Cl1,1);
- rg = (Hi - Lo);
- bp = (Hi + Lo + Cl)/3;
- r1 = (bp*2)-Lo;
- s1 = (bp*2)-Hi;
- r2 = bp + rg;
- s2 = bp - rg;
- r2o = bp + (1.272*rg);
- s2o = bp - (1.272*rg);
- rh = bp + (0.5*rg);
- rl = bp - (0.5*rg);
- rh6 = bp + (0.618*rg);
- rl6 = bp - (0.618*rg);
- Plot(s2,"",colorGreen,styleBar|styleNoRescale|styleNoLabel);
- Plot(r2,"",colorRed,styleBar|styleNoRescale|styleNoLabel);
- Plot(rh,"",colorWhite,styleBar|styleNoRescale|styleNoLabel);
- Plot(rl,"",colorRed,styleBar|styleNoRescale|styleNoLabel);
- Plot(bp,"",colorBlue,styleThick|styleNoRescale|styleNoLabel);
- Plot(rh6,"",colorWhite,styleBar|styleNoRescale|styleNoLabel);
- Plot(rl6,"",colorWhite,styleBar|styleNoRescale|styleNoLabel);
- Plot(r2o,"",colorWhite,styleBar|styleNoRescale|styleNoLabel);
- Plot(s2o,"",colorGreen,styleBar|styleNoRescale|styleNoLabel);
- _SECTION_END();
- //--end----------------------------------------------------------------------------
- _SECTION_BEGIN("Parameters");
- LB1= Param("Long LookBack Periods",42,1,60,1);
- LB3= Param("Mid LookBack Periods",18,1,30,1);
- LB2= Param("Short LookBack Periods",6,1,30,1);
- _SECTION_END();
- _SECTION_BEGIN("ResistanceLong");
- RsColor=ParamColor("LongResColor",colorOrange);
- BrCount=Param("LongBarLength",65,1,500,1);
- for (i=0;i<BarCount-BrCount;i++) //hide the line except most recent 10 bars
- {
- RsColor[i] = colorBlack;
- }
- flowerClose = EMA((Open+High+Low+Close)/4,3) ;
- flowerOpen = EMA((Ref(Open,-1) + Ref(flowerClose,-1))/2,3);
- Temp = Max(High, flowerOpen);
- flowerHigh = EMA(Max(Temp, flowerClose),3);
- Temp = Min(Low,flowerOpen);
- flowerLow = EMA(Min(Temp, flowerClose),3);
- R=ValueWhen(Cross(MA(flowerClose,LB1),C),HHV(flowerHigh,LB1),-1);
- Plot(R,"Resistance",RsColor,ParamStyle("LongResStyle",styleNoTitle|styleLine|styleDots|styleStaircase|styleThick,maskAll));
- _SECTION_END();
- _SECTION_BEGIN("ResistanceMid");
- Rs3Color=ParamColor("MidResColor",colorCustom4);
- BrCount3=Param("MidBarLength",40,1,500,1);
- for (i=0;i<BarCount-BrCount3;i++) //hide the line except most recent 10 bars
- {
- Rs3Color[i] =colorBlack;
- }
- flowerClose = EMA((Open+High+Low+Close)/4,3) ;
- flowerOpen = EMA((Ref(Open,-1) + Ref(flowerClose,-1))/2,3);
- Temp = Max(High, flowerOpen);
- flowerHigh = EMA(Max(Temp, flowerClose),3);
- Temp = Min(Low,flowerOpen);
- flowerLow = EMA(Min(Temp, flowerClose),3);
- RM2=ValueWhen(Cross(EMA(flowerClose,LB3),C),HHV(flowerHigh,LB3),-1);
- Plot(RM2,"MidRes",Rs3Color,ParamStyle("MidResStyle",styleLine|styleStaircase|styleNoTitle,maskAll));
- _SECTION_END();
- _SECTION_BEGIN("ResistanceShort");
- Rs2Color=ParamColor("ShortResColor",colorCustom12);
- BrCount2=Param("ShortResLength",12,1,500,1);
- for (i=0;i<BarCount-BrCount2;i++) //hide the line except most recent 10 bars
- {
- Rs2Color[i] = colorBlack;
- }
- flowerClose = EMA((Open+High+Low+Close)/4,3) ;
- flowerOpen = EMA((Ref(Open,-1) + Ref(flowerClose,-1))/2,3);
- Temp = Max(High, flowerOpen);
- flowerHigh = EMA(Max(Temp, flowerClose),3);
- Temp = Min(Low,flowerOpen);
- flowerLow = EMA(Min(Temp, flowerClose),3);
- RM=ValueWhen(Cross(TEMA(flowerClose,LB2),C),HHV(flowerHigh,LB2),-1);
- Plot(RM,"ShortRes",Rs2Color,ParamStyle("ShortResStyle",styleDashed|styleThick|styleNoTitle|styleStaircase,maskAll));
- _SECTION_END();
- _SECTION_BEGIN("SupportLong");
- Sup1Color=ParamColor("LongSupColor",colorBlue);
- BrCount4=Param("LongSupBarLength",65,1,500,1);
- for (i=0;i<BarCount-BrCount4;i++) //hide the line except most recent 10 bars
- {
- Sup1Color[i] =colorBlack;
- }
- flowerClose = EMA((Open+High+Low+Close)/4,3) ;
- flowerOpen = EMA((Ref(Open,-1) + Ref(flowerClose,-1))/2,3);
- Temp = Max(High, flowerOpen);
- flowerHigh = EMA(Max(Temp, flowerClose),3);
- Temp = Min(Low,flowerOpen);
- flowerLow = EMA(Min(Temp, flowerClose),3);
- S=ValueWhen(Cross(MA(flowerClose,LB1),C),LLV(flowerLow,LB1),-1);
- Plot(s,"Support",Sup1Color,ParamStyle("SupStyle",styleLine|styleDots|styleStaircase|styleThick|styleNoTitle,maskAll));
- _SECTION_END();
- _SECTION_BEGIN("SupportMid");
- Sup3Color=ParamColor("MidSupColor",colorDarkYellow);
- BrCount6=Param("MidBarLength",40,1,500,1);
- for (i=0;i<BarCount-BrCount6;i++) //hide the line except most recent 10 bars
- {
- Sup3Color[i] =colorBlack;
- }
- flowerClose = EMA((Open+High+Low+Close)/4,3) ;
- flowerOpen = EMA((Ref(Open,-1) + Ref(flowerClose,-1))/2,3);
- Temp = Max(High, flowerOpen);
- flowerHigh = EMA(Max(Temp, flowerClose),3);
- Temp = Min(Low,flowerOpen);
- flowerLow = EMA(Min(Temp, flowerClose),3);
- SM2=ValueWhen(Cross(EMA(flowerClose,LB3),C),LLV(flowerLow,LB3),-1);
- Plot(SM2,"MidSup",Sup3Color,ParamStyle("MidSupStyle",styleLine|styleStaircase|styleNoTitle,maskAll));
- _SECTION_END();
- _SECTION_BEGIN("SupportShort");
- Sup2Color=ParamColor("ShortSupColor",colorPink);
- BrCount5=Param("ShortSupBarLength",12,1,500,1);
- for (i=0;i<BarCount-BrCount5;i++) //hide the line except most recent 10 bars
- {
- Sup2Color[i] =colorBlack;
- }
- flowerClose = EMA((Open+High+Low+Close)/4,3) ;
- flowerOpen = EMA((Ref(Open,-1) + Ref(flowerClose,-1))/2,3);
- Temp = Max(High, flowerOpen);
- flowerHigh = EMA(Max(Temp, flowerClose),3);
- Temp = Min(Low,flowerOpen);
- flowerLow = EMA(Min(Temp, flowerClose),3);
- SM=ValueWhen(Cross(TEMA(flowerClose,LB2),C),LLV(flowerLow,LB2),-1);
- Plot(SM,"ShortSup",Sup2Color,ParamStyle("ShortSupStyle",styleDashed|styleThick|styleNoTitle|styleStaircase,maskAll));
- _SECTION_END();
- _SECTION_BEGIN("Isfandi Technical Viewer");
- //Plot(C,"",ParamColor( "Color", colorBlue ),ParamStyle("Style") );
- //---- pivot points
- GfxSetBkColor(colorBlack);
- GfxSetTextColor( colorGrey50 );
- GfxSelectFont("Edwardian Script ITC", 25, 500, True );
- DayH = TimeFrameGetPrice("H", inDaily, -1);// yesterdays high
- DayL = TimeFrameGetPrice("L", inDaily, -1);//low
- DayC = TimeFrameGetPrice("C", inDaily, -1);//close
- DayO = TimeFrameGetPrice("O", inDaily);// current day open
- HiDay = TimeFrameGetPrice("H", inDaily);
- LoDay = TimeFrameGetPrice("L", inDaily);
- PP = (DayH + DayL + DayO + DayO) / 4 ;
- R1 = (2 * PP) - DayL;
- S1 = (2 * PP) - DayH;
- R2 = PP + R1 - S1;
- S2 = PP + S1 - R1;
- R3 = R2 + (R1 - PP);
- S3 = S2 - (PP - S1);
- radius = 0.1 * Status("pxheight"); // get pixel height of the chart and use 45% for pie chart radius
- textoffset = 0.1 * radius;
- //====================
- GfxSetOverlayMode(0);
- //-Paint Background
- GfxSelectSolidBrush( colorBlack);
- GfxSelectPen( colorPink);
- GfxRoundRect( 2, 30, 500, 49, 32, 32);
- GfxSetBkMode( 1 );
- GfxSelectFont("Arial", 8, 900);
- // OTHER INDICATOR
- MOMETUM =RSI(14);
- radius = 0.1 * Status("pxheight"); // get pixel height of the chart and use 45% for pie chart radius
- textoffset = 0.1 * radius;
- GfxSelectFont("Arial", 9, 500, True );
- GfxSelectFont("Arial", 9 );
- GfxSetTextColor( colorLime);
- GfxTextOut( "R1 =" + R1, textoffset + 310, 32 );
- GfxSetTextColor( colorLime );
- GfxTextOut( "R2 = " +R2, textoffset + 410, 32);
- GfxSetTextColor( colorBlue );
- GfxTextOut( "PP = " +PP, textoffset + 210, 32);
- GfxSetTextColor( colorOrange );
- GfxTextOut( "S1 = " +S1, textoffset + 10, 32);
- GfxSetTextColor( colorRed );
- GfxTextOut( "S2 = " +S2, textoffset + 110, 32);
- GfxSelectFont("Arial", 9 );
- _SECTION_END();
- _SECTION_BEGIN("Background");
- SetChartOptions(0,chartShowArrows|chartShowDates);
- SetChartBkColor(ParamColor("Outer panel",colorBlack)); // color of outer border
- SetChartBkGradientFill( ParamColor("Inner panel upper",colorBlack),ParamColor("Inner panel lower",colorBlack));
- tchoice=Param("Title Selection ",2,1,2,1);
- Plot(C, "", IIf(O>=C, colorRed, colorGreen), ParamStyle("Price Style",styleCandle,maskPrice));
- //-Paint Background
- GfxSelectSolidBrush( colorBlack);
- GfxSelectPen( colorBlue);
- GfxRoundRect( 500, 20, 930, 49, 32, 32 );
- GfxSetBkMode( 1 );
- GfxSelectFont("Arial", 8, 900);
- _SECTION_BEGIN("Magnified Market Price");
- FS=Param("Font Size",12,30,100,1);
- GfxSelectFont("Arial", FS, 700, italic = False, underline = False, True );
- GfxSetBkMode( colorGreen );
- GfxSetTextColor( ParamColor("Color",colorAqua) );
- Hor=Param("Horizontal Position",630,800,800,800);
- Ver=Param("Vertical Position",25,27,27,27);
- GfxTextOut("CMP: "+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( colorGreen );
- GfxSetTextColor(ParamColor("Color",colorGreen) );
- GfxTextOut("change ("+DD+") ("+xx+"%)", Hor+130, Ver+0 );
- _SECTION_END();
- _SECTION_BEGIN("system Ticker");
- function GetSecondNum()
- {
- Time = Now( 4 );
- Seconds = int( Time % 100 );
- Minutes = int( Time / 100 % 100 );
- Hours = int( Time / 10000 % 100 );
- SecondNum = int( Hours * 60 * 60 + Minutes * 60 + Seconds );
- return SecondNum;
- }
- RequestTimedRefresh( 1 );
- //----------------------------------------------------------------------------
- //----------------------------------------------------------------------------
- TimeFrame = Interval();
- SecNumber = GetSecondNum();
- Newperiod = SecNumber % TimeFrame == 0;
- SecsLeft = SecNumber - int( SecNumber / TimeFrame ) * TimeFrame;
- SecsToGo = TimeFrame - SecsLeft;
- x=Param(" xposn",520,100,1000,1000);
- y=Param(" yposn",27,40,1000,1);
- GfxSelectSolidBrush( colorBlack );
- GfxSelectPen( colorRed, 2 );
- if ( NewPeriod )
- {
- GfxSelectSolidBrush( colorBlack );
- GfxSelectPen( colorBlack, 2 );
- }
- GfxRoundRect( x+55, y+17, x-4, y-2, 0, 0 );
- GfxSetBkMode(1);
- GfxSelectFont( "Arial", 9, 700, False );
- GfxSetTextColor( colorBrightGreen );
- GfxTextOut( "" +SecsToGo+" / "+NumToStr( TimeFrame, 1.0 ), x, y );
- _SECTION_END();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement