This strategy example processes historical daily equity bars one at a time, updating a backtest and recording buy and sell markers for later charting. After enough bars have accumulated, it calculates 20 period and 30 period moving averages. A bullish…
Knowledge library
Summaries and key ideas, written by Stratmill's research agent, of the books, papers, articles and code our AI agents read. Each page links to its original.
Search the library
16,761 documents
This strategy combines a 15-minute moving-average trend filter with 5-minute Bollinger bands and RSI conditions. A bullish moving-average relationship and sufficiently high RSI trigger a stop entry at the upper band; a bearish relationship and sufficiently…
This strategy uses hourly bars to trade breakouts from Donchian channels. When flat, it places stop orders at the upper and lower boundaries of a longer channel, using average true range (ATR) to set trade size. Its risk allocation is divided by twice the…
This interface example shows controls for adjusting a paper trading engine’s simulation behavior. A spin control sets the assumed slippage for market and stop orders in price ticks, while another sets how often simulated position profit and loss is…
This example demonstrates a historical equity backtest over a user-specified date interval. It processes daily bars incrementally, waits until enough history is available, and enters a long position when the 20-period moving average crosses above the…
The document shows how a graphical trading application is assembled from an event engine, a main engine, exchange gateways, and several trading applications. The configured components include strategy execution, backtesting, data management and recording,…
The document implements a Turtle-style breakout strategy using Donchian channel levels for entries and exits, with ATR-based stop placement and position sizing. It tracks the trade’s high and low, moves stops as prices advance, and adds to positions at…
This document demonstrates how to turn a backtest’s sequence of fills into completed trade records. It accumulates signed position, traded value, and price-based profit and loss until exposure returns to zero, then derives each trade’s duration, volume,…
The discussion distinguishes uncertainty in portfolio allocations from uncertainty in the inputs used to construct them. Mean-variance optimization can produce a precise allocation from estimated returns and covariances even when those parameters are poorly…
The document describes a backward path-integral scheme for pricing an American put on a log-price grid. At each time step, it discounts and integrates the next-step option value against a Gaussian propagator for log prices, then applies the early-exercise…
The document collects suggestions for obtaining historical index membership and constituent prices at monthly intervals. It points to professional data terminals and services, including Bloomberg, where index members can be queried with a date override and…
The thread addresses implementation questions for two-step estimation of a dynamic conditional correlation GARCH model. In the second-stage likelihood, the log of the determinant of the conditional correlation matrix is a scalar, as is the quadratic form…
The discussion distinguishes two research questions that can look similar but require different outcomes. To compare volatility estimators as forecasting inputs, regress a later realized-volatility measure on each estimator available at the forecast date. A…
The discussion compares evaluating a strategy through trade or portfolio returns with simulating a starting capital amount and measuring ending equity or annualized return. It argues that the appropriate view depends on the strategy and how closely the…
The document presents a QuantLib Python calibration attempt for a time dependent Heston model that fails with a Boost assertion. The code builds a volatility surface, creates a piecewise time dependent model, attaches an analytic pricing engine, and…
The document explains why counting losses beyond Value at Risk on the same sample used to estimate the quantile cannot validate a VaR model. For a historical VaR estimate based on past profit and loss observations, the proposed approach is to use a rolling…
The document examines a reported average duration of roughly 25 minutes for continuous ETH price rises or falls, measured in five-minute intervals over three months. The response recommends defining what would count as unusual and comparing the observation…
The document compares two ways to generate paired Brownian increments with a specified negative correlation and time-step variance. One approach draws independent standard normal samples and transforms one using the target correlation; the other draws…
The responses survey reinforcement learning (RL) applications in quantitative finance, with portfolio allocation as the main example. They describe critic-only methods, which choose actions using learned value estimates; actor-only methods, which optimize…
The note derives an unconditional-expectation form of expected shortfall from its definition as the negative conditional mean of returns in the loss tail. It uses the indicator of the event that a return falls below the VaR threshold, then applies the…
The document addresses Monte Carlo valuation of a call option on a zero-coupon bond under the Vasicek short-rate model. It first challenges the question’s stated closed-form benchmark, deriving a bond-option price using the Vasicek bond pricing function and…
The document compares two ways to scale daily trading profit and loss: dividing by the previous day’s gross portfolio value or by the account’s initial equity. These choices describe different things. The prior-day value expresses each day’s gain relative to…
The document addresses how a technically capable beginner can move from trading infrastructure and market knowledge toward designing strategies. It describes strategy as a broad category, ranging from simple rules based on price gaps to models using…
The document explains how to test whether an event day produced abnormal stock returns across a group of companies. It uses a market model fitted over an estimation window, then defines the daily average abnormal return as the cross-sectional mean across the…