Rank: Newbie
Groups: Registered, Registered Users, Subscribers Joined: 11/6/2013(UTC) Posts: 2
|
I am trying to plot the first bar's high and low on an intraday chart. ie the first 5 min bar's high and low for the rest of the day.
Thanks in advance.
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 7/25/2005(UTC) Posts: 1,042
Was thanked: 57 time(s) in 54 post(s)
|
Hi Jim
This piece of code might do exactly what you want. However it would be inappropriate for forex or other data with a timestamp of 12.00 midnight. I've assumed that your chart periodicity would be 5-minutes bars. If the chart is at a higher periodicity (than 5-minute bars) then there's no way to extract first 5-minute bar prices using just the MetaStock Formula Language. Neither will this code work for tick or 1-minute charts. However, it is possible to extract the first 5-minute bar prices from tick or 1-minute data using somewhat more sophisticated coding techniques.
{H & L for first bar of day} D:=DayOfMonth(); D:=D<>ValueWhen(2,1,D); H1:=ValueWhen(1,D,H); L1:=ValueWhen(1,D,L); H1; L1;
Roy
|
|
|
|
Rank: Newbie
Groups: Registered, Registered Users, Subscribers Joined: 11/6/2013(UTC) Posts: 2
|
Thanks, that works. I need to learn how to better use the ValueWhen function.
|
|
|
|
Users browsing this topic |
Guest (Hidden)
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.