In a large saucepan, combine all the ingredients except the butter and walnuts or pecans (if you're using them). Bring to a simmer and cook, stirring often, for 20-30 minutes, until dark golden and thick. Add a little more liquid if it needs it, if the mixture is looking dry—this will depend on the juiciness of your fruit, and how dry your dried fruit is. It should be thick and slightly saucy—if there is juice in the bottom of your saucepan, make sure it’s syrupy—your spoon should leave a trail through it.
Remove from the heat and let cool; stir in the grated butter and the nuts, if you're using them.
Store in a sealed container or jars in the fridge for up to 2 weeks, or freeze for 6 months.