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

Notification

Icon
Error

Options
Go to last post Go to first unread
duration  
#1 Posted : Thursday, September 15, 2005 12:47:51 PM(UTC)
duration

Rank: Newbie

Groups: Registered, Registered Users
Joined: 9/15/2005(UTC)
Posts: 6

Hi everyone, I would like to know how to use the correl function so that it calculates the correlation between two date of prices on the same chart: EX: USD/CHF & EUR/USD -> correl(Close(Data1), close(data2), 21, 5) ??? how can I write this indicator? I tried to edit the native Correlation indicator but I cannot find it in the list :( Thank you very much for your help,
hayseed  
#2 Posted : Thursday, September 15, 2005 1:49:46 PM(UTC)
hayseed

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 3/7/2005(UTC)
Posts: 1,346

hey duration..... not sure what the correl function is.... however, could you use the downloader to create a composite.... new>composite .... it only takes a second.... that would create a base security.... as an indicator perhaps this would work.... h Security("C:\\MetaStock Data\\hayseed\\dow3\\ibm",C)/Security("C:\\MetaStock Data\\hayseed\\dow3\\gm",C)
Jose  
#3 Posted : Thursday, September 15, 2005 2:31:07 PM(UTC)
Jose

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)
MetaStock Help wrote:
Correl(DataArray, DataArray, Periods, Shift) Correlation Analysis SYNTAX: correl( INDEPENDENT, DEPENDENT,PERIODS, SHIFT) FUNCTION: Calculates the predefined Correlation indicator. Compares the correlation of DEPENDENT to INDEPENDENT over PERIODS time periods, after shifting DEPENDENT to the right SHIFT-periods. EXAMPLE: The formula "correl( macd(), CLOSE, 5, 10 )" compares the MACD indicator to the closing price 10-periods in the future, after statistically averaging each data array over the preceding 5-periods. Before attempting to plot the Correlation indicator, you must first select two plots. This could be two price plots, an indicator and a price plot, or two indicators. The first plot selected will be the independent variable and the second, the dependent variable. The parameters for the Correlation indicator are shown below. These parameters are specified at the time the indicator is plotted. You can edit the parameters of an existing plot by right-clicking on the indicator and choosing Properties from the shortcut menu. Time Periods. This parameter specifies the number of time periods that are used to "smooth" the dependent and independent variables when determining their correlation. Forward Shift. This parameter specifies the number of time periods to shift the independent variable's data forward. This can be used to determine whether a change in an indicator (the independent variable) "leads" a change in prices (the dependent variable). For example, if you find that an indicator has a high positive correlation to the security's price when shifted forward three periods, you may assume that a change in the indicator today will predict a change in the security's price three periods from now. Correlation The purpose of correlation analysis is to measure the relationship between two variables. This relationship is called the "correlation coefficient." The correlation coefficient ranges between ±1.0. A coefficient of +1.0 is a perfect positive correlation and -1.0 is a perfect negative correlation. Two variables with no relationship will have a coefficient of zero. Interpretation Correlation analysis involves a "dependent" and an "independent" variable. Correlation analysis measures whether or not a change in the independent variable will result in a change in the dependent variable. A low correlation coefficient (e.g., ±0.10) suggests that the relationship between the two variables is weak or non-existent. A high correlation indicates that the dependent variable (e.g., the security's price) will change when the independent variable (e.g., an indicator) changes. The direction of the dependent variable's change depends on the sign of the coefficient. If the coefficient is a positive number, then the dependent variable will move in the same direction as the independent variable; if the coefficient is negative, then the dependent variable will move in the opposite direction of the independent variable. A useful feature of correlation analysis is its predictive capability, because the correlation coefficient shows how well a change in the independent variable (e.g., an indicator) predicts a change in the dependent variable (e.g., the security's price).
jose '-) http://www.metastocktools.com
Jose  
#4 Posted : Thursday, September 15, 2005 2:33:38 PM(UTC)
Jose

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)
MetaStock Help (continued) wrote:
The Correlation indicator can be used in three ways: Correlation of a security's price to an indicator You can measure the relationship between an indicator and a security's price. A high positive correlation coefficient means that a change in the indicator usually predicts a change in the security's price. A high negative correlation (e.g., -0.70) means that when the indicator's value changes, the security's price will usually move in the opposite direction. Remember, a low (e.g., 0.10) correlation coefficient indicates that the relationship between the security's price and the indicator is not significant. Correlation of one security to another Another use of correlation analysis is to measure the strength of a relationship between two securities. Often, one security's price "leads" or predicts the price of another security. This is especially noticeable with commodities. For example, the correlation coefficient of gold versus the dollar shows a strong negative relationship. In other words, an increase in the dollar usually predicts a decrease in the price of gold. Correlation of one indicator to another Another use of correlation analysis is to measure the strength of a relationship between two indicators. Often, one indicator's movement "leads" or predicts the movement of another indicator. For example, a volume-based indicator (i.e., Chaikin Oscillator, Money Flow Index, etc.) may be found to lead a momentum based indicator (i.e., RSI, Stochastic, etc.).
jose '-) http://www.metastocktools.com
duration  
#5 Posted : Thursday, September 15, 2005 4:07:41 PM(UTC)
duration

Rank: Newbie

Groups: Registered, Registered Users
Joined: 9/15/2005(UTC)
Posts: 6

Hello! Thank you all for your answers! (Jose: I had read the help :D ) It may seem very basic but I just do not understand how I should write the indicator for two security prices, this is what I would like to code: correl(close of securityprice1, close of securityprice2, 21, 5) But I do not know the correct words for the securityprice1&2. Can you help? Thanks!
Patrick  
#6 Posted : Thursday, September 15, 2005 4:12:06 PM(UTC)
Patrick

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 9/8/2004(UTC)
Posts: 2,266

Was thanked: 1 time(s) in 1 post(s)
hayseed wrote:
Security("C:\\MetaStock Data\\hayseed\\dow3\\ibm",C)/Security("C:\\MetaStock Data\\hayseed\\dow3\\gm",C)
Take a look at the security function as per hayseed's post ... So you would write something like : correl(Security("PATH\\SYMBOL",Data array),Security("PATH\\SYMBOL",Data array), 21, 5) If you don't have the security function look at the p variable function ... Patrick :mrgreen:
hayseed  
#7 Posted : Thursday, September 15, 2005 4:14:49 PM(UTC)
hayseed

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 3/7/2005(UTC)
Posts: 1,346

hey jose.... thanks.... if i could impose here, i had tried various ways to insert securities into durations code but get the "," error.... i've tried rearranging the )'s.... for security to security do you see my error.... correl(Security("C:\\MetaStock Data\\hayseed\\dow3\\gm,c), (Security("C:\\MetaStock Data\\hayseed\\dow3\\ibm,c) 5, 10 ) hey duration... looks like jose has the solution, fwiw, here is something else from equis via trader online..... guess i'll get slapped with the dreaded 933 violation..... my defense will be, oooops .....h
hayseed  
#8 Posted : Thursday, September 15, 2005 4:20:03 PM(UTC)
hayseed

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 3/7/2005(UTC)
Posts: 1,346

might have found the error.... couple " missing .....h Correl(Security("C:\\MetaStock Data\\hayseed\\dow3\\gm",C), (Security("C:\\MetaStock Data\\hayseed\\dow3\\ibm",C) ),5, 10 )
duration  
#9 Posted : Thursday, September 15, 2005 4:50:31 PM(UTC)
duration

Rank: Newbie

Groups: Registered, Registered Users
Joined: 9/15/2005(UTC)
Posts: 6

Hello! Thankyou for your help! I have found how to do it using the following syntax: correl(Security("C:\\MetaStock Data\\FOREX\\AUDJPY", Close), Security("C:\\MetaStock Data\\FOREX\\USDCHF", Close), 21, 0) Thank you again!
Jose  
#10 Posted : Friday, September 16, 2005 4:28:02 AM(UTC)
Jose

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)
hayseed wrote:
...i had tried various ways to insert securities into durations code but get the "," error.... i've tried rearranging the )'s.... for security to security do you see my error.... correl(Security("C:\\MetaStock Data\\hayseed\\dow3\\gm,c), (Security("C:\\MetaStock Data\\hayseed\\dow3\\ibm,c) 5, 10 )
Hayseed, try first separating the Security functions: [code:1:c5ec894c51] x:=Security("C:\\MetaStock Data\\hayseed\\dow3\\gm",c); y:=Security("C:\\MetaStock Data\\hayseed\\dow3\\ibm",c); correl(x,y,5,10) [/code:1:c5ec894c51] BTW, is it just my browser (Opera), or is all text in this forum suddenly in bold? jose '-) http://www.metastocktools.com
StorkBite  
#11 Posted : Friday, September 16, 2005 11:58:26 AM(UTC)
StorkBite

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 3/19/2005(UTC)
Posts: 2,995

Was thanked: 14 time(s) in 10 post(s)
Quote:
BTW, is it just my browser (Opera), or is all text in this forum suddenly in bold?
Hi Jose- It's Patrick's artistic flare at work. :D
skeetabomb  
#12 Posted : Tuesday, October 4, 2005 6:51:22 PM(UTC)
skeetabomb

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 4/28/2005(UTC)
Posts: 41
Location: London

C:\\MetaStock Data\\hayseed\\dow3\\gm,c), (Security("C:\\MetaStock Data\\hayseed\\dow3\\ibm,c) 5, 10 )[/quote wrote:
is missing the closing quotation marks for each named security.
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.