if you replace the plot statement as follows, then you will be able to see if not any other issue, the following code will control the chart scaling as per HOD, while the previous code will not take control of scaling that is the only difference
Plot(lastvalue(z),"",colorwhite,styleLine|styleThick);
Plot(lastvalue(z),"",colorwhite,styleLine|styleThick);