Individual Peak Ranges in MPFitInfoStruct (Newbie)

I am writing spectra analyzing code that prompts the user for an element, then fits a list of that element's peaks on the graph and exports the data (peak area, FWHM etc.) labeled by peak name, to a table. I initially thought I could simply repeatedly call gauss fit [rangestart, rangeend] in a for loop, with the appropriate rangestart and rageend. However, it became clear that each time a normal fit is called, the old fit is erased from the graph. So I need to use multipeak fit. My main question is, when creating a MPFitInfoStruct, how do I set the range of individual peak fits? I see that there is an XPointRangeBegin and an XPointRangeEnd, but I want to make sure it fits a peak in the 970-976 range, the 1020-1026 range etc. Is there a way to set the range of individual peak fits? Or is the only way to make sure it fits certain peaks to provide appropriate guesses in your coefficient waves. Thanks for your help!!!
Multipeak Fit is designed to fit the sum of a bunch of peaks. In general, you want to fit sums- peaks that are well separated simply sit on the (insignificant) tails of the other peaks. If the peaks are close together, they sit up on the tails of nearby peaks. That makes the fits more accurate. Fitting the peaks individually means that overlapping peaks are contaminated by the presence of the tails from other peaks, so the fit is forced to try to accommodate the overlapped tails by changing the peak itself.

An alternative to Multipeak Fit is to re-name or duplicate the destination wave within the loop that does the fitting:
For (i = 0; i < nfits; i += 1)
    CurveFit ... mywave /D
    Wave fitw = $("fit_"+NameOfWave(mywave)
    Duplicate/O fitw, $("fit_"+NameOfWave(mywave)+num2str(i)
endfor

The autodestination wave (/D parameter flag with no argument) creates a wave named by pre-pending "fit_" to the beginning of the name of your Y data wave. Doing a second fit with the same Y wave overwrites the autodestination wave. But you can save the previous one by re-naming or duplicating the wave so it doesn't get overwritten.

John Weeks
WaveMetrics, Inc.
support@wavemetrics.com