This paper presents a procedure to determine the optimal terminal shock position for a ramjet engine, balancing the conflicting requirements of high total pressure recovery and guaranteed stability in the face of disturbances. We classify and quantify the disturbances, both external and internal, that may affect the shock position in supercritical operation. This includes disturbances in the freestream and those due to flow and thermal processes in the combustion chamber. A sensitivity analysis is carried out to establish the effect of these bidirectional (from upstream and downstream) disturbances on the terminal shock position in the intake. The tip-to-tail ramjet engine model required for this purpose is sourced from the authors' recent work. The analysis makes it possible to determine a shock position margin (supercritical margin) that simultaneously induces good engine performance and stable operation at a level of guaranteed probability.