[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Re: TimeNum: What Am I Doing Wrong?



PureBytes Links

Trading Reference Links

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 amibroker@xxxxxxxxxxxxxxx, "longarm61" <norm1@xxx> 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);
>



------------------------------------

**** IMPORTANT ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

*********************
TO GET TECHNICAL SUPPORT from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com
*********************

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html

*********************************
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/