Very nice piece of code.
Thanks for sharing.

Looking into the script, what is this code for?

var totalSlope=0;
for(i=0;i<enterNum;i++){ // determine the overall weight of wanted assets
totalSlope=totalSlope+assetWeight[assetSorted[i]];
}