I needed to implement profit factor calculation in MySQL code (not MQL4).
I realize PF = gross gain/ gross loss.
For this I care only about PF though and not about the actual point values of gross gain or gross loss (I only care about their relationship to each other).
For each order in my "account history" (which I am recreating) I label short orders as Type = -1 and long orders as Type = 1.
I then do a summation of the table as such:
SUM(Type*((closePrice-openPrice))-Spread)*lots)
Am I correct?
I realize PF = gross gain/ gross loss.
For this I care only about PF though and not about the actual point values of gross gain or gross loss (I only care about their relationship to each other).
For each order in my "account history" (which I am recreating) I label short orders as Type = -1 and long orders as Type = 1.
I then do a summation of the table as such:
SUM(Type*((closePrice-openPrice))-Spread)*lots)
Am I correct?