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

Notification

Icon
Error

Options
Go to last post Go to first unread
Redhorse  
#1 Posted : Wednesday, March 16, 2016 2:02:36 PM(UTC)
Redhorse

Rank: Newbie

Groups: Registered Users, Subscribers
Joined: 3/16/2016(UTC)
Posts: 3

I am trying to write an Exploration in the Metastock formula language but i am unsure about how to code it. 

 

Lets say, for example, you want to run an exploration on the last 12 candles and if there are either 3 positive or 3 negative candles over a certain size (such as one ATR) in that time array to return a positive result from the exploration and if not return a negative result etc, how would you code that?

In other words, in a nutshell, my question is how do you run an exploration that tests a series of candles in a time array and if a certain number of candles in the time array meet a certain condition then return a positive result and it not return a negative result?

 

MS Support  
#2 Posted : Wednesday, March 16, 2016 6:28:12 PM(UTC)
MS Support

Rank: Advanced Member

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

Thanks: 91 times
Was thanked: 155 time(s) in 150 post(s)
You can Sum a condition over a range of periods. By default when a condition is true it returns a 1 and when not true it returns a 0. Therefore you just make sure the Sum of the condition is greater than or equal to the number of times you want the condition to be true within a range. For example: Sum(C < O AND ATR(14) > 1,12) >= 3 This should look for the Close being below the open (a black candle) and the ATR being above 1, it would look over 12 periods and would have to be true at least 3 out of those 12 periods. I used a 14-period ATR in this example.
Guest  
#3 Posted : Thursday, March 17, 2016 5:37:16 AM(UTC)
Guest

Rank: Member

Groups: Guests
Joined: 5/6/2007(UTC)
Posts: 25

O.K. Thanks for your help.
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.