PureBytes Links
Trading Reference Links
|
Works but gives the high of the first bar for the current
day - I checked on hourly bars.
Graph1=Ref(Hmax,-1) gives me yesterday's high.
Very useful code anyway.
thanks
nand
--- In amibroker@xxxx, "Sharps_45_70" <sharps_45_70@xxxx> wrote:
> 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 );
> ///////////////////////////////////////////////////////
|