Stacking traces

I'd like to be able to mass stack traces. Currently, I am doing this by manually dragging traces to overlay each other in one point, a process which I'd like to automate somehow.

Thanks in advance!
Like this?

Function overlayTraces(graphName, overlayPoint)
    String graphName
    Variable overlayPoint
   
    if (strlen(graphName) == 0)
        graphName = WinName(0,1)
    endif
   
    String traces = TraceNameList(graphName, ";", 1)
    Variable ntraces = ItemsInList(traces)
    Variable i
    String trace0 = StringFromList(0, traces)
    Wave w0 = TraceNameToWaveRef(graphName, trace0)
    Variable commonValue = w0[overlayPoint]
   
    for (i = 1; i < ntraces; i += 1)
        String tname = StringFromList(i, traces)
        Wave wn = TraceNameToWaveRef(graphName, tname)
        Variable YatOverlay = wn[overlayPoint]
        Variable dif = commonValue - YatOverlay
        ModifyGraph offset($tname)={0, dif}
    endfor
end

I leave as an exercise the task of using this as a framework for the subtraction task :)

John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
Hello thank you!

I found a satisfying solution that, while not completely automated, is a good compromise between result and invested time writing a proper procedure.

Thanks again!