Average Return of All Buy and Sell Returns

The average return of all buy and sell returns for a stock with N prices is the sum of all returns divided by the number of returns where number of returns is N*(N-1)/2.