stems or petioles? thse are two different symptoms that point to 2 different issues.
low P can lead to purple petioles. these are the 'stems' of leaves.
low S can lead to red streaks in stems and may even turn completely reddish-purple as it advances.
This can also be related to genetics. LED is also assumed to cause this. When i see it isolated at the top, i assume it's the lights. Right now i have this only at the top and even the petioles are 1/2 red on top but green where the light is shielded underneath.
if you are in hydro/soilless it is useful to know individual ppm of each nute calculated from your guaranteed analysis lables. TDS pens measure EC and that is a guesstimate with a good amount of error. There are apps and web calculators you can use to do this.. just type in label info and it will tabulate it for you.
assuming a roughly 1.3-1.5EC overall oncentration, you want Mg 50-75 range and S 100 and even a bit higher. YMMV due to your tap water too.. if it contributes X ppm of any of this stuff, you may need some small adjustments through observing and reacting to the plant.
N 120-130s in vege, maybe drip 20ppm in bloom, but not much.
P 60
K 180-200
Ca 100+
Mg 50-75-ish
S 100+
this is a good ballpark to start in for hydro/soilless... always need a little trial and error to refine it, but this sort of formula will take a month or 2 before you see any visible symptoms and that tells you it's "close." The longer it takes for a deficiency or toxicity to build up the closer you are to feeding the plant on demand in a proper ratio. these problems only occur when rate of provisioningn does not match rate of use.. when you have a good formula it takes weeks or months to see an issue.. take notes, adjust, do better next time.. within 2-3 grows you'll rarely see any symptom outside of unavoidable and minimal senescence very late in flower. decimated canopies are not senescence.. that is user-error, to put things in perspective.