How do I calculate time lag between true value and predicted value I have a prediction model to predicted time-series data.  the result is as below:

you can see that the predicted value have lag compared to label. Is is possible to calculate a value to tell me how many step the predicted value is lagged? so I don't have to check plot manually, because there are too many of them.
 A: Here's what I'd do:


*

*Start with a dataframe that contains two columns: label and prediction.

*Create a third column named lagged_1_pred.

*Populated the lagged_1_pred column by applying the lag function on prediction. Use a lag period of 1 (k=1). See this link for a reference to the lag function in R: https://www.rdocumentation.org/packages/stats/versions/3.5.0/topics/lag 
Note that you can do this in Excel too by simply taking the value from the previous row.

*Take the difference of label and lagged_1_pred. Let's call it diff_1. 

*Calculate the sum of diff_1 column. And then discard lagged_1_pred and diff_1 columns. 

*Repeat steps 2 to 5 for a new column named lagged_2_pred. Use k=2.

*Repeat steps 2 to 5 for a new column named lagged_3_pred. Use k=3.

*Continue for k=4, 5..., K. Where K is some reasonably high value, e.g., 250  (based on a visual inspection of the chart).

*At the end, you will have sum(diff_1), sum(diff_2),...., sum(diff_K).

*Find the minimum absolute value across all of these sums.

*That's your answer! (If you find our that sum(diff_95) is the absolute minimum value across all sums, then your answer is 95).


The basic idea is to find which lag value (k) gives you the minimum total (absolute) difference between the prediction and label.
A: I don't know if you should consider just a lag, like a simple constant deviation between real values and predicted values of the model AFTER a fit.
Fitting data means that you obtain the better fit searching for something.
For exemple, the OLS (ordinary least squares) model finds the better fit searching for the coefficients that minimizes the sum of the squared residuals (including the intercept).
Your model searches for something too, and push or pull data within a period after a fit does not mean that you will predict future values with precision. If you manually adjusts the intercept, the other coefficients will lose what the modeling wanted to find.
So you need to find a better model!
You could search for correlation (residuals and dependent variables). And verify econometric assumptions (prediction depends on that, while fitting a model is just math with no intrinsic meaning) (1).
I think this offers a direction:

Applying 2SLS in a time series context
When there are concerns of
  included endogenous variables in a model t to time series data, we
  have a natural source of instruments in terms of predetermined
  variables. For instance, if y2t is an explanatory variable, its own
  lagged values, y2t.1 or y2t.2, might be used as instruments: they are
  likely to be correlated with y2t, and they will not be correlated with
  the error term at time t; since they were generated at an earlier
  point in time. The one caveat that must be raised in this context
  relates to autocorrelated errors: if the errors are themselves
  autocorrelated, then the presumed exogeneity of predetermined
  variables will be in doubt. Tests for autocorrelated errors should be
  conducted; in the presence of autocorrelation, more distant lags
  might be used to mitigate this concern.

[Wooldridge, Introductory Econometrics, 4th
ed., Chapter 15: Instrumental variables and two
stage least squares] - You can find it here.
(1) For OLS: Gauss-Markov
