Highest High from time_s to present

Questions about MultiCharts and user contributed studies.
t123knight
Posts: 50
Joined: 11 Nov 2005
Contact:

Highest High from time_s to present

Postby t123knight » 19 Feb 2010

I'm trying to get the highest high from bar time_s to present bar. The only function I know of is Highest(high, {#of bars back}) Now if I can replace the # of bars back with a starting time_s that would be perfect. However, I know that doesn't work. Any ideas on how to generate the desired result?

User avatar
Bruce DeVault
Posts: 438
Joined: 19 Jan 2010
Location: Washington DC
Been thanked: 2 times
Contact:

Postby Bruce DeVault » 19 Feb 2010

That could be coded, but would require an indeterminate number of bars of lookback, if you don't know the time_s cutoff in question from the outset. Thus, you would have to be careful not to exceed MaxBarsBack later. The path of least resistance would be to require that the answer be no more than X bars back, and then you could set max bars back to that.

bowlesj3
Posts: 2016
Joined: 21 Jul 2007
Has thanked: 171 times
Been thanked: 402 times

Postby bowlesj3 » 19 Feb 2010

Am I correct in assuming that the time_s you are referring to is some past bar's time? Time_s in 10 second bars would be the current bar because time_s is a reserve word. Even in 1 minute bars time_s is the same time as the current 1 minute bar but with 2 extra zeros representing the seconds.

If I am correct then submit the historic time to either findbar or my binary function (found in user contributed studies) to get the offset number of bars back then use the highest function using the offset you get from the find function(s). Make sure the find functions do not return -1.

Actually findno and my function both search back the maxbarsback distance and return -1 if not found. However you can change them to not do this check and MC will automatically recalculate and change your maxbarsback to a higher value. It does not tell you that it is doing this.

t123knight
Posts: 50
Joined: 11 Nov 2005
Contact:

Postby t123knight » 19 Feb 2010

Ok, so if I have an array (array[1,1] with a time_s in it, would I do the following?

highest(high,findbar(array[1,1]))

Also, if array[1,1] is = to zero then I filled it with current time_s so it will not return a -1

Thanks for all your help

t123knight
Posts: 50
Joined: 11 Nov 2005
Contact:

Postby t123knight » 19 Feb 2010

Also, yes time_s is refering to a past bars time. I'm Using volume bars for this indicator. So I want the highest high from a past bar (time_s back) to current bar.

Thanks alot for all your help once again.

bowlesj3
Posts: 2016
Joined: 21 Jul 2007
Has thanked: 171 times
Been thanked: 402 times

Postby bowlesj3 » 19 Feb 2010

I think that should work. FindBar is a function you can find with the editor. You can go in and inspect it, copy it and adjust it what ever way you want. FindBar is okay if you are not going too far back. If you are going 100 or more you might want to use the binary instead.


Return to “MultiCharts”