logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
arturoc  
#1 Posted : Tuesday, November 15, 2016 5:48:15 PM(UTC)
arturoc

Rank: Newbie

Groups: Registered Users, Subscribers, Unverified Users
Joined: 11/15/2016(UTC)
Posts: 5

Hi,

I am new to the forum, and have just purchased Metastock Pro. I am testing a couple of systems and have some experience creating basic systems or indicators using the metastock programming language. Does anyone know if there is an indicator to display the opening range of a stock or index, meaning the high and low of the first 5 minutes or 30 minutes of trading (high and low from 9:30 to 9:35 AM NY time).

Thanks. 

MS Support  
#2 Posted : Wednesday, November 16, 2016 5:12:33 PM(UTC)
MS Support

Rank: Advanced Member

Groups: Moderators, Registered, Registered Users, Subscribers
Joined: 10/8/2010(UTC)
Posts: 1,419

Thanks: 35 times
Was thanked: 110 time(s) in 106 post(s)
Hi, An important part of the formula language to note is that it operates off of the native interval of the chart. So if you are looking at a Daily chart, there is no way to extract this information. You would need to have a 5-minute chart opened in order to gather this information. For example, you can use the ValueWhen function in combination with the Time functions (Hour(), Minute(), etc) to report a data array (Open, High, Low, Close, Volume) at a given time.
arturoc  
#3 Posted : Wednesday, November 16, 2016 5:20:46 PM(UTC)
arturoc

Rank: Newbie

Groups: Registered Users, Subscribers, Unverified Users
Joined: 11/15/2016(UTC)
Posts: 5

Thanks, I will try out your suggestion.
MS Support  
#4 Posted : Wednesday, November 16, 2016 6:19:29 PM(UTC)
MS Support

Rank: Advanced Member

Groups: Moderators, Registered, Registered Users, Subscribers
Joined: 10/8/2010(UTC)
Posts: 1,419

Thanks: 35 times
Was thanked: 110 time(s) in 106 post(s)
To give a more specific example: ValueWhen(1,Hour()=9 AND Minute()=30,C) This would return the Close price of the most recent 9:30 AM price bar.
arturoc  
#5 Posted : Wednesday, November 16, 2016 7:15:34 PM(UTC)
arturoc

Rank: Newbie

Groups: Registered Users, Subscribers, Unverified Users
Joined: 11/15/2016(UTC)
Posts: 5

Thanks. I tried it with the High and Low: ValueWhen(1,Hour()=9 AND Minute()=30, H) ValueWhen(1,Hour()=9 AND Minute()=30, L) and it gave me what I expected using 5 minute bars, by the way I am using Metastock Pro RT. What if I use 1 minute bars and I would like the highest high between 9:30 and 9:35, how would the formula be?
MS Support  
#6 Posted : Wednesday, November 16, 2016 8:36:51 PM(UTC)
MS Support

Rank: Advanced Member

Groups: Moderators, Registered, Registered Users, Subscribers
Joined: 10/8/2010(UTC)
Posts: 1,419

Thanks: 35 times
Was thanked: 110 time(s) in 106 post(s)
This formula would be interval dependent, meaning it would be written to use 1-minute data (so the HHV function would look back over 5 1-minute bars from 9:35 AM backwards: ValueWhen(1,Hour()=9 AND Minute()=35,HHV(H,5))
arturoc  
#7 Posted : Thursday, November 17, 2016 6:08:39 PM(UTC)
arturoc

Rank: Newbie

Groups: Registered Users, Subscribers, Unverified Users
Joined: 11/15/2016(UTC)
Posts: 5

Thanks for the suggestions, little by little I am putting my system together. Now I have another question... how can I simulate that any open positions be closed at 16:00 NY time if there is one open at the end of every day? I tried to input in the System Editor / Sell Order tab the instruction "ValueWhen(1,Hour()=16 AND Minute()=00, C)", and assumed that it would sell at the closing price of the 16:00 minute bar, but I am getting very strange things, it closes my trades the bar after they are opened. I also tried typing a 0 instead of a 1 just before the Hour() command, but that was even worse. Any suggestions please?
MS Support  
#8 Posted : Thursday, November 17, 2016 9:21:03 PM(UTC)
MS Support

Rank: Advanced Member

Groups: Moderators, Registered, Registered Users, Subscribers
Joined: 10/8/2010(UTC)
Posts: 1,419

Thanks: 35 times
Was thanked: 110 time(s) in 106 post(s)
You would not want to use ValueWhen for your sell condition. Simply use the time functions by themselves. Hour()=16 AND Minute()=00
arturoc  
#9 Posted : Monday, November 21, 2016 8:32:08 AM(UTC)
arturoc

Rank: Newbie

Groups: Registered Users, Subscribers, Unverified Users
Joined: 11/15/2016(UTC)
Posts: 5

Things are starting to work well. Something else, is it possible to run the system test on a "continuous contract" for futures? I am running my tests on the Russell 2000 (TFSZ6) and S&P 500 (ESZ6) futures contracts, but obviously before Sep 16, the liquidity is so low that the bars displayed generate strange trading signals. Thanks.
MS Support  
#10 Posted : Monday, November 21, 2016 6:36:31 PM(UTC)
MS Support

Rank: Advanced Member

Groups: Moderators, Registered, Registered Users, Subscribers
Joined: 10/8/2010(UTC)
Posts: 1,419

Thanks: 35 times
Was thanked: 110 time(s) in 106 post(s)
This should not be a problem, just make sure to use the "c1" version of the symbol, i.e. ESc1 or TFSc1
Users browsing this topic
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.