Trade Smarter with Automation

Interactions

Learn how to interact with your bot.

Prompt

Your bot can request additional input when needed by using a "prompt" to send a notification and request for your input. Prompt inputs are similar to bot inputs in that each input results in a form field to provide a value. However, instead of becoming global $ variables, input values are passed to the prompt's script as properties on the $event object.

Example

1. A "Buy calls" button click script sends the $buycalls prompt:

$buycalls.send();
$done();

2. The $buycalls prompt has 3 inputs for you to provide values:


3. The $buycalls prompt has a script that runs when you reply:

$bot.open({
    type: 'call',
    symbol: $under.symbol,
    expiration: $event.expiration, // date input
    strike: $event.strike,         // number input
    maxDraw: $event.draw           // number input
});

$done();

Prompt defaults

If provided, the properties of the data object passed to $prompt.send(data) are copied to the $event object available in your script. If any those property names match the name of a prompt input, the value is used as the default value for the input.

For example, the button script used in step 1 above can be modified to provide default values:

$buycalls.send({
    expiration: 'next friday',
    strike: $$.ceil($under.last, 1)  // next OTM, $1 price increment
});
$done();

Prompt API

  • String

    The id of the prompt.

  •  

    Triggers a notification and a request for input.

    If provided, the properties of the data object are copied to the $event object available in your script. If any those property names match the name of a prompt input, the value is used as the default value for the input.

  • String

    The text for the prompt's submit button. Defaults to 'Submit'.

  • String

    The title text for the prompt screen. Defaults to 'Input requested'.