Script to auto-detect features to track using Python
You have to update the frame with the right command:
⚠ Note that none of these will properly do it for the tracker operators:
bpy.context.scene.frame_current = frameNumber
bpy.context.scene.frame_set(frameNumber)
bpy.ops.clip.change_frame (ctx, frame = frameNumber)

The one you have to use is:
area.spaces[0].clip_user.frame_current = frameNumber

Then you can un-comment and set up your for loop.
The area here is just bpy.context.screen.areas[number] or bpy.context.area but area alone works in the OP's script.
Or use this add-on I just made:
Step Tracker allows you to batch-track multiple &quot;steps&quot; of n frames without degrading performance on very long shots. Please read the Readme for instructions.