A residual stress depth profile up to 1 mm is determined with the Ortner method in a single crystal of a nickel-based superalloy which has been subjected to shotpeening. An optimization procedure is assessed to minimize uncertainties connected to Bragg angle, mosaic spread and numerical stability. The theoretical background is reviewed to highlight the connections between Bragg angle positions and the stress tensor components in different coordinate systems and also to obtain a mathematically consistent formulation. Transformation matrices required to express the strain components with respect to the initial state are provided for the general case. It is shown that, when a stress gradient occurs beneath the sample surface plane, the value of the 33 component of the stress tensor determined from measurements is twice its true value. For a sample surface oriented along a h100i crystallographic direction, the data analysis shows that the compressive stresses which develop in the 150 mm-thick surface layer are compensated for by small tensile stresses developing at long scale rather than a specific layer of finite size featuring high tensile stresses. At least 17 Bragg angles are required to have stable solutions with standard deviations close to 30 MPa. Maximum compressive stresses of 1000 or 1400 MPa depending on the assumption used to describe the initial state occur at a 30 mm depth.