> 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.

# Compare()

## Definition

Compares two price values with respect to the Instrument **TickSize** to ensure accuracy when dealing with floating point math.

## Method Return Value

An **int** value.

* A value of "1" is returned if price1 is greater than price2.
* A value of "-1" is returned if price1 is less than price2.
* A value of "0" if price1 is equal to price2.

## Syntax

`Instrument.MasterInstrument.Compare(double price1, double price2)`

## Parameters

| Parameter | Description                              |
| --------- | ---------------------------------------- |
| price1    | A **double** value representing a price. |
| price2    | A **double** value representing a price. |

## Examples

```csharp
double newPrice = Close[0] + High[0] + Open[0];
if (Instrument.MasterInstrument.Compare(newPrice, Close[1]) == 1)
     // Do something since price1 is greater than price2

```