This Version Works Fine. I will Try to Use Nsteps to improve Min Max Calculation in next Revisions.
_MDInAvgNStepsID