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

Notification

Icon
Error

Options
Go to last post Go to first unread
Risoma  
#1 Posted : Wednesday, February 16, 2011 5:21:06 AM(UTC)
Risoma

Rank: Newbie

Groups: Registered, Registered Users, Subscribers
Joined: 1/23/2011(UTC)
Posts: 9

Hi, I'm trying to do an exploration that shows me only the stocks where the mov(c,10,E) has been above the mov(c,20,e) for more than 60 periods. Here's what I've come up with, although it doesn't work, BarsSince(Cross(Mov(C,10,E)>Mov(C,20,E)>60)).
wabbit  
#2 Posted : Wednesday, February 16, 2011 6:37:41 AM(UTC)
wabbit

Rank: Advanced Member

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

Was thanked: 16 time(s) in 16 post(s)
Think about the logic in another way. You can use a plethora of other methods too, such as:

Code:
sum(Mov(C,10,E)>Mov(C,20,E),60)=60;


Code:
sum(Mov(C,10,E)<=Mov(C,20,E),60)=0;


Code:
alert(Mov(C,10,E)<=Mov(C,20,E),60)=0;


Code:
barssince(Mov(C,10,E)<=Mov(C,20,E))>60;


Each method has their own strengths and weaknesses; try them out.


wabbit [:D]

Risoma  
#3 Posted : Wednesday, February 16, 2011 12:17:54 PM(UTC)
Risoma

Rank: Newbie

Groups: Registered, Registered Users, Subscribers
Joined: 1/23/2011(UTC)
Posts: 9

Thank you very much Wabbit, I was leaving the semi colan of the end of the formula when I tried alert and barssince, obviously now I realise that this makes a differance, I'm trying to understand why? is it that the semi colan shows MS that this is the end of the formula?
wabbit  
#4 Posted : Thursday, February 17, 2011 1:16:07 AM(UTC)
wabbit

Rank: Advanced Member

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

Was thanked: 16 time(s) in 16 post(s)
If you only have one line of code then you do not need the semicolon, or the last line of code (in almost most instances in MS). The semicolons tell the application it has reached the end of the line. I do a lot of programming in other languages where semicolons are REQUIRED so I get used to including them; there is no harm adding a semicolon to the end of a line if it is not required but it does great harm not to include a semicolon when they are required.


wabbit [:D]

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.