Trade Smarter with Automation

Capital & Risk Controls

Alta5 provides several safety features ("risk controls") to help protect you from accidental mistakes, excess capital draw and/or bugs in your bot.

What is "draw"?

Draw is the total amount of capital at risk for an opportunity. Alta5 sums the cost to open the opportunity (Cost), commission and margin/maintenance requirements to determine the total capital at risk.

Draw = Cost + Commission + Maintenance


Buy 100 shares @ $50
Cost: $5,000 = 100 × 50
Commission: $6
Maintenance: $0
Draw: $5,006 = 5,000 + 6 + 0

Spread Example

The cost to open a short opportunity that collects premium is a negative value.

Sell to open 10 $100 puts @ $2, Buy to open 10 $99 puts @ $1.50
Cost: -$500 (premium) = (-2 × 10 × 100 = -2,000) + (1.50 × 10 × 100 = 1,500)
Commission: $21 = 6 + (10 × .75 = 7.50) + (10 × .75 = 7.50)
Maintenance: $1,000 = (100 - 99 = $1/share max loss) × (10 contracts × 100 shares = 1,000)
Draw: $521 = -500 + 21 + 1,000

The commissions above ($6 per trade and $.75 per option contract) are only example values. The actual commission fees you pay are determined by your TD Ameritrade account agreement.

Risk Controls

Open opportunity limit

Restricts the number of opportunities a bot can have open concurrently. The limit is set under Settings -> Opportunity limit in the prototype builder.

Opportunity draw limit

Limits the total capital draw for an individual opportunity.

Lifetime draw limit

Limits the total capital draw for a bot in its lifetime. Lifetime draw limit should always be higher than Opportunity draw limit, as it is meant as a stop loss when a bot has had multiple losing opportunities.



Alta5 will send you a notification to approve each new opportunity a bot opens. You can activate approvals in Risk Settings when starting a bot or in the Details column of the bot's dashboard.


Quantity automation

If you open a new opportunity without providing a quantity, Alta5 will use the bot's draw limits to automatically calculate a quantity. As a simplified example, if a bot has an Opportunity Draw Limit of $5,000 and an opportunity draws $50 per share, the calculated quantity would be 100 shares. The actual calculation can be more complex as it factors in premium, commissions and maintenance.

You can also use custom calculations to manually set the quantity and price for an opportunity as long as they are within the draw limits set for the bot opening the opportunity.

Enforcing Limits

Opening opportunities

To ensure capital draw limits are enforced, the maximum potential loss is always used when calculating the quantity for an opportunity. For example, because short selling and writing uncovered (naked) puts represents a greater risk of loss of capital, the calculated quantity for any unsecured short position is calculated on a cash basis. However, the return % for an opportunity is calculated using the actual capital/margin draw according to TD Ameritrade's margin formulas.

For more info on the formulas used to calculate draw for opportunities, see TD Ameritrade's Margin Handbook, page 11-13.

Closing opportunities

Since the maximum potential loss is used to limit quantity when opening opportunities, draw limits are not enforced when closing opportunities. This can potentially allow a bot to draw additional capital (beyond the draw limit) if you request to close a complex opportunity with a capped max loss before expiration.

'bearcall' spread Short 1 $50 call, long 1 $51 call
Maintenance: $100 = (51 - 50) × 100
Market Price: $120 = (2.40 - 1.20) × 100

The maintenance/max loss for the spread is capped at the distance between the 2 strike prices; however, the current market prices to buy it back total greater than the max loss. If you call opp.close() without a fixed price, the bot will likely draw capital beyond the configured draw limit. In this scenario, you can have the bot hold the spread until the price improves or expiration by checking maintenance vs marketValue your monitor script:

// don't buy back for more $ than max loss at expiration
if(-opp.maintenance > opp.marketValue){

Using the bearcall spread above, opp.maintenance would be $100 and opp.marketValue would be -120 (short opportunities always have a negative marketValue).

if(-100 > -120){

Exception - shortcall

A shortcall opportunity is the only type of opportunity that doesn't have a strictly enforced draw limit (because the max loss is unlimited). Draw is calculated at the open as: 30% of strike price minus premium per share. Once the opportunity is open the calculation has 3 possibilities described in TD's Margin Handbook, the highest of which is used:

a) 20% of the underlying stock less the out-of-the-money amount, if any, plus 100% of the current market value of the option(s).
b) For calls, 10% of the market value of the underlying stock PLUS the premium value. For puts, 10% of the exercise value of the underlying stock PLUS the premium value.
c) $50 per contract plus 100% of the premium.