There are answers to your questions but I am doing hard bringing them into a context because I don't really understand what you are trying to achieve. The functionality you are asking for is built in with the Batch Group symbol.
For the Unit Batch search, are you intending to use the built in SearchDialog or what is your use case? PI SDK Programming Reference has an example about how to search for Unit Batches. Please lookup the manuals index for "PIModule.PIUnitBatchSearch".
PI BatchView Programming Reference has sample code on using the FixedBatches property of PIBatchTrendDef. Adding / Removing Batches from the Trend means modifying PIBatchTrendDef.
For your last question, please search PI BatchView Programming Reference for "color".