This paper deals with the design of coded waveforms which optimize radar performances in the presence of colored Gaussian disturbance. We focus on the class of linearly coded pulse trains and determine the radar code which maximizes the detection performance under a control on the region of achievable Doppler estimation accuracies, and imposing a similarity constraint with a pre-fixed radar code. This last constraint is tantamount to requiring a similarity between the ambiguity functions of the devised waveform and of the pulse train encoded with the pre-fixed sequence. The resulting optimization problem is non-convex and quadratic. In order to solve it, we propose a technique (with polynomial computational complexity) based on the relaxation of the original problem into a semidefinite program. Indeed the best code is determined through a rank-one decomposition of an optimal solution of the relaxed problem. At the analysis stage we assess the performance of the new encoding technique ...