This documentation explains the structure of QTPyLib trading algorithms. It describes optional callbacks for startup, quotes, ticks, bars, order-book updates, and fills, and shows how strategies can use these events to inspect instrument history and…
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
9,797 documents
This forum post presents a VeighNa CTA strategy for futures that combines moving-average crosses, TEMA direction, and MACD, with tick-based dynamic stops. The stop logic progresses from a fixed loss threshold to a stop near breakeven after a profit…
This short VeighNa community post asks how to load previously downloaded historical bars so a strategy can compare them with current data and trigger correctly. Its code example checks that each configured instrument has contract information, creates a…
The document describes a MetaTrader 5 variant of the VTS Float Pivot Smoothed indicator that lets the user select the timeframe used by the indicator through an input parameter. The example default is a four-hour period, while the description says the period…
This forum exchange addresses an identifier error when setting up silver options in VeighNa. A user reports that using “ag” as the option portfolio name causes a KeyError during backtesting or simulated trading, despite having downloaded option data and…
This programming note describes a function for converting timestamps stored by one broker into another broker's server time zone. It is intended for timestamps associated with bars, ticks, or economic calendar events. The function takes a source time,…
This order manager handles exchange order updates arriving through separate REST and WebSocket channels, which may arrive late or out of sequence. It keeps each order’s state and applies an update only when its exchange timestamp is at least as recent as the…
The document explains the bear flag as a possible continuation pattern: a steep price decline forms the pole, followed by a brief consolidation inside a roughly parallel channel. Traders may watch for a break below the channel’s lower boundary as a…
A brief VeighNa community exchange asks how multiple instances of a CTA strategy, each running for a different contract, can share a variable. The reply suggests placing shared parameters under the class definition, and the original poster confirms that this…
The document describes an expert advisor that evaluates reversal signals when a new bar appears, while trailing activity continues on each tick. It uses ATR to set a volatility distance by multiplying the ATR value by a volatility coefficient. For a buy…
The forum exchange addresses how to obtain a futures position's actual opening price through the CTP interface. One user explains that the previous-day position price shown in their data is the settlement price, which complicates calculation of true profit…
The document describes changing a VeighNa CTP market-data interface so that subscription and unsubscription calls accept a list of instrument symbols instead of one symbol per call. It outlines modifications to the C++ wrapper declarations and…
A market-if-touched order waits for a specified trigger price, then submits a market order. Traders may use it to enter after a pullback or to exit a position when a target is reached. The order direction is typically opposite that of a stop trigger: for…
This article presents general guidance for smaller futures traders: define a loss limit before entering, exit when the market invalidates the trade, and follow the plan consistently. It also recommends allowing profitable positions to run while the trend…
This page describes a chart indicator that marks Japanese candlestick formations. It lists bearish patterns such as shooting stars, evening stars, dark cloud patterns, and bearish engulfing formations, alongside bullish hammers, morning stars, piercing…
The document shows a script requesting quarterly futures data at a 15-minute interval and passing the resulting records to a MACD function with the conventional fast, slow, and signal periods. It then reports the lengths of the returned arrays and formats…
This guide explains how TradingView webhook alert messages can direct the open-source OctoBot to place or cancel exchange orders. A basic order alert identifies the exchange, symbol, and buy or sell signal. Optional fields specify order type, volume, price,…
This report summary compares high-frequency factors built from minute data for stocks and futures. It groups them into return-distribution, volume-distribution, combined price-volume, order-flow, and trend-strength measures. Examples include realized…
The post describes a startup problem when testing a Turtle trading strategy on SimNow. Its ArrayManager remains uninitialized because the default capacity is 100 bars, while the example loads only 30 and feeds it one daily bar at a time. Restarting the…
This article introduces cross-commodity futures arbitrage as trading the relative price of two related contracts, typically entering opposing positions when their spread or ratio moves away from an expected range and closing as it reverts. It groups…
This short forum exchange asks how ScriptTrader’s position query reports profit and loss: by daily mark-to-market accounting or by matching individual trades. The reply says the value is accumulated from successive position responses delivered through the…
This short Chinese-language forum exchange concerns a failed manual close order on a Shanghai Futures Exchange instrument. The trader reports CTP rejecting the order because there was insufficient position available to close yesterday’s holdings, despite…
The post raises a question about how a tick-data bar generator assigns observations at minute boundaries. The author reports that a bar labeled for 14:59 appears to include a tick stamped 15:00:00, even after data through 14:59:59.5 has been processed. A…
This proposed four-hour DAX strategy combines an accelerated-volume indicator with entry and trade-management ideas attributed to the Pathfinder system. For a long entry, the fast-minus-slow buy-volume measure must cross above its sell-volume counterpart and…