q.Quantitative TradingEnglish course · Lesson 24 of 24Course home

Lesson 24 / Your First Simulation Research Report

Give someone else enough information to reproduce your conclusion.

Complete the project with the same five-day inputs, frozen rule, ledger, and controlled changes. A finished report supports a traceable conclusion and states its limitations. The exercise can end with a loss.

What you will learn

  1. Connect data, rules, the ledger, and verification
  2. Recalculate controlled changes independently
  3. Deliver a report that states what the evidence supports

Allow about 30–45 minutes. The exercises use fictional data. The page checks structured answers in your browser. Export your work before refreshing.

Start with the concepts ↓
Concept 01

Ask a question the evidence can answer

Did three-period average rule v1 execute at the specified times and follow the cash constraints? Can someone reproduce the cash ledger independently? Five fictional days can verify the implementation. Long-term investment performance requires other evidence.

The inputs are the same as in Lesson 17. Start with 10,000 in cash and target 10 units on an active signal. There is no short selling or borrowing. At the next open, trade the target minus actual holdings and cancel the entire buy if cash is insufficient. Use the final close to value the account. An end-of-sample signal without a following open stays unexecuted.

Concept 02

Use the default ledger as a reference

The D3 close signals a purchase of 10. The order fills at the D4 open of 104, leaving 8,959 in cash after the fee of 1. The position closes at the D5 open of 100 and the account ends at 9,958. The benchmark buys 10 on D1 and holds, ending with equity of 9,999.

Change the D5 open to 102 and the strategy should finish at 9,978. Restore default prices and change the fee per trade to 2. The strategy should finish at 9,956. Each controlled change checks whether this price or cost flows through the ledger.

Concept 03

Include six parts in the report

Document the question and version, data dictionary and sources, rules and implementation, daily ledger and benchmark, every attempt and verification, and the conclusion and open items. The export includes current model inputs, the full ledger, run history, and your notes.

The Python example uses the standard library to implement the same replay. Run it locally to check it. The page computes independently in JavaScript. The reference answers and self-checks do not assess your written report. Self-checks record the criteria you selected.

Concept 04

State which evidence is still missing

An acceptable conclusion is that the specified fictional path and fees produce ending equity of 9,958, with timing and cash checked by hand. The result verifies the implementation. Estimating future returns and running forward paper trading require separate work.

To extend the research to real data, obtain reliable inputs, freeze the candidate and test plan, and verify costs and operating conditions. Base any subsequent decision on the remaining evidence gaps. Completing the course does not place trades.

Experiment · Predict the outcome, then change one input

Your First Simulation Research Report experiment

Calculate default ending equity by hand before running the lab. Record any discrepancies afterward. Then change the D5 open and trading fee in separate runs and report expected values, observed values, and your conclusion.

Work with the complete five-day lab using v1 from Lesson 17. Inspect the ledger one day at a time. The page retains each run until refresh and includes it in the assignment export.

Python reference example

Uses the Python 3 standard library. Save as project_example.py and run python3 project_example.py. Run the code separately with the shown defaults or with your own inputs to cross-check results.

"""Version 1 of the five-day practice replay. Python standard library only."""
import json

def replay(exit_price=100, fee=1):
    opens = [100, 101, 102, 104, exit_price]
    closes = [100, 102, 103, 101, 100]
    cash, held, target = 10000, 0, 0
    benchmark_cash = 10000 - 10 * opens[0] - fee
    rows = []
    for i, (opening, close) in enumerate(zip(opens, closes)):
        delta = target - held
        status = "No order needed"
        paid = 0
        if delta > 0 and cash < delta * opening + fee:
            delta = 0
            status = "Insufficient cash. Entire order canceled."
        elif delta:
            cash -= delta * opening + fee
            held += delta
            paid = fee
            status = ("Buy " if delta > 0 else "Sell ") + str(abs(delta))
        avg = None if i < 2 else sum(closes[i-2:i+1]) / 3
        target = 10 if avg is not None and close > avg else 0
        rows.append(dict(day='D'+str(i+1), open=opening, close=close,
                         delta=delta, fee=paid, cash=cash, held=held,
                         equity=cash+held*close, avg=avg, target=target,
                         status=status, benchmark=benchmark_cash+10*close))
    return rows

if __name__ == '__main__':
    result = replay()
    assert result[2]['held'] == 0
    assert result[3]['cash'] == 8959
    assert result[-1]['equity'] == 9958
    assert replay(exit_price=102)[-1]['equity'] == 9978
    assert replay(fee=2)[-1]['equity'] == 9956
    print(json.dumps(result, ensure_ascii=False, indent=2))
    print("All three scenario checks passed for the five-day teaching ledger.")
Practice with fixed inputs

Try the calculations

Use the values in each question. Enter amounts and percentages in the requested units, including a minus sign where needed.

Knowledge check

Explain your reasoning

1. What can the fictional five-day replay establish directly?
2. Is a screenshot of the equity curve enough to reproduce the report?
3. Does checking every self-assessment box mean the text was graded automatically?
4. How should you report the loss in the default five-day example?

Record your work

Stage assignment

Stage 6 deliverable. Complete your simulation research report. Enter your verification, export the report, and give it to another reader to reproduce.

Submit the final research ledger

Use the fixed version 1 rules for the capstone. Start with 10,000 in cash. Opens are 100, 101, 102, 104 and 100. Closes are 100, 102, 103, 101 and 100. Target 10 when the close is strictly above its three-period average, including the current close, and 0 otherwise. There is no signal on the first two days. Trade the difference at the next open, pay 1 per filled order, and value remaining holdings at the final close. The benchmark buys 10 at the D1 open, pays 1, and then holds. Use these inputs regardless of the settings in the experiment above.

Complete the questions below before trying the optional writing exercise. Use the fixed inputs here, even if you changed the experiment above. Enter numbers in the units shown and keep at least two decimal places where needed. Follow the specified precision for tables. You can check one answer at a time or all answers together.

1. Submit the default five-day ledger

Paste comma-separated CSV or tab-separated values copied from a spreadsheet. Include the header and rows D1–D5 in the column order shown below. Omit thousands separators. Leave missing cells blank or enter NA.

day,cash,held,fee,equity
D1,,,,
D2,,,,
D3,,,,
D4,,,,
D5,,,,

Reference answer (try the question first)
2. Ending equity for the buy-and-hold benchmark
yuan
Reference answer (try the question first)
3. Final strategy equity if you change only the D5 open to 102
yuan
Reference answer (try the question first)
4. Final strategy equity with default prices and a fee of 2 per filled order
yuan
Reference answer (try the question first)
5. Which conclusions can the report include? Select all that apply.
Reference answer (try the question first)

Save your homework to export these results. Check again after changing an answer. Optional writing and self-assessment are ungraded. Save your work before refreshing.

Optional writing (ungraded)

Writing guidance and self-review

Record the inputs, rules, results and open questions in each field. You can cite the earlier calculations and experiments as fictional examples. Tie each conclusion to specific data or events.

Use the checklist to review your own writing. Use evidence from the study to evaluate the strategy.

Save the experiment, the run log, your first and current checks, written work and self-review. Export before refreshing or closing the page.