In this paper, a watermarking technique is presented for digital images based on discrete wavelet transform (DWT) and genetic algorithm (GA). In this technique, in order to achieve greater capacity, the watermark is embedded in two points of each block. The angles of code lines and the selection of samples are determined using the GA algorithm in order to balance the imperceptibility and watermark stability against attacks. In similar methods with the proposed model, the angle value for embedding is considered a constant value. In fact, achieving the high resistance and capacity along with very good image quality is the main goal of this paper. The proposed method is performed on different images in grayscale and system performance is evaluated by the peak signal-to-noise ratio (PSNR), mean structural similarity index (MSSIM), bit error rate (BER), watermark-to-noise ratio (WNR) and signal-to-noise ratio (SNR). The results show the better performance than different similar approaches.