Page 1 of 1

Highest and Lowest daily values

Posted: 31 Aug 2007
by deobisnath
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

Highest and lowest daily values

Posted: 03 Sep 2007
by Sergee
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.

Posted: 03 Sep 2007
by fs
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

Posted: 03 Sep 2007
by ABC
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

Posted: 03 Sep 2007
by fs
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

Posted: 03 Sep 2007
by ABC
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

Re: Highest and lowest daily values

Posted: 16 Sep 2007
by deobisnath
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

Function for Highest/Lowest - does this look ok?

Posted: 16 Sep 2007
by deobisnath
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;