The upper panel shows the price of the Nasdaq Composite with a moving average (orange line). The lower panel is the output of the above code. Both panels should show the same. However, in the lower panel the moving average is wrongly plotted.
If you do not define a style in that function then the default style of that function is used which is
styleCandle | styleOwnscale
So then PlotForeign is using independent scaling compared to any other plots because of styleOwnScale
So if you do not want to plot with independent scaling then you have to define style in PlotForeign's fourth argument that does not add styleOwnScale, i.e.