Where error 4806 comes from
The runtime code means requested indicator data was unavailable. A CopyBuffer failure or partial copy alone does not prove 4806: invalid handles and buffer indexes can have different errors. Read the actual error and copied count. The numeric value is listed in the official runtime error table, which is separate from MetaEditor compilation errors and trade server return codes.
Reset the last-error state before the suspected call, save its direct return value, and read GetLastError immediately afterward. This produces a causal log instead of a stale code.