Hello,
I have been trying to get my way around this but somehow, seems am missing something, cause i've tried in different ways but am unable to get the desired result.
I want to plot yesterdays H&L if there is either an Inside bar or NR 7. And if so, i want the plotting to begin from yesterdays open.
The code mentioned below uses DayOfYear function, but i would prefer to using trendline plotting via LineArray function but am unable to get the X0 co-ordinate for the open of the previous day when i am in lower time frame than Daily, say 5m. And that is the first issue. Please suggest which function is better for making such plotting!
The second is that the condition of IB or NR7 is not validating somehow. I believe i am doing something wrong here, ... or maybe somewhere else in the code.
Request someone to have a look and suggest the right function for plotting the HL starting from the previous day open and the right way to validate the IB or NR7 condition.
Cheers,
//NR 7 & InsideBar RANGES
_SECTION_BEGIN("NR AND IB");
Plot( C, "Close", colorDefault,GetPriceStyle() );
TimeFrameMode(0);
TimeFrameSet( inDaily );
//NR7 RANGE IDENTIFICATION
range = H-L;
Condition0 = range<Ref(range,-1) AND range<Ref(range,-2) AND range<Ref(range,-3)AND range<Ref(range,-4)AND range<Ref(range,-5)AND range<Ref(range,-6);
NR7 = IIf(Condition0,True, False);
//Inside Bar (IB) RANGE IDENTIFICATION
in = Inside();
// Exploration
NRSTATUS =
WriteIf(in,"IB",
WriteIf(NR7,"07"," "));
NR = IIf( NR7 OR in, TRUE,FALSE);
Filter = NR7 OR in;
AddTextColumn(NRstatus, "NR", 1,colorBlack, colorLime,120);
TimeFrameRestore();
//Plotting
NRS = TimeFrameExpand(NR,inDaily,expandFirst);
iif(NRS AND Interval(0)==86400, PlotShapes(shapeHollowSmallSquare*NRS,colorGreen,0,H,5),0);
function CDL( array )
{
doy = DayOfYear();
Lastdoy = doy == LastValue( doy );
Dayline = array * Lastdoy;
return IIf( Dayline, Dayline, Null );
}
function cdlS( array )
{
doy = DayOfYear();
Lastdoy = doy == LastValue( doy-1);
Dayline = array * Lastdoy;
return IIf( Dayline, Dayline, Null );
}
H1=TimeFrameGetPrice( "H", inDaily, -1 );
L1=TimeFrameGetPrice( "L", inDaily, -1 );
L0=TimeFrameGetPrice( "L", inDaily,0);
H0=TimeFrameGetPrice( "H", inDaily,0);
Plot (cdl(H1),"H1",colorCustom11,styleDots|styleNoRescale|styleNoLabel);
Plot (cdl(L1),"L1",colorCustom12,styleDots|styleNoRescale|styleNoLabel);
id=LastValue(Ref(NRS,-1));
////================ any of the 2 if's =======================================================
IIf(id,Plot(cdlS(H0),"H1",colorCustom11,styleDots|styleNoRescale|styleNoLabel) AND
Plot (cdlS(L0),"L1",colorCustom12,styleDots|styleNoRescale|styleNoLabel),0);
//if(id) {Plot(cdlS(H0),"H1",colorCustom11,styleDots|styleNoRescale|styleNoLabel);
// Plot (cdlS(L0),"L1",colorCustom12,styleDots|styleNoRescale|styleNoLabel);}
_SECTION_END();