How to predict after add all trees' num

I write a predictor add all trees’ result , but it doesn’t the same as the predict by xgboost.
what function after all trees’ sum?? Please tell me, thank you!

See https://discuss.xgboost.ai/t/xgboost-learning-to-rank-model-to-predictions-core-function.

Thank you for your answer!
I found what’s wrong with my predictor. But i doesn’t konw how to solve it .
I used python xgb to train model and dump it as follow:
booster[0]:
0:[f2<-1.00136e-05] yes=1,no=2,missing=1
1:[f9<322.5] yes=3,no=4,missing=3
3:leaf=-0.933134
4:leaf=-0.3165
2:[f3<-1.00136e-05] yes=5,no=6,missing=5
5:leaf=0.5072
6:leaf=-0.906525

my objective was reg:logistic. Then I cancel the “margin”. But it doesn’t the same as the python xbg’s result. And my predict get to the right answer.
The python xbg use save_model method to got *.model file. I can’t read it. So, I was doubt with these. Is there any different between two models?

To simplify, set base_score=0 when training.

The predictor use 0 as “missing” node, but my features has many 0. I find this. so I will change my features “0”. Thanks for your answer! Thank you!