Do you have numbness as well in those areas of pain?
Do you have lower back pain?
How long has this been going on?
no numbness,lower back pain comes and go ,pain in the leg comes and go
The symptoms you describe -- with pain radiating down into the leg into specific areas of the leg -- that seem to be related to positional changes of the lower back and hip seem to be related to nerve pains.
This can come when a nerve is irritated, or "pinched" in the lower back.
This is called lumbar radiculopathy:
and it certainly sounds as if this is the most likely explanation for your symptoms.
A MRI of the lumbar spine can help with the diagnosis, since it can help to see if there is nerve compression occurring, from something like a herniated disc, for example. But the first step would be to see your doctor, who can do a physical exam, and look for signs of nerve compression, and order the appropriate testing. Taking medications such as Advil or Aleve can help, as they will help with the pain and act as an anti-inflammatory as well.