How to limit the Buy and Short signals to 10 mins before market close?

I am working on code for E-mini S&P. How can I limit the Buy and Short signals to 10 mins before market close?

TimeEnter = 055959;
TimeQuit = 035559;

tn = TimeNum();
TimeCross = Cross( tn, TimeQuit );
BeforeMarketClose = Cross( tn, 035559 );

Buy[j] = BuyStrategies[j];
Short[j] = ShortStrategies[j];
Sell[j] = Sell1[j] OR ShortStrategies[j] OR BeforeMarketClose[j];
Cover[j] = Cover1[j] OR BuyStrategies[j] OR BeforeMarketClose[j];

If I add tn[j] >= 075959 AND tn[j] < 035059 to the Buy and Short, then there will be no signals generated. How to solve it?

Recommended reading: http://www.amibroker.com/guide/h_understandafl.html

After you read this you would know that you should not use all those array indices.

All that is really needed are tthree lines:

TimeOK = TimeNum() < 155500; // 24h time system is used  
Buy = YourOriginalBuy AND TimeOK;
Cover = YourOriginalCover AND TimeOK;

Since E-mini S&P trades from Sunday - Friday 6:00 p.m. - 5:00 p.m. Eastern Time (ET) with trading halt 4:15 p.m. - 4:30 p.m.
I want to limit NOT to trade from 4pm - 6pm. How can I do that?
After adding:
Buy[j] = BuyStrategies[j] AND tn[j] < 155000 AND tn[j] > 175959;
there will be no signals generated.

@ngterry if you think about it a little bit more...

How can time be LESS than 15:50 AND be Greater than 16:00??

It can't. So you need a different piece of logic there...

How about NOT BETWEEN 15:50 and 16:00. I leave it to you to find the functions and code....