Having chest pain that comes and goes can be a sign of a heart attack but sometimes it can just be due to gastroesophageal reflux disease which can cause sharp and tender pain in your chest that is similar to a heart attack.
When you have a heart attack you usually have more symptoms than chest pain such as arm numbness, dizziness, shortness of breath, sweating, fatigue, pain that radiates to your neck, back and jaw and cold sweats.
If you think you're having a heart attack though you should either call an ambulance or get to the emergency room as soon as possible.
It's better to get to the emergency room and find out you're not having a heart attack than actually have a heart attack.