PureBytes Links
Trading Reference Links
|
ok,
Let's try this again.
On the first bar of the day ref(datenum(),-1) returns the prior
trading day. On all other bars that day, datenum()==ref(datenum(),-
1).
Ed
//Works (I think!) only with intraday data and intervals//
//bars in current day
x=BarsSince(DateNum()!=Ref(DateNum(),-1));
//bars in a day at current interval
px=ValueWhen(x==0 AND Ref(x,-1)>0, Ref(x,-1));
//Lookback period, ie. px=px*2; for 2 days
px=px*1;
//highest high for px periods, ending prior to current day
Hmax=Ref(HHV(H,px),-x);
Graph0=H;
Graph1=Hmax;
Filter=1;
AddColumn( DateNum(), "DateNum", 1 );
AddColumn( Ref(DateNum(),-1), "DateNumP", 1 );
AddColumn( px, "px", 1 );
AddColumn( x, "x", 1 );
///////////////////////////////////////////////////////
|