For kernels >4.11
git clone -b extended https://github.com/lwfinger/rtlwifi_new.git
make
sudo make install
modprobe -v rtl8723de ant_sel=2
ant_sel=2 shows the maximum WiFi signal gain. added below lines in a separate conf file:
echo "options rtl8723de ant_sel=2" >> /etc/modprobe.d/rtl8723de.conf