Error

 Previous Topic Next Topic
 Redhorse #1 Posted : Wednesday, March 16, 2016 2:02:36 PM(UTC) Rank: NewbieGroups: Registered Users, SubscribersJoined: 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?
 Wanna join the discussion?! Login to your Discussions forum accountor Register a new forum account.
 MS Support #2 Posted : Wednesday, March 16, 2016 6:28:12 PM(UTC) Rank: Advanced MemberGroups: Moderators, Registered, Registered Users, SubscribersJoined: 10/8/2010(UTC)Posts: 1,953Thanks: 91 timesWas 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) Rank: MemberGroups: 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.