_SECTION_BEGIN("Max 3 Months High Low with Exploration");
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() );
EODTF = Paramlist("TF Monthly|Weekly|Daily","Monthly|Weekly|Daily",0);
MultiTF = ParamList( "EOD or Intraday", "EOD|Intraday", 0 );
intratmfrm = Param( "Input Intra-day TF (minutes)", 60, 1, 1440, 1 ) * 60;
expandmode = Paramtoggle("Expand First or Last", "expandFirst|expandLast",0);
switch( EODTF )
{
case "Monthly": EODTF = inMonthly; break;
case "Weekly": EODTF = inWeekly; break;
case "Daily": EODTF = inDaily; break;
}
switch(MultiTF)
{
case "Intraday":
HM1 = TimeFrameGetPrice( "H", intratmfrm,-1,expandmode);
HM2 = TimeFrameGetPrice( "H", intratmfrm,-2,expandmode);
HM3 = TimeFrameGetPrice( "H", intratmfrm,-3,expandmode);
LM1 = TimeFrameGetPrice( "L", intratmfrm,-1,expandmode);
LM2 = TimeFrameGetPrice( "L", intratmfrm,-2,expandmode);
LM3 = TimeFrameGetPrice( "L", intratmfrm,-3,expandmode);
break;
case "EOD":
HM1 = TimeFrameGetPrice( "H", EODTF,-1,expandmode);
HM2 = TimeFrameGetPrice( "H", EODTF,-2,expandmode);
HM3 = TimeFrameGetPrice( "H", EODTF,-3,expandmode);
LM1 = TimeFrameGetPrice( "L", EODTF,-1,expandmode);
LM2 = TimeFrameGetPrice( "L", EODTF,-2,expandmode);
LM3 = TimeFrameGetPrice( "L", EODTF,-3,expandmode);
break;
}
ThisMonthHigh = (H>HM1 AND H>HM2 AND H>HM3);
ThisMonthLow = (L<LM1 AND L<LM2 AND L<LM3);
ThisMonthHigh = ExRem(ThisMonthHigh, ThisMonthLow);
ThisMonthLow = ExRem(ThisMonthLow, ThisMonthHigh);
PlotShapes(ThisMonthHigh*shapeSmallCircle,colorGreen,0,L,-15);
PlotShapes(ThisMonthLow*shapeSmallCircle,colorred,0,H,15);
Filter = ThisMonthHigh OR ThisMonthLow;
AddTextColumn( Interval(2), "Set Interval", 1 );
AddColumn(C, "Price", 1.2, colorWhite, IIf(ThisMonthHigh==True, colorgreen, IIf(ThisMonthLow==True,colorOrange,colorwhite)), colorwhite, 120);
AddColumn(ThisMonthHigh, "Month High", 1, colorWhite, IIf(ThisMonthHigh==True, colorgreen, colorwhite),120);
AddColumn(ThisMonthLow, "Month Low", 1, colorWhite, IIf(ThisMonthLow==True,colorOrange,colorwhite),120);
_SECTION_END();