Rank: Member
Groups: Registered, Registered Users, Subscribers Joined: 4/15/2007(UTC) Posts: 14
|
I am monitoring the spread between April and August 2008 Lean Hogs, premium August using the following exploration:
Security("C:\Data\Futures\LH.Q08",C) - Security("F:\Data\Futures\LH.J08",C)
I am using MetaStock 9.0. I would like to add additional information in my exploration but I do not know how. I am still in a steep learning curve on the MetaStock language.
Here are my questions:
- How can I show the spread value 1 day ago in ColB?
- How can I show the spread value 2 days ago in ColC?
- How can I show the spread value 3 days ago in ColD?
Thanks in advance to anyone wishing to help.
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Unverified Users Joined: 7/12/2007(UTC) Posts: 134 Location: Perth Western Australia
|
Perhaps by showing an alternative way to code the exploration you are currently using it will make it easier to understand the Reference function which is explained on page 268 of the User Manual for version 9.
In your exploration formula C=CLOSE (of today) which can also be written using the Reference function as Ref(C,-0) which is interpreted as “Refer to the value of the CLOSE zero (i.e. today) days ago”.
Therefore the code in ColA could also be written as:-
ColA
Security("C:\Data\Futures\LH.Q08",Ref(C,-0)) - Security("F:\Data\Futures\LH.J08",Ref(C,-0));
Hopefully this explanation will help with future use of the Ref function.
|
|
|
|
Rank: Member
Groups: Registered, Registered Users, Subscribers Joined: 4/15/2007(UTC) Posts: 14
|
Thank you oztrader. This was exactly what I needed to know. It works great! [:D]
Is there a way I can add a filter that will alert me (with sound) when the spread is 4.0 or less?
Thanks again for your help.
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Unverified Users Joined: 7/12/2007(UTC) Posts: 134 Location: Perth Western Australia
|
Firstly my comments are restricted to the EOD version of MetaStock.
Yes it is possible to apply a filter however, as far as I am aware, the only audible alert you will hear will come from your lips.
The filter set out below is based on the close of today.
Filter
colA<=4;
|
|
|
|
Rank: Member
Groups: Registered, Registered Users, Subscribers Joined: 4/15/2007(UTC) Posts: 14
|
Thanks oztrader. I feel like I am gaining ground as I had already figured out the colA<=4.
I will try to limit my audible alerts to a vocabliary befitting mixed company. [:)]
|
|
|
|
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.