Explain how you would write a function to calculate specific metrics and indicators for a provided dataset of trade prices. Implement calculate_trade_metrics(prices, window), accepting an array of positive numeric prices and a positive integer window, and return a map containing the overall mean, min, max, and total_return; these metrics use the entire price array. Round numeric results to six decimal places. Example: [100, 110, 121], window 2 returns {mean: 110.333333, min: 100, max: 121, total_return: 0.21}. A single price returns zero total return.
def calculate_trade_metrics(prices, window):