For the complete documentation index, see llms.txt. This page is also available as Markdown.

Decision Calculations

Overview of the calculations used by decision recipes to determine position value.

Decision Calculations

Rate of Return Calculation

Rate of return is always calculated as max profit / max loss for all position types, where max loss is defined as the theoretical risk less any premium received.

Assume a credit spread where strike width = $2.00 and credit = $0.50, then

Max profit = 0.5
Max risk = 2.00 - 0.5 = 1.5

Rate of return = 0.5 / 1.5 = 33%

% Premium Calculation

The formula for % premium increase/decreased is:

change_percent=changeprice_openchange\_{percent} = \frac {change} {price\_{open}}

wherechange_percentchange\_{percent}is equal to the net change in position value divided by the openPrice of the position, defined as:

let {openPrice, markClose} = position;
let change = markClose - openPrice;
let changePct = change / openPrice * 100;

The definition for markClose calculations of individual position types can be found here.

Return % Calculation

Percentage return measures the percentage gain or loss on an asset or portfolio relative to its starting value.

In the example above, the investor earned a $1,250 total dollar return on a $5,000 investment. To calculate the total return in percentage, simply divide the total gains ($1,250) by the starting value ($5,000) = 25%.

Percentage return formula

Total percent return can be a better indicator of return on investment because it shows growth relative to the initial investment.

Total P/L

The sum of open and closed P/L.

Total P/L %

The total P/L divided by the bot allocation.

Day P/L

The current intraday total P/L minus the previous days closing P/L value or $0 if no previous day.

Day P/L %

The day P/L divided by the previous day's closing net liquid or bot allocation if no previous day.

Closed P/L

The bot's P/L for all closed positions.

Win Rate

The bot's percentage of winning trades. Win Rate (win%) = number of wins divided by total number of closed trades.

Last updated

Was this helpful?