How to konw a postion is close by stoploss or takeproft ,or others reason in history?

 

How to konw a postion is close by stoploss or takeproft ,or others reason in history?

I need some example code .

 Thanks. 

 
If profit is more or less than 0?
If you want to know exactly if tp or sl is triggered then u need to work on the profit part.
Reason: