Rank: Member
Groups: Registered, Registered Users Joined: 8/8/2005(UTC) Posts: 12
|
Please help me with this one, I am tryng to plot today's intraday session high and low, based on this formula, but I can't figure out how.
Quote:
---start---
{Capture H/L/C print from previous intraday's trading at specific times, use Time1 for start time & Time2 for end time}
Time1:=Hour()=20 AND Minute()=00;
Time2:=Hour()=02 AND Minute()=30;
ldih:=ValueWhen(1,Time2,Ref(HighestSince(1,Time1,H),-1)); {last day intraday high}
ldil:=ValueWhen(1,Time2,Ref(LowestSince(1,Time1,L),-1)); {last day intraday low}
ldic:=ValueWhen(1,Time2,Ref(C,-0)); {last day intraday close}
ldih; ldil; ldic;
---end---
Thank You
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users Joined: 1/19/2005(UTC) Posts: 1,065 Location: Koh Pha-Ngan, Earth
Was thanked: 2 time(s) in 2 post(s)
|
Try this simple intraday chart indicator. It doesn't have start & end of session time inputs, but perhaps may do the job.
[code:1:33324468c5]
{ http://www.metastocktools.com }
{ Day's start }
nuDay:=DayOfMonth()<>Ref(DayOfMonth(),-1)
OR Cum(1)=2;
{ High/Low of today }
Hi:=HighestSince(1,nuDay,H);
Lo:=LowestSince(1,nuDay,L);
{ Plot on intraday chart }
Hi;Lo
[/code:1:33324468c5]
jose '-)
|
|
|
|
Rank: Member
Groups: Registered, Registered Users Joined: 8/8/2005(UTC) Posts: 12
|
Jose, thank you but the timing is exactly the problem:)
That's why I went for the upper formula, but cannot understand how to implement daily H/L
|
|
|
|
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)
|
MKZ
Try This. The difficulty with the precise start and end times you gave is that they do not indicate what to do in the case of the specified bar not being present. For example, what happens if the first data for 2am arrives at 2.05am. Do you want the previous session to end on the 2.05 bar or the 1.59 bar?
The Time1 variable is set to spike true on the first data bar on or after 8pm but before 9pm, so assuming ar least one bar of data arrives before midnight then Time1 will spike true. Testing the value of the current bar being opposite the previous bar is a typical method of finding the leading edge of any signal.
The Time2 variable is constructed quite differently, and the reason for that is so that it can identify the trailing edge of the signal (not the leading edge), in this case the last bar BEFORE or ON 2.30am. How you use these various techniques very much depends on how you want to handle potential missing bars and other factors that you may be aware of. There are advantages and disadvantages to almost any MetaStock method, so at the end of the day it's not what I suggest that's important, but what works for you. Try different variations of Time1 and Time2 and somewhere in there is exactly what you're looking for.
Time1:=Hour()>=20 AND Alert(Hour()<20,2);
Time2:=PeakBars(1,Hour()=2 AND Minute()<=30,1)=0;
ldih:=ValueWhen(1,Time2,Ref(HighestSince(1,Time1,H),-1)); {last day intraday high}
ldil:=ValueWhen(1,Time2,Ref(LowestSince(1,Time1,L),-1)); {last day intraday low}
ldic:=ValueWhen(1,Time2,Ref(C,-0)); {last day intraday close}
ldih; ldil; ldic;
Roy
MetaStock Tips & Tools
|
|
|
|
Rank: Member
Groups: Registered, Registered Users Joined: 8/8/2005(UTC) Posts: 12
|
Quote:The difficulty with the precise start and end times you gave is that they do not indicate what to do in the case of the specified bar not being present.
This is no problem since I can specfy the correct timing of the first bar i.e. on 5min chart 20.05
I am referencing Today's open as
Quote:tdio:=ValueWhen(1,Time1,Ref(O,-0));
What I am trying to achieve is to plot the Highest High of the of the bars between tdio and C (last price), but I don't know how it is best to get the numerical difference between them !?
Quote:
---start---
{Capture H/L/C print from previous intraday's trading at specific times, use Time1 for start time & Time2 for end time}
Time1:=Hour()=20 AND Minute()=00;
Time2:=Hour()=02 AND Minute()=30;
ldih:=ValueWhen(1,Time2,Ref(HighestSince(1,Time1,H),-1)); {last day intraday high}
ldil:=ValueWhen(1,Time2,Ref(LowestSince(1,Time1,L),-1)); {last day intraday low}
ldic:=ValueWhen(1,Time2,Ref(C,-0)); {last day intraday close}
tdio:=ValueWhen(1,Time1,Ref(O,-0)); {today's open}
ldih; ldil; ldic; tdio;
---end---
|
|
|
|
Rank: Member
Groups: Registered, Registered Users Joined: 8/8/2005(UTC) Posts: 12
|
So far I find this very usefull:
Intraday Dynamic H/L
==================
Sth:=Input("Start Hour",0,24,20);
Stm:=Input("Start Min",0,60,05);
Time1:=Hour()=Sth AND Minute()=Stm;
nbars:=BarsSince(Time1);
tdih:=HighestSince(1,nbars=0,H);
tdil:=LowestSince(1,nbars=0,L);
tdih;tdil;
==================
|
|
|
|
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.