Highest and Lowest daily values

Studies that have been contributed to the community by other users. If you’ve got something useful to share, that’s great!
deobisnath
Posts: 40
Joined: 17 Jul 2007

Highest and Lowest daily values

Postby deobisnath » 31 Aug 2007

Hi:
I need help with this:

I am using 5min intra data; want to calculate val22 below;

Close is the close of this bar;

Lowest(close, daynum) is the lowest DAILY close, same logic for Highest

but these functions return the lowest and highest over intra bars, NOt daily bars

how can I get lowest and highest daily closes ?

Val22 = ( ( Close - Lowest(Close, daynum) )/
(Highest(Close, daynum) - Lowest(Close, daynum) ) )

thanks

Deo

Sergee
Posts: 6
Joined: 18 Jul 2007
Contact:

Highest and lowest daily values

Postby Sergee » 03 Sep 2007

deobisnath, what you are describing can be achieved in a number of ways by writing an indicator but this lies in the sphere of custom programming and is done for a fee.

fs

Postby fs » 03 Sep 2007

Since my programming skills are rather limited, I always have to find workaround for things like that. What I would do, which is most likely not the most efficient way, is as follow:

Add a daily chart as well of the same symbol to your workspace so that you have a 5 minute and daily chart. If you don't care to see the daily chart, make the bars invisible.
Then change your code as follows:

Val22 = ( ( Close - Lowest(Close of data2, daynum) )/
(Highest(Close of data2, daynum) - Lowest(Close of data2, daynum) ) );

Make sure 5 minute chart is data1 and your daily chart is data2.

I am sure there are better ways of doing this though.

Regards
- Fanus

User avatar
ABC
Posts: 718
Joined: 16 Dec 2006
Location: www.abctradinggroup.com
Has thanked: 125 times
Been thanked: 408 times
Contact:

Postby ABC » 03 Sep 2007

Deo,

a simple way would just be to track the highest/lowest close as the day progresses and store the values inside a variable.

Code: Select all

Variables:
HiClose(-999999),
LoClose(+999999);

If Date <> Date[1] then begin {reset the variables on date change}

HiClose = -999999;
LoClose = +999999;

end;

If BarStatus(1) = 2 then begin {to ensure you only get the close of the bar}
If Close > HiClose then HiClose = Close;
If Close < LoClose then LoClose = Close;
end;
Now you can use the two variables for your calculations.

Best regards,

ABC

fs

Postby fs » 03 Sep 2007

Deo,

a simple way would just be to track the highest/lowest close as the day progresses and store the values inside a variable.

Code: Select all

Variables:
HiClose(-999999),
LoClose(+999999);

If Date <> Date[1] then begin {reset the variables on date change}

HiClose = -999999;
LoClose = +999999;

end;

If BarStatus(1) = 2 then begin {to ensure you only get the close of the bar}
If Close > HiClose then HiClose = Close;
If Close < LoClose then LoClose = Close;
end;
Now you can use the two variables for your calculations.

Best regards,

ABC
Hi ABC

I could be wrong, but the example you provided will keep track of the intraday high/low, but from what I understood, Deo want to keep track of the High/Low of the last N days and reference them in the intraday chart..

Regards
- Fanus

User avatar
ABC
Posts: 718
Joined: 16 Dec 2006
Location: www.abctradinggroup.com
Has thanked: 125 times
Been thanked: 408 times
Contact:

Postby ABC » 03 Sep 2007

Fanus,

you are correct, the example will give you only the highest/lowest Close of the current day. If Deo wants to compare values of N days back, he simply has to store the values in an array (or List, Map etc) on date change to make them available for comparison.

Best regards,

ABC

deobisnath
Posts: 40
Joined: 17 Jul 2007

Re: Highest and lowest daily values

Postby deobisnath » 16 Sep 2007

deobisnath, what you are describing can be achieved in a number of ways by writing an indicator but this lies in the sphere of custom programming and is done for a fee.
Can you refer me to these custom programmers? I am interested in hiring one to write a few functions that were written in C++ for Linux platform (g++)

Thanks

deobisnath
Posts: 40
Joined: 17 Jul 2007

Function for Highest/Lowest - does this look ok?

Postby deobisnath » 16 Sep 2007

I coded a function to do return the highest daily close; your comments? suggestions etc


Inputs: numberdays(numericsimple) ;

Variables: highval(-1);

For value1 = 1 To numberdays
Begin
If HighD(value1) > highval Then
highval = HighD(value1);
End;

HighestD = highval;


Return to “User Contributed Studies and Indicator Library”