> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.ninjatrader.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.ninjatrader.com/_mcp/server.

# OnCopyTo()

## Definition

Called as the values of a trade metric are saved.

## Syntax

`protected override void OnCopyTo(PerformanceMetricBase target) \{ \}`

## Examples

```csharp
protected override void OnCopyTo(PerformanceMetricBase target)  
{  
   // You need to cast, in order to access the right type  
   SampleCumProfit targetMetrics = (target as SampleCumProfit);  
   if (targetMetrics != null)  
     Array.Copy(Values, targetMetrics.Values, Values.Length);  
}
```