Dear All,
I am trying to plot range when :
- If its upside then range should be when first lowest high is created.
- If its downside then range should be when first highest low is created.
Below is my code :
newday = Day() != Ref(Day(),-1); //check if new day or not
FCL=ValueWhen(newday,L); // Day first candle low
FCH=ValueWhen(newday,H); // Day first candle high
hh = HighestSince(newday,H);
ll = LowestSince(newday,L);
ORBCandle = (H < hh AND L > ll);// OR (H > hh AND L < ll );
ORBCandle = Sum(ORBCandle, BarsSince(newday)+1)==1;
ORBHIGH = ValueWhen(ORBCandle,hh);
ORBLOW = ValueWhen(ORBCandle,ll);
Plot(ORBHIGH,"ORBHigh",colorGreen,styleDashed);
Plot(ORBLOW,"ORBLow",colorRed,styleDashed);
Problem here is that, its plotting correctly in some cases but not working in some cases where its ignoring highest or lowest since values.
Request your help to solve this issue.
Thanks in advance.
Regards,
Mahesh