TimeNum is an array and you can't use that in an AND statement as 
written. 

If you want to use arrays do this:
tod = TimeNum();
Buy = IIf(Close > MA( Close, 20 ) AND tod >= 93000 AND tod <= 103000, 
True, False);
This one has the benefit of working with back test.
 
Or if you want to use your original logic do this:
tod = LastValue(TimeNum());
Buy = Close > MA( Close, 20 ) AND tod >= 93000 AND tod <= 103000;
This won't work with back testing.

Using tod is more efficient than calling timenum twice.

Barry

--- In [email protected], "longarm61" <[EMAIL PROTECTED]> wrote:
>
> Hi,
> 
> I just want my buy rule to apply from 9:30 to 10:30.  Apparently 
> there's a syntax error with the code below (second line, at the 
end), 
> but this dummy can't figure it out.  Would somone be kind enough to 
> tell me what I'm doing wrong?  Thanks.
> 
> 
> Buy =         Close > MA(  Close , 20 ) 
>       AND TimeNum()>=93000 AND TimeNum()<=103000);
>


Reply via email to