Skip to content

ChartKeyboardEventArgs.Key

property · ChartKeyboardEventArgs · cAlgo.API

DesktopCLICloud

Keyboard key

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 Key Key {get;}
chartKeyboardEventArgs.Key: Key

Returns Key

Examples

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

private void OnChartKeyDown(ChartKeyboardEventArgs args)
{
    if (args.Key == Key.B)
        ExecuteMarketOrder(TradeType.Buy, SymbolName, 10000, "keyboard");
    else if (args.Key == Key.S)
        ExecuteMarketOrder(TradeType.Sell, SymbolName, 10000, "keyboard");
}
def on_start(self):
    api.Chart.KeyDown += self.on_chart_key_down

def on_chart_key_down(self, args):
    if args.Key == Key.B:
        api.ExecuteMarketOrder(TradeType.Buy, api.SymbolName, 10000, "keyboard")
    elif args.Key == Key.S:
        api.ExecuteMarketOrder(TradeType.Sell, api.SymbolName, 10000, "keyboard")