Hi,
I am using multi pivot points like intraday, weekly, and monthly. These pivot points showing in charts in any interval. In this what I need is:
- When I use the intraday intervals of 1 minute, 5 minutes, 15 minutes or any minute charts the chart should show intraday and weekly pivot point.
- When I change the interval to hourly or 4*hourly the chart should show weekly and monthly pivot point.
- When I use daily, weekly intervals it should show monthly pivot points only.
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", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
_SECTION_BEGIN("Multi Pivots");
AllPP = ParamToggle("ALL PP","Off|On",1);
PPD = ParamToggle("IDAY PP","Off|On",1);
PPW = ParamToggle("WEEKLY PP","Off|On",1);
PPM = ParamToggle("MONTHLY PP","Off|On",1);
_SECTION_END ();
_SECTION_BEGIN("Multi Pivots");
Notel=ParamStr("Pivot Colors", "DPP, ...MS");
DPP_Color=ParamColor("DPP Color",colorCustom13);
DBC_Color =ParamColor("DBC Color",colorWhite);
DTC_Color =ParamColor("DTC Color",colorYellow);
DR_Color=ParamColor("DR Color",colorCustom10);
DS_Color=ParamColor("DS Color",colorCustom1);
WPP_Color=ParamColor("WPP Color",colorCustom5);
WBC_Color =ParamColor("WBC Color",colorCustom16);
WTC_Color =ParamColor("WTC Color",colorCustom16);
WR_Color=ParamColor("WR Color",colorBrightGreen);
WS_Color=ParamColor("WS Color",ColorRGB (90,90,255));
MPP_Color=ParamColor("MPP Color",colorDarkRed);
MBC_Color =ParamColor("MBC Color",colorDarkYellow);
MTC_Color =ParamColor("MTC Color",colorDarkYellow);
MR_Color=ParamColor("MR Color",colorDarkGreen);
MS_Color=ParamColor("MS Color",colorDarkblue);
Notel=ParamStr("Pivot Styles", "DPP, ...WS");
DPP_Style=ParamStyle("DPP Style", styleNoTitle+styleThick|styleNoRescale,maskAll);
DBC_Style=ParamStyle("DBC Style", styleNoTitle+styleDashed+styleThick|styleNoRescale,maskAll);
DTC_Style=ParamStyle("DTC Style", styleNoTitle+styleDashed+styleThick|styleNoRescale,maskAll);
DR_Style=ParamStyle("DR Style", styleDots+styleNoLine+styleNoTitle|styleNoRescale, maskAll);
DS_Style=ParamStyle("DS Style", styleDots+styleNoLine+styleNoTitle|styleNoRescale, maskAll);
WPP_Style=ParamStyle("WPP Style", styleDots+styleNoLine+styleNoTitle|styleNoRescale, maskAll);
WBC_Style=ParamStyle("WBC Style", styleDots+styleNoLine+styleNoLabel+styleNoTitle|styleNoRescale, maskAll);
WTC_Style=ParamStyle("WTC Style", styleDots+styleNoLine+styleNoLabel+styleNoTitle|styleNoRescale, maskAll);
WR_Style=ParamStyle("WR Style", styleDots+styleNoLine+styleNoTitle|styleNoRescale, maskAll);
WS_Style=ParamStyle("WS Style", styleDots+styleNoLine+styleNoTitle|styleNoRescale, maskAll);
MPP_Style=ParamStyle("MPP Style", styleDots+styleNoLine+styleNoTitle|styleNoRescale, maskAll);
MBC_Style=ParamStyle("MBC Style", styleDots+styleNoLine+styleNoLabel+styleNoTitle|styleNoRescale, maskAll);
MTC_Style=ParamStyle("MTC Style", styleDots+styleNoLine+styleNoLabel+styleNoTitle|styleNoRescale, maskAll);
MR_Style=ParamStyle("MR Style", styleDots+styleNoLine+styleNoTitle|styleNoRescale, maskAll);
MS_Style=ParamStyle("MS Style", styleDots+styleNoLine+styleNoTitle|styleNoRescale, maskAll);
if (AllPP==1)
{
if(PPD==1)
{
Day_H = TimeFrameGetPrice( "H", inDaily, -1 );
Day_L= TimeFrameGetPrice( "L", inDaily, -1 );
Day_C = TimeFrameGetPrice( "C", inDaily, -1 );
// IDAY
DH=Day_h;
DL=Day_L;
DC=Day_C;
// IDAY PIVOT Calculation
R = DH - DL; // Range
DPP = (DH + DL + DC) / 3;
DBC = (DL+DH)/2;
DTC = (DPP-DBC) + DPP;
DR1 = (2 * DPP) - DL ;
DS1 = (2 * DPP) - DH ;
DR2 = DPP - DS1 + DR1;
DS2 = DPP - (DR1 - DS1) ;
DR3 = DPP + DR2 - DS1;
DS3 = DPP - DR2 + DS1;
DR4 = DPP + DR2 - DS2;
DS4 = DPP - DR2 + DS2;
DPP = IIf(DPP!=Ref(DPP,1),Null,DPP);
DBC = IIf(DBC!=Ref(DBC,1),Null,DBC);
DTC = IIf(DTC!=Ref(DTC,1),Null,DTC);
DR1 = IIf(DR1!=Ref(DR1,1),Null,DR1);
DR2 = IIf(DR2!=Ref(DR2,1),Null,DR2);
DR3 = IIf(DR3!=Ref(DR3,1),Null,DR3);
DR4 = IIf(DR4!=Ref(DR4,1),Null,DR4);
DS1 = IIf(DS1!=Ref(DS1,1),Null,DS1);
DS2 = IIf(DS2!=Ref(DS2,1),Null,DS2);
DS3 = IIf(DS3!=Ref(DS3,1),Null,DS3);
DS4 = IIf(DS4!=Ref(DS4,1),Null,DS4);
// Plot IDAY Pivot Levels in the charts
Plot (DPP,"DPP",DPP_Color,DPP_Style,Null,Null,-2,0,2);
Plot (DBC,"DBC", DBC_Color, DBC_Style,Null,Null,-2,0,1);
Plot (DTC,"DTC",DTC_Color, DTC_Style,Null,Null,-2,0,1);
Plot (DR1,"DR1",DR_Color,DR_Style,Null,Null,-2,0,0);
Plot (DR2,"DR2",DR_Color,DR_Style,Null,Null,-2,0,0);
Plot (DR3,"DR3",DR_Color,DR_Style,Null,Null,-2,0,0);
Plot (DR4,"DR4",DR_Color,DR_Style,Null,Null,-2,0,0);
Plot (DS1,"DS1",DS_Color,DS_Style,Null,Null,-2,0,0);
Plot (DS2,"DS2",DS_Color,DS_Style,Null,Null,-2,0,0);
Plot (DS3,"DS3",DS_Color,DS_Style,Null,Null,-2,0,0);
Plot (DS4,"DS4",DS_Color,DS_Style,Null,Null,-2,0,0);
}
if(PPW==1)
{
Week_H = TimeFrameGetPrice( "H", inWeekly, -1 );
Week_L = TimeFrameGetPrice( "L", inWeekly, -1 );
Week_C = TimeFrameGetPrice( "C", inWeekly, -1 );
// WEEK
WH=Week_h;
WL=Week_L;
WC=Week_C;
// WEEK PIVOT Calculation
R = WH - WL; // Range
WPP = (WH + WL + WC) / 3;
WBC = (WL+WH)/2;
WTC = (WPP-WBC) + WPP;
WR1 = (2 * WPP) - WL ;
WS1 = (2 * WPP) - WH ;
WR2 = WPP - WS1 + WR1;
WS2 = WPP - (WR1 - WS1) ;
WR3 = WPP + WR2 - WS1;
WS3 = WPP - WR2 + WS1;
WR4 = WPP + WR2 - WS2;
WS4 = WPP - WR2 + WS2;
// Plot WEEKLY Pivot Levels in the charts
Plot (WPP,"WPP",WPP_Color,WPP_Style);
Plot (WBC,"WBC", WBC_Color, WBC_Style);
Plot (WTC,"WTC",WTC_Color, WTC_Style);
Plot (WR1,"WR1",WR_Color,WR_Style);
Plot (WR2,"WR2",WR_Color,WR_Style);
Plot (WR3,"WR3",WR_Color,WR_Style);
Plot (WR4,"WR4",WR_Color,WR_Style);
Plot (WS1,"WS1",WS_Color,WS_Style);
Plot (WS2,"WS2",WS_Color,WS_Style);
Plot (WS3,"WS3",WS_Color,WS_Style);
Plot (WS4,"WS4",WS_Color,WS_Style);
}
if(PPM==1)
{
Month_H = TimeFrameGetPrice( "H", inMonthly, -1 );
Month_L = TimeFrameGetPrice( "L", inMonthly, -1 );
Month_C = TimeFrameGetPrice( "C", inMonthly, -1 );
// MONTH
MH=Month_h;
ML=Month_L;
MC=Month_C;
// MONTH PIVOT Calculation
R = MH - ML; // Range
MPP = (MH + ML + MC) / 3;
MBC = (ML+MH)/2;
MTC = (MPP-MBC) + MPP;
MR1 = (2 * MPP) - ML ;
MS1 = (2 * MPP) - MH ;
MR2 = MPP - MS1 + MR1;
MS2 = MPP - (MR1 - MS1) ;
MR3 = MPP + MR2 - MS1;
MS3 = MPP - MR2 + MS1;
MR4 = MPP + MR2 - MS2;
MS4 = MPP - MR2 + MS2;
// Plot MONTHLY Pivot Levels in the charts
Plot (MPP,"MPP",MPP_Color,MPP_Style);
Plot (MBC,"MBC", MBC_Color, MBC_Style);
Plot (MTC,"MTC", MTC_Color, MTC_Style);
Plot (MR1,"MR1",MR_Color,MR_Style);
Plot (MR2,"MR2",MR_Color,MR_Style);
Plot (MR3,"MR3",MR_Color,MR_Style);
Plot (MR4,"MR4",MR_Color,MR_Style);
Plot (MS1,"MS1",MS_Color,MS_Style);
Plot (MS2,"MS2",MS_Color,MS_Style);
Plot (MS3,"MS3",MS_Color,MS_Style);
Plot (MS4,"MS4",MS_Color,MS_Style);
}
}
_SECTION_END ();
Grateful for any help...
Regards
Prakash