I see that some people have accomplished developing optimization locally in LEAN but from the posts many people struggle debugging it and there is no clear walkthrough on how to do it.  In addition, most that have done this before have done it in C# and I'd like to have an example for python.  I'm going to attempt to work through this and then post a clear walkthrough for others to follow.  Since I have no formal coding experience I want the walkthrough to be understandable to anyone.

Background: I understand there are limitations with overfitting but I've got an algorithm that I would like to optimize several different parameters which would take 1000s of backtests to complete.  I definately hate doing this one by one.

Goal Example: Ability to backtest locally with equity data 200 times for algorithm parameter X using 0.5 unit increments from X=1 to X=100 and have some ability to quickly tabulate the results to determine which result was the best in terms of number of trades, drawdown, net profit

Problems to solve:

1. How to use equity data when backtesting locally.  From my understanding, due to vendor restrictions we cannot download the equity data locally to use.  However with the quanconnect plug in I think there is a way to use the cloud equity data when backtesting locally.  Eitherway, I need access to data for backtesting.  Doesnt need to be same day but pretty recent would be nice.

2. How to import my algo from the cloud to LEAN locally.  I have LEAN and visual studio on my laptop and I've downloaded other peoples algos like the "Genetic optimization" algo.  I have also figured out how to access my backtests locally but I dont know how to import a working algo saved on the website directly into LEAN locally.  IS that possible?

3.  How to set up parameters to optomize.

 

 

So far I have downloaded visual studio and have logged in to quantconnect through visual studio by following the directions in the link below:

https://www.quantconnect.com/tutorials/open-source/backtesting-from-visual-studio

Looks like desktop charting in LEAN is down right now.  It says its not supported anymore and Will be addressed in 2019

https://www.quantconnect.com/tutorials/open-source/desktop-charting-with-leanIf anyone has any suggestions for the 3 problems to solve above or any other comments suggestions or walkthroughs that might help with this project I would welcome them! Thanks everyone

Author