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

Notification

Icon
Error

Options
Go to last post Go to first unread
favco  
#1 Posted : Friday, April 11, 2014 10:41:47 PM(UTC)
favco

Rank: Newbie

Groups: Registered, Registered Users
Joined: 4/12/2014(UTC)
Posts: 2

Hi All.
Very new to this part of Metastock. Have found a formula that I would like to use but so far have had no success with it.


Moving Average Crossover - Bullish - Metastock Formula

This is a10 and 30 day moving average crossover search. Results close to 0 pinpoint the crossover.

Col A: CLOSE
Col A: Mov(CLOSE,30,EXPONENTIAL)
Col A: ((CLOSE-Mov(CLOSE,30,EXPONENTIAL)) /Mov(CLOSE,30,EXPONENTIAL)) * 100
Col A: ((CLOSE-Mov(CLOSE,10,EXPONENTIAL)) /Mov(CLOSE,10,EXPONENTIAL)) * 100

Filter: When(colA > colB)

I believe the filter is telling me that the last line in Col A should in fact be Col B.
Also would I be correct in typing the following in Col A:

CLOSE
Mov(CLOSE,30,EXPONENTIAL)
((CLOSE-Mov(CLOSE,30,EXPONENTIAL)) /Mov(CLOSE,30,EXPONENTIAL)) * 100

I also realize that I am in primary school in regards to my education in this area. We all have start somewhere :)

Thanks in advance

favco
wabbit  
#2 Posted : Monday, April 14, 2014 6:59:59 AM(UTC)
wabbit

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 10/28/2004(UTC)
Posts: 3,106
Location: Perth, Western Australia

Was thanked: 12 time(s) in 12 post(s)
favco wrote:
Very new to this part of Metastock. Have found a formula that I would like to use but so far have had no success with it.

What do you mean, "no success"? Does the code produce errors? Or, does the code not produce the results you were expecting?

favco wrote:
This is a10 and 30 day moving average crossover search. Results close to 0 pinpoint the crossover.

No it doesn't.

favco wrote:

Col A: CLOSE
Col A: Mov(CLOSE,30,EXPONENTIAL)
Col A: ((CLOSE-Mov(CLOSE,30,EXPONENTIAL)) /Mov(CLOSE,30,EXPONENTIAL)) * 100
Col A: ((CLOSE-Mov(CLOSE,10,EXPONENTIAL)) /Mov(CLOSE,10,EXPONENTIAL)) * 100

Filter: When(colA > colB)

Obviously, not all this code is in Explorer column A?

When() hasn't been a requirement of the MS formula language since about MS4 (or thereabouts -- been that long anyway, I've forgotten)

favco wrote:
I believe the filter is telling me that the last line in Col A should in fact be Col B.

Huh?

favco wrote:
Also would I be correct in typing the following in Col A:

CLOSE
Mov(CLOSE,30,EXPONENTIAL)
((CLOSE-Mov(CLOSE,30,EXPONENTIAL)) /Mov(CLOSE,30,EXPONENTIAL)) * 100

No.

favco wrote:
I also realize that I am in primary school in regards to my education in this area. We all have start somewhere :)
Start with the MS User Manual and the free Equis Formula Primer.

MS Support  
#3 Posted : Monday, April 14, 2014 6:43:52 PM(UTC)
MS Support

Rank: Advanced Member

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

Thanks: 52 times
Was thanked: 130 time(s) in 126 post(s)
Not knowing the source, I would say that each of those formula lines should be a separate Column, not all within Column A.

Col A: CLOSE
Col B: Mov(CLOSE,30,EXPONENTIAL)
Col C: ((CLOSE-Mov(CLOSE,30,EXPONENTIAL)) /Mov(CLOSE,30,EXPONENTIAL)) * 100
Col D: ((CLOSE-Mov(CLOSE,10,EXPONENTIAL)) /Mov(CLOSE,10,EXPONENTIAL)) * 100

Filter: When(colA > colB)

It's also not technically a crossover if it is only looking at greater than (ColA > ColB). The close may have crossed the moving average several bars ago with this formula.
favco  
#4 Posted : Wednesday, April 16, 2014 1:28:24 AM(UTC)
favco

Rank: Newbie

Groups: Registered, Registered Users
Joined: 4/12/2014(UTC)
Posts: 2

Hi Guys.

First off, I would like to thank you both for answering my question.

My objective was to find stocks to place in a separate watchlist that where showing the signs of crossing moving averages. I use moving averages on my default template and have had some great success over the last five years combining that with other important technical info. I mainly trade medium to long term strategies. Which really means I have a handful of stocks and I trade there cycles, I don't use margins so I'm always long at this present time in my trading career. Something that may change soon.

I found the source of this code here.

Yes wabbit, before I logged off I downloaded this fantastic doc. Spent an enjoyable Sunday getting through the first few chapters and writing some code..... Great stuff, I'm a little hooked now.

I came up with a bit code that was sort of what I was looking for, as it corresponded to my default setting.

A: (If(C>Mov(C,5,S) AND (C>Mov(C,13,S)),1,0))

I then discovered by placing
Filter: If(V>1000000,1,0)
I didn't get the stocks that didn't have liquidity.

I also discovered that I could ask for a stock that was in "oversold" territory by adding
(If(C>Mov(C,5,S) AND (C>Mov(C,13,S) AND (C<RSI(2)<50)),1,0))

I know this is all rudimentary and I probably haven't come up with the right answer yet BUT I'm really starting to understand what the code is doing.

MS Support: you have touched on a question I was scratching my head on... Timing. I'm sure by the time I get to the end of the MS User Manual, I should find the answer.

Anyway thanks guys for helping a newbie out, I'm very happy I got to this forum and I am really enjoying the education. I will succeed.

MS, I will be trying your code as soon as I log out of here.

Thanks Guys

favco

LAST question ! You can see I have used low numbers in my code 5 & 13, I know it brings on a bit of noise (ranging prices) but I am looking for the potential start of the cross over. You will of coarse realize they are fib numbers. Can that be wrong? If so why not use Fib period numbers, e.g 5, 8, 13, 21, 34, 55, 89, 144, 233. Why are other numbers used?






MS Support  
#5 Posted : Thursday, April 17, 2014 6:08:23 PM(UTC)
MS Support

Rank: Advanced Member

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

Thanks: 52 times
Was thanked: 130 time(s) in 126 post(s)
In regards to Greater/Less than, there is a more specific formula function known as Cross. Rather than just looking at whether something is above or below, it identifies the exact point of crossover. Sometimes this can be too specific (especially if looking for multiple crossing values). You can also 'extend' a True/False indicator (such as a cross formula) by wrapping the "Alert" function around the cross function, such as:

Alert(Cross(Mov(C,10,E),Mov(C,30,E)),6)

This would essentially return a True condition (value of 1) as long as the cross occurred within the last 6 periods.
wabbit  
#6 Posted : Saturday, April 19, 2014 3:00:16 AM(UTC)
wabbit

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 10/28/2004(UTC)
Posts: 3,106
Location: Perth, Western Australia

Was thanked: 12 time(s) in 12 post(s)
favco wrote:
LAST question ! You can see I have used low numbers in my code 5 & 13, I know it brings on a bit of noise (ranging prices) but I am looking for the potential start of the cross over. You will of coarse realize they are fib numbers. Can that be wrong? If so why not use Fib period numbers, e.g 5, 8, 13, 21, 34, 55, 89, 144, 233. Why are other numbers used?

Why use any multiple averages... the differences between using a fibonacci numbered MA and an non-fibonacci numbered MA are negligible. All moving averages, of any length, are all VERY highly correlated e.g.
The table below are the cross-correlation coefficients for [1 2 3 5 8 13 21 34 55 89 144 233 377 610 987] EMAs:
Code:

 1.0000 1.0000 0.9999 0.9998 0.9997 0.9995 0.9991 0.9984 0.9973 0.9953 0.9920 0.9868 0.9797 0.9708 0.9615
 1.0000 1.0000 1.0000 0.9999 0.9998 0.9996 0.9992 0.9985 0.9974 0.9955 0.9922 0.9870 0.9798 0.9710 0.9616
 0.9999 1.0000 1.0000 1.0000 0.9999 0.9997 0.9993 0.9987 0.9976 0.9956 0.9924 0.9872 0.9800 0.9712 0.9618
 0.9998 0.9999 1.0000 1.0000 1.0000 0.9998 0.9995 0.9989 0.9978 0.9959 0.9927 0.9875 0.9803 0.9715 0.9620
 0.9997 0.9998 0.9999 1.0000 1.0000 0.9999 0.9997 0.9992 0.9982 0.9963 0.9931 0.9880 0.9808 0.9719 0.9624
 0.9995 0.9996 0.9997 0.9998 0.9999 1.0000 0.9999 0.9995 0.9986 0.9969 0.9938 0.9887 0.9815 0.9726 0.9630
 0.9991 0.9992 0.9993 0.9995 0.9997 0.9999 1.0000 0.9998 0.9992 0.9977 0.9947 0.9898 0.9826 0.9737 0.9640
 0.9984 0.9985 0.9987 0.9989 0.9992 0.9995 0.9998 1.0000 0.9997 0.9986 0.9961 0.9914 0.9844 0.9754 0.9656
 0.9973 0.9974 0.9976 0.9978 0.9982 0.9986 0.9992 0.9997 1.0000 0.9995 0.9977 0.9936 0.9869 0.9780 0.9680
 0.9953 0.9955 0.9956 0.9959 0.9963 0.9969 0.9977 0.9986 0.9995 1.0000 0.9992 0.9962 0.9903 0.9818 0.9718
 0.9920 0.9922 0.9924 0.9927 0.9931 0.9938 0.9947 0.9961 0.9977 0.9992 1.0000 0.9988 0.9945 0.9869 0.9772
 0.9868 0.9870 0.9872 0.9875 0.9880 0.9887 0.9898 0.9914 0.9936 0.9962 0.9988 1.0000 0.9983 0.9928 0.9843
 0.9797 0.9798 0.9800 0.9803 0.9808 0.9815 0.9826 0.9844 0.9869 0.9903 0.9945 0.9983 1.0000 0.9979 0.9918
 0.9708 0.9710 0.9712 0.9715 0.9719 0.9726 0.9737 0.9754 0.9780 0.9818 0.9869 0.9928 0.9979 1.0000 0.9978
 0.9615 0.9616 0.9618 0.9620 0.9624 0.9630 0.9640 0.9656 0.9680 0.9718 0.9772 0.9843 0.9918 0.9978 1.0000




wabbit attached the following image(s):
Fibonacci_EMA.jpg
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.