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

Notification

Icon
Error

Options
Go to last post Go to first unread
bostonman28  
#1 Posted : Friday, February 13, 2009 8:34:58 AM(UTC)
bostonman28

Rank: Newbie

Groups: Registered, Registered Users, Subscribers
Joined: 11/29/2008(UTC)
Posts: 5

I am trying to figure out whether an event has occurred during a simulation. A very simple way to do this seems to be using BarsSince().

Is there a way to determine if the event has never occurred?

A simple example would be:

BarsSince(CLOSE>20)

Let's say CLOSE = 17,18,19,20,21... The BarsSince() would return ?,?,?,0,1. What are the values when CLOSE < 20? I plotted it out, and there is no value plotted for this scenario. Is it possible to determine a value for this case?

wabbit  
#2 Posted : Friday, February 13, 2009 8:49:58 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)
bostonman28 wrote:
I am trying to figure out whether an event has occurred during a simulation. A very simple way to do this seems to be using BarsSince().

Is there a way to determine if the event has never occurred?

A simple example would be:

BarsSince(CLOSE>20)

There are a few ways to determine if an event happened at any time on the chart, or whether an event did not happen at any time. One of the methods uses the Cum() function to count all the instances of the event. Obviously, if the accumulator is greater than zero then the event occurred at least once, or if it is zero the event did not occur. One problem is that if the event is not recorded as occurring due the presence of N/A bars, the Cum() function will also be undefined. One way around this is to nest the IsDefined() and the event in the Cum() function and count the instances of this instead. Another way is to use the forum.dll library (see below).

bostonman28 wrote:
Let's say CLOSE = 17,18,19,20,21... The BarsSince() would return ?,?,?,0,1. What are the values when CLOSE < 20? I plotted it out, and there is no value plotted for this scenario. Is it possible to determine a value for this case?

See : http://forum.equis.com/forums/thread/28878.aspx
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.