The generation of nonlinear electrostatic solitary waves (ESWs) is explored in a magnetized four component two-temperature electron–positron plasma. Fluid theory is used to derive a set of nonlinear equations for the ESWs, which propagate obliquely to an external magnetic field. The electric field structures are examined for various plasma parameters and are shown to yield sinusoidal, sawtooth and bipolar waveforms. It is found that an increase in the densities of the electrons and positrons strengthen the nonlinearity while the periodicity and nonlinearity of the wave increases as the cool-to-hot temperature ratio increases. Our results could be useful in understanding nonlinear propagation of waves in astrophysical environments and related laboratory experiments.