Strategy testing and trading software · Germanycontact@stratcorealpha.com · DE
Engineering notes

Saved commodity-positioning test · Before automation

67.89% down: test your trading rules before automating them

Your automated trading strategy needs a test before its rules become code. Our saved weekly commodity-positioning test fell 67.89% from a previous peak. At a chosen $10,000 peak, that is $6,789 down, beside an example $1,000 total loss limit. Before building a bot for a challenge, keep the reference value, reset time and open trades beside the rule you want it to follow.

Saved commodity-positioning account path, 2014-2023, normalized start 1.00, showing 67.89 percent fall from a previous peak
Saved daily commodity-positioning test, 2014-2023. Normalized account value starts at 1.00. The rule was rejected.

The belief: one percentage settles the question

If a report says maximum drawdown, you might compare that percentage directly with your challenge allowance. Both describe a loss, so they look interchangeable. But a loss from a previous high and a loss from the initial account value answer different questions. A daily rule adds another reference point and a reset time.

A request to automate an existing trading strategy raises a useful first question: what has the rule already survived? Before choosing the code, write down what each account condition measures. A consistency rule can restrict the share of profit earned on one day. A total loss rule protects an account floor. A daily loss rule applies within its own named day. One winning or losing percentage cannot settle all three.

What the saved test did

The rule used a weekly US positioning report for gold, silver and two oil markets. It compared the reported positions of money managers with those of producers. Each week it bought the two highest-ranked markets and sold the two lowest-ranked markets, with equal weights. Trading began after the report was available. The saved run included the costs of closing and reopening all four positions.

The test covered 2014 through 2023. The first part covered 2014-2018 and the second covered 2019-2023. The combined report recorded a 67.89% maximum fall from a previous account high. The rule was rejected before a live bot was built for it. More code would have made the losing rule run automatically; it would not have repaired the saved result.

The chart shows the daily account values saved by that historical run. It helps locate a losing stretch. Its units and dates stay attached to the chart so you can see exactly what was measured. Daily values leave the account's path between those values unanswered.

What to settle before the bot is built

First, name the reference value. Does the total loss rule start from the original balance, a previous high, or another value stated by the firm? Put that value in money beside the allowed loss. The $6,789 example above assumes a $10,000 previous peak. The example $1,000 allowance assumes a 10% limit on a $10,000 starting account. They are separate assumptions, even though the dollar bases happen to match.

Second, name what is checked. Closed balance leaves out the current result of open trades. Account value including those trades can fall while the closed balance stays still. Keep fees and overnight charges in the value specified by the rule. Our balance and open-equity case shows why those two lines can disagree.

Third, write the reset time beside the daily rule. A new date on the chart does not establish that the firm's day has changed. The saved reset-clock case shows how changing only the chosen clock moved the permitted floor at the same instant.

Fourth, check the recorded times. If the rule checks losses during open trades, a daily closing chart leaves a gap. Ask for the values throughout the losing stretch. Mark any missing interval as unknown rather than treating it as a safe interval.

Finally, keep other conditions separate. Profit targets, minimum trading days and holding restrictions need their own checks against the firm's current written rules. A favourable return figure does not answer those questions for you.

Your next step

Put your exact account rules into the free Challenge Pre-Check. Keep one losing stretch from your own report beside them. The useful first result is a list of the values and times you need to compare.

This was a rejected historical simulation with daily sampling; the dollar comparison uses chosen reference values and does not replay a funded challenge account.

Sources and related guides

Start with your own rules

Keep your exact rules beside one losing stretch and identify the missing values and times.

Free Challenge Pre-Check →

Trading risk disclosure

Futures and forex trading contains substantial risk and is not for every investor. An investor could potentially lose all or more than the initial investment. Risk capital is money that can be lost without jeopardizing one's financial security or lifestyle. Only risk capital should be used for trading, and only those with sufficient risk capital should consider trading. Past performance is not necessarily indicative of future results.

Hypothetical performance disclosure

Hypothetical performance results have many inherent limitations. No representation is being made that any account will or is likely to achieve profits or losses similar to those shown. There are frequently sharp differences between hypothetical performance results and the actual results subsequently achieved by any particular trading program. Hypothetical results are generally prepared with the benefit of hindsight, do not involve financial risk, and cannot completely account for the impact of financial risk in actual trading. Market conditions, the ability to withstand losses, and adherence to a trading program can all materially affect actual results.

NinjaTrader trademark disclosure

NinjaTrader® is a registered trademark of NinjaTrader Group, LLC. No NinjaTrader company has any affiliation with the owner, developer, or provider of the products or services described herein, or any interest, ownership or otherwise, in any such product or service, or endorses, recommends or approves any such product or service.

Testimonials, when shown, may not represent the experience of other clients and are not a guarantee of future performance or success. Virtual-currency trading carries additional risks. See the CFTC customer advisories. Read the full financial risk disclaimer.