How to run the AFL between time intervals

Hi,

I want to run my AFL between market hours.So i am using the below code. Here i am trying to run between 10 AM to 3 PM. Please correct me what is wrong in the code.PFA for the error message.

if (100000<TimeNum() AND TimeNum()< 150000)
{
// MY AFL CODE
}

timesince

as well as

https://www.amibroker.com/guide/a_mistakes.html

as well as

https://www.amibroker.com/guide/h_understandafl.html


Example:

tn = TimeNum();
within_session = tn > 100000 AND tn < 150000;

Buy = Cross( C, MA(C, 20) ) AND within_session;
3 Likes