Hello,

I am trying following - 

  1. Calculate exponential regression for x number of days (125 and 250 days) - NOT SURE
  2. Calculate r squared value (Wiki details) - NOT SURE
  3. Then I will try to calculate based on these values the best portfolio to create - CAN BE HANDLED
  4. I would like to calculate the Exp regression * r squared for both 125 and 250 days - EASY TO HANDLE
  5. Finally find a ratio for this - 125/250d values - CAN BE HANDLED
  6. Now there are some other checks which are doable - CAN BE HANDLED
Questions
  1. Any direct functions I can use? I saw LSMA but not sure if it is the exponential regression from point 1 above.
  2. I know the calculations but currently no clue how to calculate this value hopefully with an inbuilt function. I found this function and also that Quantconnect supports it -  link. But I am not able to exactly figure out who to do it.
What I am seeking help 
  1. Can you confirm my question 1 if LSMA is same
  2. Can you help me calculate r squared value or point me to some example which can do this?
Thank you for your helpRay