Amibroker writing to file function

#1
I am using writing to file function:

if(fh)
{
if ( LastValue(Buy1) == True AND alreadyopenbuy1 == "" )

I want to add time limit to it:

startTime = 091500; // start in HHMMSS format
endTime1 = 152900; // end in HHMMSS format

timeOK1 = tn >= startTime AND tn <= endTime1;

I tried using

if(fh and timeok1 == true)
{
if ( LastValue(Buy1) == True AND alreadyopenbuy1 == "" )

or

if(fh)
{
if ( LastValue(Buy1) == True AND alreadyopenbuy1 == "" timeok1 == true)

But didn't work.

If anyone can pls guide.

Thanks
 
#2
#Solved

tn = TimeNum();

if ( LastValue(Buy1) == True AND alreadyopenbuy1 == "" and lastvalue(tn) > 091500 and lastvalue(tn) < 153000 )
 

Similar threads