lodash.js fiddle

Added lodash from cdnjs.com in order to have lodash capabilities in chrome.

by shiv_veerashetty

HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.21/lodash.min.js"></script>

JavaScript

let minPerBackTest = 7
let options = []
let noOfDays = 141
let daysList = _.range(1, noOfDays+1, 1)

if (daysList.length >= minPerBackTest*2) {
	console.log("Days >= 14. Now we shoould show the options")
  const maxParallelBTs = ((noOfDays - (noOfDays % minPerBackTest)) / minPerBackTest) + 1
  options = _.range(2, maxParallelBTs >= 20 ? 21 :maxParallelBTs , 1)
} else {
	console.log("Run in single Backtest. Dont show options")
}

if (options.length) {
		console.log("Possible ooptions :: ", options)
	_.each(options, (option)=>{
  	console.log(`Running ${option} parallel backtest`)
    const chunks = _.chunk(daysList, Math.ceil(noOfDays/option))
    _.each(chunks, (chunk)=>{
    	console.log("BT", chunk, chunk.length)
    })
  })
}