Hi,
how could I get the time of yesterday's high for use in a strategy based on intraday data?
Thank you.
Time of yesterday's high
- Anastassia
- Posts: 179
- Joined: 18 Jan 2010
- Been thanked: 4 times
Hi Joogen,
Please try to get the time of yesterday's high in the strategy based on intraday data using the code below:
Thank you
Please try to get the time of yesterday's high in the strategy based on intraday data using the code below:
Code: Select all
variables:
varPrevHigh( 0 ),
varCurrHigh( 0 );
if Date <> Date[1] then
begin
varPrevHigh = varCurrHigh ;
varCurrHigh = High ;
end
else
begin
if High > varCurrHigh then
varCurrHigh = High ;
end ;
- Anastassia
- Posts: 179
- Joined: 18 Jan 2010
- Been thanked: 4 times
Hi again,
VarPrevTime is the time stamp, when the day high of yesterday occurs.
VarPrevTime is the time stamp, when the day high of yesterday occurs.
Code: Select all
variables:
varPrevHigh( 0 ), varPrevTime( 0 ),
varCurrHigh( 0 );
if Date <> Date[1] then
begin
varPrevHigh = varCurrHigh ;
varPrevTime = time;
varCurrHigh = High ;
end
else
begin
if High > varCurrHigh then
varCurrHigh = High ;
end ;
- Anastassia
- Posts: 179
- Joined: 18 Jan 2010
- Been thanked: 4 times
please try this
Code: Select all
variables:
varPrevHigh( 0 ),
varPrevTime( 0 ),
varCurrHigh( 0 ),
varCurrTime( 0 );
if Date <> Date[1] then
begin
varPrevHigh = varCurrHigh;
varPrevTime = varCurrTime;
varCurrTime = Time;
varCurrHigh = High;
end
else
begin
if High > varCurrHigh then
varCurrTime = Time;
varCurrHigh = High;
end ;
I think I have a solution now. You only have to define or calculate Length input dependent on data resolution.
[/code]
Code: Select all
Input: Length(840);
vars:timeofbarsago(0), counter(0);
If Date<>Date[1] Then begin
For counter = 1 to Length
begin
if H[counter] = HighD(1) then timeofbarsago = time[counter];
end;
end;
Plot1(timeofbarsago,"xxx");