Bots

Variables

Bot variables offer a flexible way to configure advanced bot automations for individual bots or for bots that need to communicate to each other. If you have a need for conditional Entry, Exit, or Adjustments based on the current bot's state or another bot's state, you might be able to accomplish that via bot variables. These are considered advanced configuration and should only be used by experienced bot users. Please reach out to support if you need any help or clarification with variables.

What is a bot variable?

A bot variable consists of aĀ nameĀ and aĀ value.

TheĀ nameĀ is some meaningful text that you provide that describes the variable, and theĀ valueĀ is either additional text that you provide, or it is the current state of your bot such as # of Open Positions, Current Profit, Current Delta, or Current Days to Expiration.

What can bot variables do?

Each variable that you configure is available to all of your bots to use to help control entries, exits, or adjustments.

This provides the ability for one bot to have rules that are based on what another bot is doing. Bot variables can also be read by the bot that controls it as well, allowing for more complex automations inside of a single bot.

Bot Variable Ideas

Here is a list of automations that you can perform via bot variables. This is not an exhaustive list, but just a list to give you some ideas about what is possible with variables.

Variable ideas for entries

  • Only open a new position for Bot B if Bot A has no open positions
  • Only open a new position for Bot B if Bot Aā€™s position is under 10 delta
  • Only open a new position if the last position closed at a profit
  • Only open a new position if a bot has lost less than $500 for the day
  • Disable all new entries for the remainder of the day but donā€™t disable bots or close existing positions
  • Enter a second position for your bot only if current profit is greater than 90%

Variable ideas for exits

  • Donā€™t trigger your botā€™s 200% stop loss if the positionā€™s delta is less than 50
  • Disable all new exits for the remainder of the day but donā€™t disable bots or close existing positions
  • Execute monitored stops at 1 DTE but not 0 DTE, or vice-versa
  • Only execute monitored stops on Friday after 3:30pm
  • Close Bot Aā€™s position when Bot B enters a new position

Creating a New Bot Variable

You can create a new bot variable either from a single bot's "Variables" menu or from yourĀ Variables list.

Bot Variable Fields

Bot (Optional):Ā If the variable is tied to a bot, then the value can be one of the bot properties (Current Profit, Current DTE, Current Delta, etc.). If the variable is not tied to a bot, then you can simply enter your own value for the variable for others to use. This offers an easy way for you to have quick toggles or settings for multiple bots.

Variable Name (Required):Ā Some text that describes the purpose or intent of the variable.

Conditions (Optional):Ā If you wish for your variable to only have a value under certain conditions for the current bot, you can include those here. The following conditions are available:

Condition

Description

Day of Week

ļ»æ

Earliest/Latest Time of Day

ļ»æ

Earliest/Latest Time of Day for Last Closed Position Today Exited At

Earliest/latest time filters that will look at the time of day that the bot's last position closed for the current day. If there are no closed positions for the current day, this condition will be met.

Min/Max Open Position Count

Number of OPEN positions the bot currently holds

Min/Max Positions Entered Today Count

Number of new positions entered today by this bot

Min/Max Positions Exited Today Count

Number of new positions exited today by this bot

Min/Max Current Position Delta*

Current delta (x100 absolute value) for the bot's open position

Min/Max Current Position Minutes in Trade*

Minutes since entering the bot's current position

Min/Max Current Position Days in Trade*

Days since entering the bot's current position

Min/Max Current Position Minutes to Expiration*

Current minutes to expiration for the bot's open position

Min/Max Current Position DTE*

Current days to expiration for the bot's open position

Min/Max Current Position ITM %*

% in-the-money for the current open position. This will be "0" if the position is not in-the-money

Min/Max Current Position MID Price*

Mid/market price of the current open position

Min/Max Current Position Profit $*

Current profit in dollars for the bot's open position

Min/Max Current Position Profit %*

Current profit in percent for the bot's open position

Min/Max Bot Last Closed Position Today Profit $*

Profit (in dollars) of the last position closed today by the bot. This will be $0 if no positions closed today.

Min/Max Bot Profit Realized Today $*

Total profit (in dollars) for all positions closed by a bot today. This will be $0 if no positions closed today.

* If you use one of the bot position values above, and your bot currently hasĀ more than oneĀ position open, then the variable will utilize the value from the position that was enteredĀ first.

If you include conditions, the variable will only have a value if all conditions are met. If a variable has no conditions, then it will always have a value.

Value to Set (Required):Ā This is the actual value for the variable. It can either be free text (defined by you), or it can be one of the following values from the bot:

Value

Description

Bot Current Position Open Count

Number of OPEN positions the bot currently holds

Bot Positions Entered Today Count

Number of new positions entered today by this bot

Bot Positions Exited Today Count

Number of new positions exited today by this bot

Bot Current Position Delta*

Current delta (x100 absolute value) for the bot's open position

Bot Current Position Minutes in Trade*

Minutes since entering the bot's current position

Bot Current Position Days in Trade*

Days since entering the bot's current position

Bot Current Position Minutes to Expiration*

Current minutes to expiration for the bot's open position

Bot Current Position DTE*

Current days to expiration for the bot's open position

Bot Current Position ITM %*

% in-the-money for the current open position. This will be "0" if the position is not in-the-money

Bot Current Position MID Price*

Mid/market price of the current open position

Bot Current Position Profit $*

Current profit in dollars for the bot's open position

Bot Current Position Profit %*

Current profit in percent for the bot's open position

Last Closed Position Today Profit $*

Profit (in dollars) of the last position closed today by the bot. This will be $0 if no positions closed today.

Bot Profit Realized Today $*

Total profit (in dollars) for all positions closed by a bot today. This will be $0 if no positions closed today.

* If you use one of the bot position values above, and your bot currently hasĀ more than oneĀ position open, then the variable will utilize the value from the position that was enteredĀ first.

This is the value that will be available for other bots to use for the Entry, Exit, and Adjustments.

Using Variables

Using Variables for Entry Conditions

If you would like to restrict new position entries based on bot variables, you can do that by editing the bot's Entry Condition and then adding the variable(s) to the "Variables (Advanced)" section.

A bot's entry condition can accept any number of variables. Variables that are configured for bot entry mustĀ allĀ be true in order for bot entry to be valid. When your bot is ready for a new position, it will evaluate all entry conditions, including all variables, and only open a new position if everything passes.

Using Variables for Exit Conditions

If you would like to restrictĀ monitored stopsĀ based on bot variables, you may do so by editing the bot's exit condition and adding the variables inside of the Variables (Advanced) section under monitored stops.

Monitored stops are exits such as Stop Loss %, Delta Stop, and ITM % (not profit targets!).

A bot's exit condition can accept any number of variables. Variables that are configured for bot exit mustĀ allĀ be true in order for the monitored stop to be valid. When your bot's monitored stop level is met (stop loss, delta, ITM %), the bot will also evaluate all variables configured for the exit condition, and the bot will only stop out if all variables (if any) are true.

Bot variables on exit conditions only apply toĀ monitored stops. If you would like to apply variables toĀ profit targets (standing orders), you need to add those variables to the appropriate Bot Adjustments (next section).

Using Variables for Adjustments

If you wish to restrict bot adjustments based on variables, you can do that by editing the adjustment itself and adding your variables to the adjustment.

If an adjustment has any variables tied to it, that adjustment will only execute of all variable conditions are met.

This is useful for conditionally removing or adding profit targets or closing a position early based on the condition of the current bot or another bot.

Bot Variable Update Frequency

Bot variables update throughout the trading session, but they areĀ not real-timeĀ (with one exception*).

There can be a 30-60 second delay between when the bot's condition (ie: Profit $, Delta Value) changes and when the variable records that current value.

So if your bot opens a position or profit goes to 100%, the variable will not reflect that change immediately. The variable might not reflect it until 60 seconds later. Please plan accordingly when establishing your Entry, Exit, and Adjustments that are based on variables.

*There is an exception to delayed variable updates throughout the day, and that is when a bot position opens or closes. When a bot position opens or closes, any variables that pull values from that bot will update immediately.

Bot Variable Resets

Bot variables update throughout the day for any bot that is enabled. If a bot is disabled, any variables based on that bot's state will clear out to no value (ie: Open Position Count, Last Realized Profit, Total Realized Profit, Positions Entered/Exited Today).

Variables will also clear their value after market close every day.

Variables that are not tied to a bot's state (variables where you specify free text values) will hold their value until you change it.

Bot Variable Tips

Bot variables can be confusing! Before you start to incorporate a new variable into your bot's Entry, Exit, or Adjustment, check the variable value itself and ensure that it is updating as you would expect it to. You can view all of your variables and their current values on yourĀ Variables list.

If you need any help with variables, don't hesitate to reach out for support!

Updated 30 Jul 2024
Did this page help you?