Skip to content

ChartKeyboardEventArgs.CtrlKey

property · ChartKeyboardEventArgs · cAlgo.API

DesktopCLICloud

True if Ctrl key was pressed otherwise False

Environment behaviour

CLI — not supported. Never raised in the CLI: the events that pass it never fire there (Chart.KeyDown).

Cloud — not supported. Never raised in the cloud: the events that pass it never fire there (Chart.KeyDown).

Definition

public bool CtrlKey {get;}
chartKeyboardEventArgs.CtrlKey: bool

Returns bool

Examples

protected override void OnStart()
{
    Chart.KeyDown += OnChartKeyDown;
}

private void OnChartKeyDown(ChartKeyboardEventArgs args)
{
    if (args.CtrlKey && args.Key == Key.X)
    {
        foreach (var position in Positions.FindAll("keyboard"))
            ClosePosition(position);
    }
}
def on_start(self):
    api.Chart.KeyDown += self.on_chart_key_down

def on_chart_key_down(self, args):
    if args.CtrlKey and args.Key == Key.X:
        for position in api.Positions.FindAll("keyboard"):
            api.ClosePosition(position)