As per my understanding
5 Years Continuous Service
You will get the gratuity only after the completion of 5 years in the service. Also, there should not be any break in the service. It must be continuous.
Note, the condition of 5 years service has a small relaxation. In the last year, mere service of 240 days would be considered as one year. Hence, You would be eligible for the gratuity after 4 years and 240 days of continuous service.
If are working in an organisation which works for 5 days in a week or less, mere 190 days would be counted as last one year. Therefore, in such case, you would be eligible for the gratuity after 4 years and 190 days.
Continuous service means uninterrupted service. But, it does include the interruption due to, leave, sickness or accident. The strike, lay-off, or a lockout is also not considered as an interruption. Indeed, any interruption which is not due to the fault of the employee, would not be counted. But, if you have taken a sabbatical or leave without pay, then your service would get interrupted.
I will share other judgement for reference
You will be eligible for gratuity if you leave by current employer by Oct,2019. Two months shortfall is there. Still it is at the discretion of the employer who can consider your Gratuity case considering your loyalty and sincere service for 4.10 years. You have not briefed why you have been informed by your HR that you are about to be terminated.
The Gratuity amount can be forfeited only if your services are terminated due to:
a) riotous or disorderly conduct or any other violent act;
b) Committing an offence involving moral turpitude.
Otherwise employer cannot deny gratuity. You may make a polite request to consider to release Gratuity for you. But it is purely employer discretion whether to consider or not.