---
id: "T:cAlgo.API.ChartMouseEventArgs"
kind: "class"
namespace: "cAlgo.API"
url: "https://help.ctrader.com/ctrader-algo/references/EventArgs/ChartMouseEventArgs/"
---

> Documentation index for agents: https://help.ctrader.com/ctrader-algo/llms.txt · machine index: https://help.ctrader.com/ctrader-algo/api.json

# ChartMouseEventArgs (class)

Provides data for the mouse related routed events.

Environments: Desktop supported · CLI not supported · Cloud not supported.

- CLI: Never raised in the CLI: the events that pass it never fire there (ChartArea.MouseDown, ChartArea.MouseEnter, ChartArea.MouseLeave and more).
- Cloud: Never raised in the cloud: the events that pass it never fire there (ChartArea.MouseDown, ChartArea.MouseEnter, ChartArea.MouseLeave and more).

## Definition

```csharp
public class ChartMouseEventArgs
```

## Examples

C#:

```csharp
using cAlgo.API;

namespace cAlgo
{
    // This example shows how to use the Chart ChartMouseEventArgs
    public partial class ChartMouseEventArgsSample : Indicator
    {
        protected override void Initialize()
        {
            Chart.MouseMove += Chart_MouseMove;
        }

        private void Chart_MouseMove(ChartMouseEventArgs obj)
        {
            var text = string.Format("Mouse Location: ({0}, {1})", obj.MouseX, obj.MouseY);

            Chart.DrawStaticText("mouse", text, VerticalAlignment.Top, HorizontalAlignment.Right, Color.Red);
        }

        public override void Calculate(int index)
        {
        }
    }
}
```

Python:

```python
import clr
clr.AddReference("cAlgo.API")

from cAlgo.API import *

class Test():
    def initialize(self):
        api.Chart.MouseMove += self.on_chart_mouse_move

    def on_chart_mouse_move(self, args):
        text = f"Mouse Location: ({args.MouseX}, {args.MouseY})"
        api.Chart.DrawStaticText("mouse", text, VerticalAlignment.Top, HorizontalAlignment.Right, Color.Red)
```

config.json:

```json
{
  "AccessRights": "None",
  "TimeZone": "UTC",
  "IsOverlay": true
}
```

## Properties

- `public bool AltKey {get;}` — Defines whether the Alt key is pressed during the mouse event. [details](https://help.ctrader.com/ctrader-algo/references/EventArgs/ChartMouseEventArgs/AltKey/index.md)
- `public double BarIndex {get;}` — Gets the exact bar index of the mouse event. [details](https://help.ctrader.com/ctrader-algo/references/EventArgs/ChartMouseEventArgs/BarIndex/index.md)
- `public Chart Chart {get;}` — Gets the chart. [details](https://help.ctrader.com/ctrader-algo/references/EventArgs/ChartMouseEventArgs/Chart/index.md)
- `public ChartArea ChartArea {get;}` — Gets the chart area. [details](https://help.ctrader.com/ctrader-algo/references/EventArgs/ChartMouseEventArgs/ChartArea/index.md)
- `public bool CtrlKey {get;}` — Defines whether the Ctrl key is pressed during the mouse event. [details](https://help.ctrader.com/ctrader-algo/references/EventArgs/ChartMouseEventArgs/CtrlKey/index.md)
- `public double MouseX {get;}` — Gets the X-axis value of the mouse event. [details](https://help.ctrader.com/ctrader-algo/references/EventArgs/ChartMouseEventArgs/MouseX/index.md)
- `public double MouseY {get;}` — Gets the Y-axis value of the mouse event. [details](https://help.ctrader.com/ctrader-algo/references/EventArgs/ChartMouseEventArgs/MouseY/index.md)
- `public bool ShiftKey {get;}` — Defines whether the Shift key is pressed during the mouse event. [details](https://help.ctrader.com/ctrader-algo/references/EventArgs/ChartMouseEventArgs/ShiftKey/index.md)
- `public DateTime TimeValue {get;}` — Gets the time value on the X-axis where the mouse event occurs. [details](https://help.ctrader.com/ctrader-algo/references/EventArgs/ChartMouseEventArgs/TimeValue/index.md)
- `public double YValue {get;}` — Gets the Y-axis value of the mouse event. [details](https://help.ctrader.com/ctrader-algo/references/EventArgs/ChartMouseEventArgs/YValue/index.md)

