Conditional code execution depending on time

Hi,

I want to calculate High/Low in a predefined time period and calculate variables on that time period. I have followed the Amibroker guidelines/examples but unable to execute.

Here is my code:

// Calculate High and Low from 12:30pm to 1:00pm
tn = TimeNum();
StartTime = 123000;
EndTime = 130000;
StartBar = tn == StartTime;
EndBar = tn == Endtime;
timeOK = tn >= MarketClose;

If( timeOK )
{
TRH = ValueWhen( EndBar, HighestSince( StartBar, High ) );
TRL = ValueWhen( EndBar, LowestSince( StartBar, Low ) );
}

Here, I want to calculate the values of TRH and TRL if time is between 12:30pm and 1:00pm.
I have also tried:

TRH = ValueWhen( EndBar, HighestSince( StartBar, High ) ) AND timeOK;
TRL = ValueWhen( EndBar, LowestSince( StartBar, Low ) ) AND timeOK;

Both of the above codings gives an error. Can anyone suggest what will be the proper code structure?

Sandeep

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.