Let $\Gamma$ be a countable abelian semigroup and $\mathcal{A}$ be a countable abelian group satisfying a certain finiteness condition. Suppose that a group $G$ acts on a $(\Gamma \times \mathcal{A})$-gradedLie superalgebra $\mathfrak{L} =\bigoplus_{(\alpha, a) \Gamma \times \mathcal{A}} \mathfrak{L}_{(\alpha, a)}$ by Lie superalgebra automorphismspreserving the $(\Gamma \times \mathcal{A})$-gradation. In this paper, we show that the Euler--Poincar\'e principle yields the generalized denominator identity for $\mathfrak{L}$ and derive a closed form formula for the supertraces $\text{str}(g| \mathcal{L}_{(\alpha, a)})$ for all $g\in G$,where $(\alpha, a) \in \Gamma \times \mathcal{A}$. We discuss the applications of our supertrace formula to various classes of infinite-dimensional Lie superalgebras such as free Lie superalgebras and generalized Kac--Moody superalgebras. In particular, we determine the decomposition of free Lie superalgebras into a direct sum of irreducible$\text{GL}(n) \times \text{GL}(k)$-modules, and thesupertraces of the Monstrous Lie superalgebras withgroup actions.Finally, we prove that the generalized characters of Verma modules and irreducible highest-weight modules over ageneralized Kac--Moody superalgebra $\mathfrak{g}$ corresponding to the Dynkin diagram automorphism $\sigma$ are the same as the usual characters of Verma modules and irreducible highest-weight modules over the orbit Liesuperalgebra $\breve{\mathfrak{g}} = \mathfrak{g}(\sigma)$ determined by $\sigma$. 1991 Mathematics Subject Classification: 17A70, 17B01, 17B65, 17B70, 11F22.