# Trend with a vol target: a prompt from hedgefund.md

Paste this into your AI agent. It needs no connection to hedgefund.md. An agent that can run code should write and run it, and shouldn't work a long series by hand.

**Question.** What does a hypothetical trend walk with a vol target look like on these prices, with no peek ahead, after costs?

## Method

r_it = p_it / p_i,t-1 - 1. direction_it = sign(p_i,t-1 - p_i,t-1-L). vol_it = stdev(r_i,t-V ... r_i,t-1) * sqrt(periods_per_year). w_it = direction_it * (target / sqrt(N)) / vol_it, size capped at max_leverage. R_t = sum w_it r_it - cost * sum |w_it - w_i,t-1|. Equity_t = Equity_t-1 * (1 + R_t).

## Conventions

- No peek ahead: day t's weight uses prices through day t-1 only, and it earns day t's return. The direction and rolling vol stop one day before the return they are applied to.
- Returns are simple, close to close. Rolling vol is the sample stdev (n - 1) of the last vol_days returns.
- The walk starts at the first day both windows are full, from flat, so the first day pays to build the book.
- target_vol / sqrt(N) would hit the target only if the markets were uncorrelated and the vol estimates were right. Realized vol is reported beside the target.
- N is the number of markets sent, whether or not each has a position that day.
- Annual vol is stdev of daily returns times sqrt(periods_per_year). Annual mean is the mean daily return times periods_per_year. Mean to vol doesn't subtract any cash rate.
- A market whose rolling vol is zero, or whose trailing return is exactly zero, gets no position that day. Stale prices aren't read as low risk.
- Turnover is the sum of changes in target weights. Hit rate counts days with a non-zero return.
- If a day's loss takes equity to zero or below, the walk stops there.
- The weights stay inside the walk. The result gives averages and totals, and no market's weight or direction at the end of the series, because on current prices that would read as a position to take.

## Step 1: check your method on these made-up numbers

The numbers and names below are made up. They aren't market levels, typical values or anyone's real figures.

```json
{
  "markets": [
    {
      "name": "Market A",
      "prices": [
        100, 100.75, 101.5, 100.58, 100.6, 100.67, 100.47, 101.2, 101.41, 101.65,
        101.94, 102.84, 105.17, 105.55, 105.61, 104.46, 103.6, 101.81, 101.97, 102.47,
        101.82, 102.83, 102.63, 103.33, 103.71, 103.92, 105.19, 105.67, 106.18, 104.98,
        104.41, 104.57, 104.43, 103.44, 103.42, 104.85, 105.56, 103.6, 102.56, 103.77,
        103.04, 102.06, 101.88, 102.44, 103.09, 104.63, 105.06, 104.62, 107.61, 107.76,
        107.08, 107.32, 107.97, 108.93, 109.2, 109.84, 111.49, 112.69, 113.29, 113.88,
        113.95, 111.6, 110.9, 111.46, 113.46, 113.83, 111.87, 112.15, 113.03, 113.47,
        114.16, 114.68, 114.23, 114.84, 116.6, 116.44, 116.68, 117.1, 117.12, 116.21,
        115.73, 115.65, 115.04, 115.33, 114.9, 116.37, 115.62, 116.93, 117.77, 118.28,
        119.32, 116.7, 114.84, 113.48, 112.14, 114.2, 113.23, 111.96, 112.44, 113.18,
        113.66, 115.72, 116.51, 117.58, 118.9, 118.11, 119.46, 117.12, 116.18, 117.11,
        115.91, 115.88, 115.89, 116.5, 118.34, 119.64, 119.61, 119.05, 118.45, 119.04,
        118.26, 118.66, 119.54, 122.23, 123.01, 124.49, 124.53, 123.77, 122.91, 123.75,
        125.02, 126.37, 127.02, 125.88, 126.2, 127.8, 126.41, 126.18, 127.78, 126.7,
        127.73, 126.6, 127.41, 127.72, 126.63, 126.71, 128.44, 128.39, 128.32, 130.73,
        133.16, 132.23, 132.48, 133.26, 133.23, 134.34, 132.26, 129.77, 129.75, 130.69,
        131.68, 132.14, 132.26, 133.93, 133.05, 132.99, 131.49, 131.54, 134.37, 135.63,
        136.33, 136.68, 136.64, 135.85, 136.7, 136.69, 138.63, 138.05, 137.48, 138.22,
        137.24, 137.78, 139.63, 139.58, 142.4, 140.94, 141.49, 142.13, 144.49, 146.43,
        147.69, 146.5, 147.79, 148.51, 149.6, 148.48, 150.1, 152.78, 155.12, 155.54,
        155.2, 156.4, 157.75, 159.6, 159, 158.07, 157.95, 157.71, 158.75, 157.66,
        157.33, 157.3, 155.53, 155.46, 155.65, 155.89, 156.05, 156.13, 155.14, 156.23,
        155.64, 156.58, 156.11, 154.65, 155.08, 155.92, 158.2, 159.01, 160.73, 161.66,
        161.4, 162.48, 165.56, 166.34, 164.35, 163.7, 163.78, 166.87, 164.54, 165.84,
        166.62, 165.54, 163.49, 164.4, 165.86, 166.41, 167.84, 167.1, 167.74, 165.26,
        166.27, 167.87, 168.75, 167.9, 168.26, 169.75, 169.1, 169.93, 169.32, 172.34,
        173.22, 168.91, 168.88, 167.08, 167.11, 168.36, 166.73, 164.48, 163.33, 164.81,
        165.79, 164.41, 166.28, 168.77, 171.47, 172.77, 171.37, 170.91, 170.77, 169.17,
        168.4, 166.12, 166.25, 166.97, 166.36, 166, 165.02, 166.34, 167.38, 167.71,
        166.95, 163.85, 163.25, 163.65, 163.6, 163.23, 165.87, 166.64, 165.79, 165.28,
        164.55, 163.49, 164.73, 162.78, 165.43, 166.58, 165.41, 164.98, 164.82, 163.34,
        163.55, 159.99, 161.73, 158.72, 158.43, 158.16, 159.71, 161.02, 159.42, 160.59,
        162.4, 162.45, 163.53, 161.9, 162.12, 161.97, 163.62, 162.45, 163.8, 163.72,
        161.77, 165.06, 166.79, 166.55, 166.55, 167.46, 169.15, 168.84, 166.77, 168.58,
        168.62, 168.57, 168.23, 166.81, 164.73, 165.35, 165.71, 166.57, 167.02, 168.76,
        169.22, 167.52, 169.37, 166.66, 168.91, 168.16, 166.34, 166.11, 165.54, 168.3,
        169.33, 168.88, 170.96, 168.55, 169.89, 169.83, 172.41, 175.11, 175.37, 174.33,
        175.83, 174.73, 174.15, 176.33, 175.08, 176.28, 177.32, 174.66, 172.8, 172.67,
        174.02, 173.45, 177.46, 173.14, 173.99, 174.6, 175.76, 172.61, 172.29, 172.02,
        172.14, 172.92, 174.54, 171.18, 171.33, 171.35, 172.1, 172.88, 172.83, 172.22,
        172.63, 173.31, 170.85, 171.62, 171.26, 171.24, 169.54, 172.43, 171.71, 171.86,
        171.06, 170.41, 171.36, 170.31, 171.34, 169.3, 168.77, 167.73, 166.99, 167.13,
        163.4, 162.07, 163.52, 162.01, 160.94, 159.92, 160.27, 161.69, 160.9, 162.03,
        160.23, 160.9, 160.85, 160.19, 160.75, 160.56, 160.79, 161.97, 162.24, 161.03,
        159.61, 159.45, 158.89, 158.92, 158.49, 160.8, 161.64, 161.31, 160.24, 159.26,
        160.57, 161.07, 161.56, 159.84, 158.94, 158.68, 159.84, 160.85, 159.45, 158.89,
        158.12, 158.09, 157.35, 156.85, 157.61, 157.62, 156.28, 159.55, 158.47, 159.69,
        159.42, 157.19, 155.94, 156.03, 154.61, 152.5, 151.69, 153.23, 152.41, 154.44,
        155.44, 155.66, 155.07, 154.29, 155.04, 154.8, 157.76, 157.87, 158.59, 157.17,
        156.89, 154.73, 154.35, 153.59, 154.19, 153.79, 153.68, 154.21, 153.87, 153.55,
        155.22, 153.65, 150.93, 150.6
      ]
    },
    {
      "name": "Market B",
      "prices": [
        100, 100.03, 100.41, 99.77, 99.15, 98.75, 98.47, 98.62, 98.52, 98.62,
        99.11, 99.9, 100.37, 99.69, 99.74, 99.31, 99.65, 99.7, 99.54, 100,
        99.36, 99.68, 99.93, 100.23, 101.25, 101.16, 101.61, 101.18, 100.76, 100.26,
        100.73, 100.85, 100.66, 100.73, 101.06, 100.77, 100.2, 99.4, 99.17, 99.51,
        99.32, 99.23, 99.22, 99.63, 100.07, 100.44, 100.08, 99.75, 99.94, 100.32,
        99.79, 99.35, 98.88, 99.34, 99.15, 99.59, 99.81, 100.45, 100.35, 99.23,
        99.33, 98.88, 98.11, 98.6, 98.31, 98.9, 99.13, 98.16, 98.24, 98.2,
        98.62, 99.04, 98.43, 97.9, 98.6, 98.46, 98.5, 99.17, 98.86, 98.4,
        98.87, 99.08, 98.95, 98.54, 97.91, 97.55, 97.2, 96.91, 98.2, 99.17,
        99.5, 99.49, 99.42, 98.98, 98.39, 98.56, 98.5, 98.4, 97.92, 97.69,
        98.5, 98.78, 99.4, 99.96, 100.79, 101.17, 100.43, 99.9, 99.99, 100.12,
        99.54, 99.53, 98.58, 99.61, 100.63, 100.61, 101.44, 101.1, 101.01, 101.31,
        102.24, 102.28, 102.51, 103.3, 104.17, 105.27, 105.22, 105.36, 105.04, 104.7,
        105.18, 105.41, 105.15, 105.38, 105.36, 105.56, 105.49, 106.02, 106.01, 105.16,
        105.01, 104.31, 104.39, 104.98, 104.53, 104.4, 104.8, 105.36, 105.86, 106.8,
        107.04, 106.45, 106.61, 107.35, 107.03, 107.17, 106.36, 105.95, 107.18, 107.2,
        108.12, 108.28, 107.73, 107.68, 107.37, 106.93, 106.6, 106.79, 106.55, 106.41,
        106.72, 107.17, 107.11, 106.81, 107.88, 107.27, 108.17, 108.35, 108.55, 108.49,
        108.41, 108.48, 108.79, 108.63, 109.76, 109.41, 109.79, 109.24, 109.24, 109.35,
        110.33, 110.88, 110.65, 109.69, 110.19, 110.36, 110.72, 111.71, 112.6, 112.34,
        111.99, 112.97, 112.94, 112.65, 112.21, 112.09, 112.07, 111.77, 112.44, 111.02,
        110.14, 110.38, 109.28, 109.58, 108.76, 109.18, 110.52, 109.82, 108.59, 108.67,
        108.48, 109.06, 109.48, 109.59, 109.95, 109.5, 108.63, 109.17, 109.27, 108.5,
        109.09, 108.7, 109.22, 109.23, 108.58, 108.11, 108.78, 110.19, 109.06, 109.61,
        109.21, 108.82, 107.97, 108.82, 109.08, 108.57, 108.61, 108.55, 107.57, 107.23,
        107.07, 107.15, 107.42, 107.51, 107.64, 107.56, 107.37, 107.6, 107.42, 106.82,
        107.08, 106.21, 105.22, 104.66, 104.66, 104.79, 104.57, 103.65, 104.38, 104.56,
        104.37, 104.41, 104.47, 104.7, 105.23, 105.16, 105.06, 106.02, 107.16, 107.4,
        107.21, 106.19, 105.61, 105.51, 105.48, 104.77, 104.58, 104.46, 104.59, 104.64,
        103.67, 102.58, 102.06, 102.53, 102.2, 101.88, 102.63, 103.25, 103.08, 103.25,
        104.02, 103.91, 104.29, 103.92, 104.46, 105.34, 105.14, 103.88, 104.3, 104.69,
        105.07, 104.39, 104.15, 104.15, 104.16, 103.84, 103.49, 103.12, 103.68, 104.32,
        104.68, 105.12, 105.47, 105.41, 105.3, 105.73, 105.8, 104.75, 104.76, 105.07,
        104.97, 105.74, 106.67, 106.57, 106.52, 106.91, 107.34, 107.74, 106.8, 107.7,
        107.95, 107.47, 108.33, 108.11, 108.16, 108.17, 108.23, 108.65, 108.56, 109.1,
        109.25, 108.86, 110.04, 109.46, 110.25, 110.06, 109.35, 107.93, 107.88, 108.27,
        108.42, 108.05, 108.63, 107.98, 107.77, 108.17, 108.73, 109.7, 109.71, 109.36,
        109.47, 109.23, 109.71, 109.71, 110.16, 110.29, 109.88, 110.14, 110.5, 110.23,
        110.65, 110.6, 112.15, 111.66, 111.69, 112.04, 113.01, 112.62, 113.51, 113.75,
        113.46, 113.46, 113.63, 112.46, 112.54, 112.01, 112.16, 111.66, 112.73, 112.24,
        112.56, 112.52, 112.61, 112.21, 112.17, 112.44, 111.76, 112.5, 111.86, 112,
        112.88, 113.36, 114.43, 115.09, 114.95, 114.27, 114.27, 113.7, 114.07, 113.84,
        113.22, 112.64, 112.05, 111.66, 111.42, 111.27, 111.28, 111.99, 112.08, 112.61,
        113.06, 112.51, 111.6, 110.85, 110.35, 110.57, 111.69, 112.27, 112.38, 112.62,
        113.21, 112.32, 112.18, 111.08, 111.43, 111.93, 112.88, 113.45, 113.54, 113.47,
        114.05, 114.67, 115.48, 115.1, 114.54, 113.64, 114.3, 113.77, 112.67, 112.37,
        112.84, 112.73, 112.27, 112.53, 113.09, 113.2, 113.47, 114.37, 113.74, 113.9,
        113.61, 112.08, 113.18, 112.93, 113.1, 113.53, 113.83, 113.84, 113.52, 113.76,
        113.75, 114.18, 114.43, 114.14, 113.97, 114.56, 115.08, 114.72, 114.32, 114.05,
        114, 113.37, 113.06, 113.12, 113.03, 112.91, 112.87, 113.62, 112.78, 113.01,
        113.02, 112.57, 112.58, 112.27
      ]
    },
    {
      "name": "Market C",
      "prices": [
        80, 79.43, 80.14, 80.44, 78.01, 77.12, 78.2, 78.74, 79.15, 81.07,
        82.6, 84.21, 84.53, 82.38, 83.75, 82.32, 81.45, 78.5, 78.03, 81.04,
        79.98, 80.23, 80.21, 80.4, 82.49, 83.22, 83.15, 83.06, 81.59, 79.86,
        79.48, 79.37, 78.74, 79.19, 80.83, 81.47, 81.77, 80.17, 80.36, 81.36,
        81.28, 82.72, 82.86, 82.74, 84, 84.54, 86.31, 86.97, 90.45, 92.64,
        91.28, 90.29, 90.28, 91.73, 90.71, 91.48, 92.76, 93.23, 91.63, 89.64,
        89.48, 89.69, 89.27, 89.51, 90.32, 93.17, 92.46, 91.73, 92.22, 91.03,
        91.58, 92.16, 91.39, 92.18, 92.67, 93.09, 93.52, 93.08, 92.84, 92.13,
        92.9, 92.72, 92.82, 91.14, 91.28, 92.43, 90.49, 91.85, 94.42, 95.49,
        96.43, 95.25, 94.83, 94.3, 92.56, 93.05, 93.71, 91.74, 90.83, 91.75,
        90.59, 89.12, 88.96, 89.31, 92.2, 91.29, 90.91, 91.1, 90.14, 90.14,
        89.58, 88.86, 89.04, 90.97, 93.04, 93.15, 92.81, 93.28, 92.66, 91.3,
        91.58, 92.55, 93.25, 93.8, 95.8, 96.73, 96.27, 96.66, 94.86, 93.53,
        95.12, 96.29, 96.98, 95.91, 98.02, 97.98, 96.79, 97.97, 98.65, 98.55,
        99.05, 97.45, 98.21, 98.2, 97.17, 98.29, 95.87, 96.72, 97.31, 100.23,
        101.09, 101.43, 102.25, 104.66, 103.59, 104.63, 103.59, 102.6, 103.58, 104.51,
        105.26, 102.86, 101.97, 102.59, 103.19, 102.21, 99.11, 99.16, 98.75, 100.02,
        99.07, 98.75, 99.63, 98, 100.16, 101.43, 103.07, 102.45, 102.85, 103.06,
        99.76, 101.1, 102.32, 103.79, 106.87, 105.62, 106.44, 105.12, 105.96, 108.62,
        110.62, 111.08, 111.35, 111.22, 111.88, 110.23, 112.79, 112.73, 111, 111.57,
        111.37, 113.23, 115.61, 118.73, 118.58, 117.51, 117.02, 112.83, 113.36, 111.29,
        109.51, 110.19, 107.94, 108.25, 107.37, 109.28, 110.33, 108.41, 109.72, 111.55,
        111.06, 112.33, 112.72, 110.54, 111.71, 111.35, 109.74, 112.96, 113.16, 113.69,
        115.12, 114.83, 116.79, 117.48, 116.45, 118.39, 116.68, 119.67, 119.07, 120.19,
        119.04, 118.93, 120.48, 122.43, 122.87, 122.64, 123.31, 124.51, 122.88, 120.09,
        121.84, 122.19, 121.99, 122.54, 125.99, 126.98, 126.91, 128.82, 131.76, 132.03,
        132.03, 129.17, 127.74, 128.13, 130.37, 129.29, 126.89, 125.16, 125.9, 126.21,
        126.45, 122.3, 122.85, 122.67, 125.89, 130.03, 129.19, 129.83, 133.04, 133.54,
        132.19, 130.29, 130.49, 132.02, 132.09, 132.22, 128.86, 129.9, 132.02, 132.65,
        131.08, 128.38, 126.66, 130.1, 129.25, 130.21, 132.53, 133.7, 134.28, 132.91,
        134.3, 131.73, 132.53, 130.55, 132.37, 134.73, 133.82, 131.74, 132.79, 134.83,
        134.69, 131.12, 131.23, 129.4, 131.45, 130.6, 129.01, 129.73, 127.83, 129.66,
        130.34, 131.78, 134.2, 133.24, 131.7, 129.6, 130.15, 129.1, 130.63, 133.17,
        133.78, 134.72, 137.18, 135.75, 136.62, 138.03, 140.02, 141.77, 140.21, 141.73,
        142.95, 140.13, 140.87, 140.88, 140.01, 140.4, 140.45, 141.93, 141.65, 143.87,
        143.92, 141.26, 142.54, 139.32, 140.52, 140.28, 138.55, 136.4, 137.02, 138.48,
        137.01, 136.03, 133.98, 130.53, 129.15, 131.38, 131.63, 134.14, 133.76, 133.07,
        132.3, 130.91, 132.57, 134.3, 134.81, 137.35, 139.06, 138.74, 136.75, 139.45,
        139.79, 139.62, 143.87, 140.35, 138.86, 137.63, 135.86, 135.05, 134.38, 133.93,
        134.25, 135.32, 134.64, 131.28, 131.41, 131.53, 132.72, 132.35, 132.56, 132.83,
        133.1, 134.57, 131.72, 129.65, 130.59, 130.22, 128.25, 128.17, 128.51, 127.49,
        129.14, 127.23, 125.89, 127.41, 126.14, 124.5, 124.3, 123.75, 122.74, 123.45,
        122.05, 122.22, 120.58, 119.86, 121.9, 120.83, 120.99, 121.88, 122.9, 123.49,
        123.69, 123.3, 122.26, 121.49, 120.66, 119.5, 118.77, 118.88, 118.41, 118.91,
        120.01, 116.57, 116.16, 115.1, 112.26, 114.07, 115.62, 116.31, 116.03, 115.38,
        116.39, 117.82, 121.71, 121.26, 119.95, 118.08, 119.46, 120.85, 118.15, 117.22,
        120.59, 120.71, 120.45, 120.1, 120.34, 119.21, 122.94, 126.18, 124.54, 123.8,
        123.31, 120.22, 121.59, 123.56, 123.81, 124.45, 126.44, 126.72, 123.94, 125.3,
        123.79, 123.75, 122.64, 123.26, 123.86, 125.78, 130.23, 130.65, 130.76, 127.99,
        125.72, 122.8, 121.34, 119.16, 119.19, 120.02, 120.11, 119.35, 119.14, 118.67,
        119.82, 117.23, 118.08, 116.33
      ]
    },
    {
      "name": "Market D",
      "prices": [
        120, 119.94, 121.62, 121.9, 120.79, 120.17, 120.6, 120.74, 120.65, 121.5,
        121.61, 122.17, 122.32, 122.86, 123.42, 122.52, 122.26, 120.88, 119.32, 120.03,
        119.42, 120.1, 119.73, 120.23, 120.22, 120.48, 121.19, 121.54, 120.87, 119.84,
        120.66, 121.48, 121.88, 121.25, 121.81, 120.63, 119.9, 119.93, 118.69, 120.06,
        118.86, 118.26, 118.02, 118.47, 118.92, 119.92, 119.51, 119.57, 121.77, 121.77,
        121.34, 121.3, 121.25, 121.2, 121.42, 121.71, 122.5, 121.95, 122.18, 121.5,
        121.69, 121.46, 121.35, 121.12, 121.4, 121.72, 121.72, 121.46, 121.33, 121.61,
        121.37, 122.08, 121.78, 121.82, 121.86, 122.16, 122.49, 122.48, 122.94, 122.1,
        123.25, 123.1, 122.47, 122, 121.67, 123.44, 122.33, 123.06, 124.52, 124.53,
        124.88, 124.57, 124.59, 124.88, 124.83, 125.29, 124.73, 124.99, 123.76, 123.67,
        123.9, 123.88, 125.47, 125.57, 127.26, 127.3, 126.84, 126.87, 127.11, 126.13,
        125.27, 125.54, 125.45, 126.41, 127.9, 128.16, 129.14, 129.67, 129.63, 129.61,
        130.17, 130.89, 131.03, 132.29, 133.99, 134.98, 135.05, 134.5, 133.91, 134.38,
        134.92, 135.15, 135.99, 136.61, 135.72, 136.17, 135.39, 135.65, 135.78, 135.81,
        136.15, 135.45, 136.14, 136.11, 135.26, 135.17, 134.15, 134.6, 134.99, 137.18,
        137.61, 138, 137.6, 137.61, 136.46, 135.89, 135.3, 134.28, 135.11, 136.36,
        135.75, 135.04, 135.35, 134.37, 135.28, 135.32, 134.2, 134.77, 135.73, 136.61,
        136.7, 136.82, 137.54, 137.43, 138.35, 138.69, 137.68, 137.27, 136.85, 137.63,
        137.63, 138.04, 138.25, 138.35, 140.41, 140.16, 139.52, 139.3, 140.01, 140.53,
        141.79, 141.72, 143.37, 142.39, 143.13, 142.68, 141.42, 142.33, 143.01, 143.27,
        143.01, 143.76, 145.02, 144.65, 143.5, 143.43, 142.92, 142.11, 142.15, 141.57,
        140.35, 140.4, 138.89, 139.37, 139.39, 139.18, 140.64, 140.05, 140.04, 140.37,
        140.63, 141.55, 142.06, 142.25, 143.26, 142.76, 141.95, 142.52, 142.96, 142.96,
        143.58, 143.68, 144.25, 144.21, 143.51, 142.47, 142.17, 143.37, 143.06, 143.3,
        142.34, 141.01, 141.58, 142.69, 143.39, 142.74, 142.35, 141.81, 140.51, 138.99,
        140.45, 142.26, 143.64, 144.06, 143.86, 144.24, 144.74, 144.89, 144.81, 145.08,
        146.15, 144.54, 143.03, 142.46, 142.49, 141.33, 140.57, 139.27, 140.04, 139.72,
        140.16, 138.83, 138.27, 139.13, 139.57, 138.99, 138.36, 138.84, 139.77, 139.5,
        139.44, 139.51, 138.85, 139.28, 139.3, 138.35, 137.96, 138.41, 139.15, 138.14,
        136.97, 135.52, 135.01, 136.17, 134.95, 135.55, 136.67, 135.63, 135.75, 134.73,
        134.55, 134.49, 134.46, 133.19, 133.63, 134.78, 134.31, 133.91, 133.38, 132.57,
        132.64, 131.38, 130.3, 131.14, 131.16, 131.14, 132.53, 132.81, 131.87, 133.84,
        134.77, 134.38, 135.88, 135.65, 135.65, 134.5, 135.94, 135.08, 134.68, 135.2,
        134.55, 136.3, 137.95, 137.74, 137.51, 138.31, 139.65, 139.49, 138.85, 139.32,
        138.65, 138.61, 139.92, 138.39, 137.41, 137.16, 138.56, 138.28, 138.24, 139.41,
        139.46, 137.95, 138.79, 138.01, 139.34, 139.62, 140.16, 139.78, 140.97, 142.33,
        142.1, 142.02, 142.81, 141.66, 141.47, 142.49, 142.32, 143.36, 143.51, 143.48,
        143.43, 142.66, 143.3, 144.09, 144.02, 144.24, 145.09, 144.4, 143.91, 144.8,
        144.77, 146.35, 147.91, 145.31, 144.22, 144.56, 144.66, 143.72, 144.94, 143.65,
        144.26, 144.45, 145.39, 143.08, 142.62, 143.52, 144.09, 144.37, 145.19, 144.69,
        143.67, 143.64, 143.13, 142.59, 143.37, 143.41, 142.9, 145.92, 145.96, 145.96,
        145.84, 146.75, 147.39, 147.36, 147.94, 148.73, 147.96, 147.09, 145.43, 145,
        142.71, 143.28, 143.51, 143.16, 144.48, 145.27, 143.44, 143.84, 143.4, 144.24,
        144.15, 143.83, 142.99, 142.61, 143.04, 142.73, 143.3, 144.3, 143.74, 144.27,
        143.71, 143.22, 142.98, 142.02, 141.34, 142.83, 143.95, 143.94, 144.8, 145.17,
        144.81, 145.58, 146.09, 145.89, 144.7, 143.82, 144.41, 144.59, 143.06, 143.86,
        144.49, 143.85, 143.84, 143.38, 143.73, 142.52, 142.27, 143.34, 141.99, 142.68,
        141.41, 139.64, 140.18, 140.51, 141.46, 141.41, 141.85, 142.15, 141.88, 142.3,
        142.32, 143.41, 144.73, 143.56, 143.8, 144.73, 146.49, 146.4, 146.36, 145.85,
        146.01, 145.16, 144.77, 145.26, 146.25, 146.75, 145.63, 146.69, 147.28, 147.41,
        148.24, 146.03, 145.14, 144.95
      ]
    }
  ],
  "lookback_days": 126,
  "vol_days": 63,
  "target_vol_pct": 10,
  "max_leverage": 2,
  "cost_bps": 5,
  "periods_per_year": 252
}
```

Work them out with the method above. Yours should match these within 0.5%.

- Hypothetical annual mean: 7.1326 % a year
- Hypothetical annual vol: 12.416 %
- Hypothetical mean to vol: 0.5745
- Hypothetical largest drawdown: 17.8552 %
- Hypothetical hit rate: 50.6631 %
- Hypothetical average gross: 1.7506 x NAV
- Hypothetical turnover: 21.9677 x NAV a year
- Days walked: 377

Where the outcome flips, with the other inputs held:

- cost_bps at 37.4683: At this cost the hypothetical mean return is zero. Above it, the mean is negative. Weights don't depend on cost.
- target_vol_pct at 28.306954: Below this target, no market reaches the leverage cap on any day. From here up, the cap starts to cut weights, on any day the walk gets to.

If yours differ, stop and tell the person which ones and by how much. Don't go on to real numbers until they match, or until the person has seen the difference. These values come from one engine and can be wrong too.

## Step 2: run it on the person's numbers

Replace every input with the person's own. Ask for any number you don't have, and don't invent one.

## Step 3: report

Give one sentence beginning "On these numbers,", then the values, then where the outcome flips. Always add what this leaves out:

- Financing on leverage, margin, and interest on idle cash.
- Contract rolls, dividends and carry: returns are price changes only.
- Slippage beyond cost_bps, gaps, limit moves, and the time it takes to trade.
- Drift in weights between days: turnover counts target changes only.
- Correlation between markets when sizing. It shows up only in realized vol.
- The choice of markets and windows: this walk knows nothing of how many were tried.
- Fees and taxes.

## Limits

Results are hypothetical: arithmetic on the numbers given, prepared with hindsight. Nobody achieved them, and costs and liquidity are only as assumed. They aren't a forecast, a recommendation, an offer or a record of real trading. Don't say what to buy, sell or hold, and don't use them to market an investment. Whether a person may hold or trade an instrument is a legal question for counsel.

Provided as is, at your own risk, by hedgefund.md, which is not a fund and isn't anyone's adviser. Version 1.0. Source: https://hedgefund.md/models/trend_vol_target/prompt.md. Terms: https://hedgefund.md/terms
