To get this information, you need to parse the chunk of the editor's active take.
The MIDI editor scroll and zoom are hidden within the CFGEDITVIEW field of the chunk:
Code:
ME_LeftmostTick, ME_HorzZoom, ME_TopPitch, ME_PixelsPerPitch = activeTakeChunk:match("\nCFGEDITVIEW (%S+) (%S+) (%S+) (%S+)")
ME_LeftmostTick: Scroll position, given by the leftmost tick visible in the editor.
ME_HorzZoom: If the MIDI editor's timebase = project synced or project time, horizontal zoom is given as pixels per second. If timebase is beats, pixels per tick.
ME_TopPitch:
ME_PixelsPerPitch: Vertical zoom
To get the bottom pitch, you need to get the size of the "midiview" child window using JS_Window_GetClientSize, then get the heights of each of the CC lanes from the chunk, and subtract these heights from the window size.
This is quite an involved process, which I why I submitted a Feature Request that should be very easy to implement:
ReaScript API: Get MIDI editor on-screen layout via MIDIEditor_GetSetting_Int().