_SECTION_BEGIN("Two Day Range");
// Get Previous Day's High low and Close
PrevHigh = TimeFrameGetPrice("H", inDaily, -1);
PrevLow = TimeFrameGetPrice("L", inDaily, -1);
PrevClose = TimeFrameGetPrice("C", inDaily, -1);
// Get Previous 2 Day's High low and Close
Prev2High = TimeFrameGetPrice("H", inDaily, -2);
Prev2Low = TimeFrameGetPrice("L", inDaily, -2);
Prev2Close = TimeFrameGetPrice("C", inDaily, -2);
// Calculate 2 days range
TwoDayRes = Max(PrevHigh, Prev2High);
TwoDaySup = Min(PrevLow, Prev2Low);
// Check bar's time
CurrBarTime = TimeNum();
DayStartTime = 91500;
DayEndTime = 153000;
// Check range condition
IsAllDay = CurrBarTime >= DayStartTime AND CurrBarTime <= DayEndTime;
IsToday = Day() == LastValue(Day()) AND Month() == LastValue(Month());
// Check user selection
ShowRange = ParamToggle("Display Range For", "Current Day|All Day", 0);
if(ShowRange)
{
RangeCodition = IsAllDay;
}
else
{
RangeCodition = IsToday;
}
ShowPrevHLC = ParamToggle("Show Previous day Range", "Yes|No", 1);
ShowTwoDayRange = ParamToggle("Show Two Day Range", "Yes|No", 1);
ColorTwoDayRange = ParamColor("Two Day Range Color", colorWhite);
// Show 2 Day Range
if(ShowTwoDayRange AND Interval() <= 9000)
{
Plot(IIf(RangeCodition,Prev2High ,Null),"",ColorTwoDayRange,styleLine|styleDashed|styleNoRescale|styleNoLabel);
Plot(IIf(RangeCodition,Prev2Low,Null),"",ColorTwoDayRange,styleLine|styleDashed|styleNoRescale|styleNoLabel);
PlotText("2 PDH - " + NumToStr(Prev2High ,1.11), BarCount+1, LastValue(Prev2High ),colorYellow);
PlotText("2 PDL - " + NumToStr(Prev2Low,1.11), BarCount+1, LastValue(Prev2Low),colorYellow);
}
// Show Prev Day HLC
if(ShowPrevHLC AND Interval() <= 3600)
{
Plot(IIf(RangeCodition,PrevHigh,Null),"",ColorTwoDayRange,styleLine|styleThick|styleDashed|styleNoRescale|styleNoLabel);
Plot(IIf(RangeCodition,PrevLow,Null),"",ColorTwoDayRange,styleLine|styleThick|styleDashed|styleNoRescale|styleNoLabel);
Plot(IIf(RangeCodition,PrevClose,Null),"",colorDarkRed,styleLine|styleThick|styleDashed|styleNoRescale|styleNoLabel);
PlotText("PDH - " + NumToStr(PrevHigh,1.11), BarCount+1, LastValue(PrevHigh),colorWhite);
PlotText("PDL - " + NumToStr(PrevLow,1.11), BarCount+1, LastValue(PrevLow),colorWhite);
PlotText("PDC - " + NumToStr(PrevClose,1.11), BarCount+1, LastValue(PrevClose),colorWhite);
}
_SECTION_END();
Periods = Param("No PrevDay", 1, 1, 30, 1);
Style = ParamStyle("Style", styleLine | styleDashed | styleThick | styleNoLabel | styleNoRescale );
PrevDayHigh = TimeFrameGetPrice( "H", inDaily, -Periods );
PrevDayLow = TimeFrameGetPrice( "L", inDaily, -Periods );
PrevDayClose = TimeFrameGetPrice( "C", inDaily, -Periods );
LValueDHigh = LastValue(PrevDayHigh);
LValueDLow = LastValue(PrevDayLow);
LValueDClose = LastValue(PrevDayClose);
NewDay = (Day()!= Ref(Day(), -1));
FirstBar = LastValue(ValueWhen(NewDay,BarIndex(),1));
EndBar = EndValue(BarIndex());
PDHLine = LineArray(FirstBar, LValueDHigh, EndBar, LValueDHigh, 1);
PDLLine = LineArray(FirstBar, LValueDLow, EndBar, LValueDLow, 1);
PDCLine = LineArray(FirstBar, LValueDClose, EndBar, LValueDClose, 1);
Plot(PDHLine,"PDH",ParamColor( "ColorS", colorCycle ), ParamStyle("Style"));
Plot(PDLLine,"PDL",ParamColor( "ColorS", colorCycle ), ParamStyle("Style"));
Plot(PDCLine,"PDC",ParamColor( "ColorS", colorCycle ), ParamStyle("Style"));
Periods = Param("No PrevDay", 1, 1, 30, 1);
Style = ParamStyle("Style", styleLine | styleDashed | styleThick | styleNoLabel | styleNoRescale );
PrevDayHigh = TimeFrameGetPrice( "H", inDaily, -Periods );
PrevDayLow = TimeFrameGetPrice( "L", inDaily, -Periods );
PrevDayClose = TimeFrameGetPrice( "C", inDaily, -Periods );
LValueDHigh = LastValue(PrevDayHigh);
LValueDLow = LastValue(PrevDayLow);
LValueDClose = LastValue(PrevDayClose);
NewDay = (Day()!= Ref(Day(), -1));
FirstBar = LastValue(ValueWhen(NewDay,BarIndex(),1));
EndBar = EndValue(BarIndex());
PDHLine = LineArray(FirstBar, LValueDHigh, EndBar, LValueDHigh, 1);
PDLLine = LineArray(FirstBar, LValueDLow, EndBar, LValueDLow, 1);
PDCLine = LineArray(FirstBar, LValueDClose, EndBar, LValueDClose, 1);
Plot(PDHLine,"PDH",ParamColor( "ColorS", colorCycle ), ParamStyle("Style"));
Plot(PDLLine,"PDL",ParamColor( "ColorS", colorCycle ), ParamStyle("Style"));
Plot(PDCLine,"PDC",ParamColor( "ColorS", colorCycle ), ParamStyle("Style"));
Thread starter | Similar threads | Forum | Replies | Date |
---|---|---|---|---|
My experiments with MFs | Mutual Funds Discussion Forum | 93 | ||
R | Experiments with Market Profile | Advanced Trading Strategies | 53 | |
G | Trading logs/experiments | Commodities | 8 | |
My Experiments with Charts | Members Discussion Forums | 1 | ||
Experiments with OBV | Members Discussion Forums | 9 |