We revisit the optimal weights for the weighted log-rank test for nonproportional hazards data. It is noted that the optimal weight function can be derived by assuming a stable distribution for an exponentiated omitting covariate from the proportional hazards model, which induces the nonproportionality. A special case is the weight function for the popular Harrington-Fleming’s G test statistic. However, in practice it is not straightforward for investigators to determine the optimal value of the tuning parameter for the weight function in the G test statistic. We propose a maximum likelihood method to estimate the parameter from the observed data, noticing that the parameter is inversely related to the index parameter from the gamma distribution commonly assumed for the frailty model. The simulation results indicate that the test statistic with the estimated weight function from the data are more powerful than the commonly used Harrington-Fleming test with = 1. We also propose a different weight function that possibly gives more power than existing ones to detect middle difference. Three datasets from phase III clinical trials on breast cancer are illustrated as real examples.