Custom activity charts

How can I access the best maximum pulses in the last 42 days? I don’t know if this is possible

Yes you can:

Example pulling the athletes MMP power curve for the last 42 days (from activity date) and extracting best 5m power:

let mmp42d = icu.bestPower['42d']
let best5mWatts = mmp42d.getWatts(5 * 60)

Sorry I just realised you were probably looking for heart rate data. You can do:

let hr42d = icu.bestHR['42d']
let best5mBpm = hr42d.getBpm(5 * 60)

Everything available is listed here.

Any chance to access fit file messages as in custom activity fields?

Is it possible to code custom charts for the fitness tab too?

You can already do this: Computed fields from fit file messages

Not yet but I am planning to add that soon.