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

Notification

Icon
Error

Options
Go to last post Go to first unread
StorkBite  
#1 Posted : Monday, March 27, 2006 12:06:06 PM(UTC)
StorkBite

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 3/19/2005(UTC)
Posts: 2,995

Was thanked: 14 time(s) in 10 post(s)
Well, I am constantly learning something new. My quest today began trying to figure out how to determine the number of bars loaded on a given chart. Google is a real friend most of the time, but it is always a red flag when your search comes back empty... it usually means that everyone else already knows the answer. I got stuck in a rut thinking it would have something to do with BARSSINCE, such as barrsince (C>0), but if you'll try, you'll see that that doesn't work. If you plug in the actual value of the first bar it will, e.g., barssince(c=45.77), but that doesn't help. Anyway, the easy, but somewhat hidden answer is to use the CUMULATE function or CUM. Cum(1) will add one point for every bar loaded and thus give you the number of bars loaded and a method for calculating the number of bars since the first bar. Easy.
wabbit  
#2 Posted : Monday, March 27, 2006 12:42:15 PM(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)
.... and the funny thing..... When I open my MS Users Manual to the MS Formula Language section, and lookup Cum() there is the example, "The formula "cum( 1 )" calculates an indicator that rises one point for each day since the beginning of the chart;" <sarcasm>Well what do you know? Another shining example of what can be found in the MS Users Manual!</sarcasm> Perhaps more time in the book than on Google might be warranted? wabbit :D
wabbit  
#3 Posted : Monday, March 27, 2006 12:51:24 PM(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)
and George, you can use the BarsSince() function too! barssince(cum(1)=1) :wink: :wink: wabbit :D
StorkBite  
#4 Posted : Monday, March 27, 2006 2:07:18 PM(UTC)
StorkBite

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 3/19/2005(UTC)
Posts: 2,995

Was thanked: 14 time(s) in 10 post(s)
Yes, sarcasm noted; never say that I can't take it as well as I dish it out! :) I actually did find my answer in the User's Manual... just thought I'd share the answer. Cumulate is not one of the functions that I use much. re: more user's manual and less Google... hmm... I have a copy of a user's manual in my overnight bag as well as on my desk. It's always within reach. I really do practice what you (and I) preach. Thanks Wabbit... you're the best! :shades:
wabbit  
#5 Posted : Monday, March 27, 2006 2:18:38 PM(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)
George, I use Cum(1) a lot... It can be used to make sure there is enough data loaded in an exploration or on a chart to make exponential and self-referencing indicators valid e.g. lastvalue(cum(1))>250 It can be used to remember 'when' a particular event occured on a chart e.g. valuewhen(1,c<ref(c,-1),cum(1)) It can be used in latches (don't happen to have an example at hand but I know I've got one somewhere!) It can be used when writing formulas for moving averages and statistical functions, like deviations etc... etc etc etc It is a very powerful little function! wabbit :D
Jose  
#6 Posted : Monday, March 27, 2006 10:42:52 PM(UTC)
Jose

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 1/19/2005(UTC)
Posts: 1,065
Location: Koh Pha-Ngan, Earth

Was thanked: 2 time(s) in 2 post(s)
Hah! If you thought that Cum(1) was a powerful function, wait until you discover Cum(2)! :boire: jose '-)
kanellop  
#7 Posted : Tuesday, March 28, 2006 9:20:01 PM(UTC)
kanellop

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 6/3/2005(UTC)
Posts: 181

Hello to all. Dear Mr George_Stockman, congratulations for your New Position in Equis! I want also to say a Hello to Wabbit and of course to one of my favourite Persons of Equis Forum, Jose! Jose i hope to go well! Regards, George Kanellopoulos.
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.