Thanks for your sharing. I found the code just calculate the positive loss. I am confused with where is the negative pair loss calculation?
Thanks for your reply.
Check this line here.