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

Notification

Icon
Error

Options
Go to last post Go to first unread
gp7423  
#1 Posted : Friday, January 11, 2008 9:47:48 AM(UTC)
gp7423

Rank: Newbie

Groups: Registered, Registered Users
Joined: 4/19/2007(UTC)
Posts: 2

I want to make a formula that determines how many bars have past since the High exceeds current High, [not the LastValue(H)].

For example, if last week, the High was 50, How many bars have past since the High was 50 or above?

Or if two weeks ago the High was 45, how many bars have past since the High was 45 or above?

I tried:

ValH:=High;

BarsSince(H>ValH);

but it does not work...

I'm looking for something like:

BarsSince(H>CurrentValue(H));

Where CurrentValue(H) is the value of High at that specific moment in time

Your comments and support will be much appreciated

hayseed  
#2 Posted : Friday, January 11, 2008 7:07:04 PM(UTC)
hayseed

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 3/7/2005(UTC)
Posts: 1,346

hey gp..... are you wanting this as a ploted indicator or are you trying to determine the actual value barsince to use in a formula somewhere else......

if your just wanting a visual plot, something like below will plot the common saw tooth wave..... it's just summing the days since the last time the high was a certain value..... then resets and counts again and again..... holler back if that's not what your huntin.....h

//------------------------------------------------

a:= Input("high value",1,1000,50);

BarsSince( H > a)

//-------------------------------------------------

gp7423  
#3 Posted : Monday, January 14, 2008 9:40:55 AM(UTC)
gp7423

Rank: Newbie

Groups: Registered, Registered Users
Joined: 4/19/2007(UTC)
Posts: 2

Thanks, Hayseed for your reply...

I need a formula that gets, in every single period of time, how many bars have past since such period's High was exceeded. The purpose is to use it in a trading system.

What I'm doing is a function with a lot of nested if(s) that compare the period's High with the High of the previous period, then the High of the second previous period, and so on, and exits when it finds the first higher High that the present period's high, returning the bars that past when it exited.

The problem with this, is that the function is limited by the amount of constants that can be used in a function and the size of the formula (bytes).

Thanks for your support...

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.