Wall Street traders follow the big news headlines of the day just like everyone else.

Shares of gun companies and makers of body cameras surged Friday following the deaths of five police officers in Dallas and the killings of two black men -- Alton Sterling and Philando Castile -- by police in Baton Rouge and Falcon Heights, Minnesota earlier this week.

Gun makers Smith & Wesson (SWHC) and Sturm Ruger (RGR) both rose more than 3% in early trading Friday.

The two companies have rallied all week after the latest data from the FBI showed a big increase in background checks for guns in June -- a month when 49 people were killed at the Pulse nightclub in Orlando and "Voice" singer Christina Grimmie was shot dead, also in Orlando.

Related: FBI background checks surge in June

Both stocks often move higher following mass shootings. The rationale is that people rush to buy guns for their own personal protection ... but also due to fears that high-profile massacres will eventually lead to stricter gun control laws.

Gun sales have boomed lately, so much so that shares of Smith & Wesson and Sturm Ruger have outperformed tech giants Apple (AAPL) and Google (GOOGL) over the past five years.

But stun gun maker Taser -- which also makes the Axon line of body cameras used by many large police departments nationwide -- and Digital Ally, another body camera manufacturer, both surged on Friday as well.

Taser (TASR)rose 6% while Digital Ally (DGLY) soared nearly 65%

With more and more police-involved shootings of black men making headlines in the past few years, investors are clearly betting that law enforcement agencies will want to invest more in body cameras so they can record any police interactions with civilians to be used as evidence.

It's also become increasingly important to equip police officers with cameras now that more incidents are being filmed by witnesses (and in some cases, victims) on their cell phones -- and often broadcast live on Facebook (FB) and Twitter (TWTR).

Related: Philando Castile and the power of Facebook Live

But investors need to proceed carefully. Digital Ally is a tiny company and it has been a volatile stock for the past few years. It soared nearly two years ago after Michael Brown was killed by police officers in Ferguson, Missouri.

And the stock, even after Friday's big surge, is still down 80% from where it was trading in August 2014.

Sadly though, it seems that there are more and more tragic headlines involving guns -- both by police officers and criminals. So it won't be a huge surprise if investors keep buying Smith & Wesson, Sturm Ruger, Taser and Digital Ally the next time a big shooting makes national headlines.