This document presents a reusable charting-script component for displaying a strategy’s monthly performance in a table. The component reads strategy equity and closing prices, with options to show returns as percentages, net profit, or both. It can include a…
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
299 documents
The script trades a spread between Dalian Commodity Exchange coke and coking coal futures. It estimates the spread from each contract's close, volume multiplier, and a fixed contract ratio, then calculates a z-score from a rolling set of daily observations.…
This strategy smooths log prices with a Nadaraya–Watson kernel regression and surrounds the estimate with volatility bands derived from ATR. The bands use near and far multipliers, while configurable regression and ATR settings control their behavior. The…
This script pairs a long-only RSI entry with an optional filter based on recent trade outcomes. Its unfiltered entry occurs when the 14-period RSI crosses below 35. The filter version instead checks a simple candle condition for entry and permits a trade…
This strategy combines a 20-period simple moving average crossover with an eight-period RSI filter. A close crossing above the average while RSI exceeds the stated upper threshold creates a buy signal; a close crossing below it with RSI below the lower…
This strategy starts with either RSI or MFI as a measure of directional strength, then adjusts the bullish and bearish readings using a Dow-inspired factor: the correlation between price and volume over a configurable lookback. It derives adjusted bull,…
This strategy looks for price deviations from a rolling mean after converting closing prices to logarithms. It uses a rolling mean and standard deviation to form a Z-score, opening long positions when the score falls below a negative threshold and short…
This example applies a z-score to daily closing prices for a gold futures contract. It calculates the mean and standard deviation over a rolling window, then compares the latest close with that mean in standard deviation units. When flat, it buys after a…
This strategy uses the change in closing price over a lookback period as a simple linear regression slope proxy to classify conditions as bullish or bearish. Its published defaults are a 20-bar slope length, a 50-bar simple moving average, and a slope…
This example describes a mean-reversion approach to the price spread between near- and far-month index futures contracts. On 15-minute bars, it calculates the difference between the contracts’ closing prices over an 80-bar window, then estimates the spread’s…
This machine-learning example predicts whether each crypto futures asset’s next closing price will rise or not, then uses those binary predictions as portfolio weights. It builds candidate features from futures data, including a weighted moving-average trend…
This tutorial template uses a Ridge Classifier to predict whether a stock's next closing price will be higher or lower than its current close. Its main example loads Amazon data from the Nasdaq-100 universe, uses log closing prices as features, and reserves…
The document proposes a curve intended to flag price highs, lows, and inflection points. It computes short-window averages and dispersion measures from recent price changes, selects the window with the greatest calculated dispersion, and combines that…
This EUR/USD strategy outline combines linear regressions over short, medium, and long lookback windows. The visible code calculates each regression’s current fitted value, slope, R-squared, correlation, and projected value at a future horizon. Inputs…
This strategy standardizes the closing price against its rolling mean and standard deviation to identify unusually large deviations. With the documented default rolling window of 80 bars and threshold of 2.8, it signals a sell when the Z-score exceeds the…
This statistical-arbitrage demo tracks closing prices for two instruments, takes their logarithms, and uses the difference as a spread signal. When the spread crosses configured positive or negative thresholds, it opens opposing legs: short the first…
This algorithm example combines hourly ETF constituent data with RSI-derived directional views. It loads constituents of SPY and filters for holdings with available weights above a minimum threshold. For each eligible asset, it initializes a short-period…
This Pine Script example pairs a simple RSI trading rule with a table of weekly strategy performance. It calculates a seven-period RSI and opens long positions when RSI crosses above 70, or short positions when it crosses below 30. Trade activity is limited…
This four-hour long-only strategy generates entries and exits from ratios among three simple moving averages. For entry, the ratio of a short “mojo” average to a faster average, and the faster average to a slower average, must each fall within configured…
This strategy bases trading decisions solely on the hour of the candle. It is intended for hourly data: configurable start and end hours define when to enter long and when to exit. It uses no price, volume, or technical indicator conditions. The accompanying…
This strategy fits a rolling linear relationship between closing price and bar index. Over a configurable window, it calculates averages, standard deviations, and correlation to derive a regression slope and intercept, then evaluates whether the resulting…
This partial source describes a TradingView strategy tool for evaluating oscillator signals under several selectable trading-rule templates. The visible options include moving-average behavior and crossovers, zero-line crossings, trading at extreme readings,…
This strategy standardizes closing price against its recent mean and standard deviation, then smooths the resulting Z-score over short and longer windows. A long position is opened when the short smoothing is above the long smoothing and closed when it falls…
This strategy calculates a simple moving average and standard deviation over the same lookback, then places bands three standard deviations above and below the average. It treats a move below the lower band as an oversold condition and enters long when price…