With regard to knock knees (genu valgum), there are many possible reasons for this position (structural, biomechanical, pathological etc). You would have to asses the total kinetic chain including the joints above and below (hips, ankles and possibly lumbar spine) to get a more complete picture. The shape and form of your pelvis (gender will have an effect on this, with females carrying a larger Q angle, leading to greater valgus position) and hips (including shape and rotation of the femoral head in the hip socket) may play a role in the positioning of your knees. Or it may be due to muscle imbalances/tightness/weaknesses.
There are certain possible correlated motions or postures with genu valgum. These include flat feet, excessive subtalar pronation, and excessive hip adduction among others.
Most times, you will find quite a bit of weakness in the glutes (gluteus medius especially) as well as lack of mobility in the subtalar joint. The tightness in your hip flexors (which is the most likely cause of your anterior pelvic tilt-at times called lower crossed syndrome) can also play a role in the knee pain.
hope that helps