This example shows a command-driven trading bot that accepts action strings and routes them to spot or futures exchange methods. For futures, it sets the contract type, fetches the ticker, and chooses order direction for opening long or short positions 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
4,613 documents
The document describes a basic grid-trading library through its public controls and a sample expert-advisor workflow. A grid is configured with a direction, initial lot size, spacing between grid levels, and a profit target. Optional settings assign a magic…
The discussion explains how several position fields can represent holdings and sellable quantity in an A-share account subject to T+1 settlement. In the cited stock gateway example, total volume is the full position, frozen volume is the portion unavailable…
This Expert Advisor uses two moving averages to identify directional trades. It opens a long position when the exponential moving average is above the linear weighted moving average and both are rising; it opens a short position when the reverse relationship…
The document describes an Expert Advisor that trades signals from the X2MACandle indicator. Signals are generated when a bar closes and the candle color indicates a trend change. Its position-sizing rule reviews recent trades separately for buys and sells;…
The document raises a portfolio allocation question: when a strategy’s performance weakens and later recovers, allocations based on its current Sharpe ratio may react too slowly. It asks whether changes in Sharpe ratio or the slope of a strategy’s cumulative…
This example describes a mean-reversion strategy for two SHFE futures contracts. It uses a Kalman filter to update the hedge ratio between the instruments, calculates the resulting spread, and standardizes it against a rolling window to create a z-score. The…
This MetaTrader expert advisor trades using two moving averages and lets the user choose between fixed-lot sizing and sizing based on a percentage of free margin. Stop loss, take profit, and trailing stop features can each be enabled or disabled. A…
This document explains an Expert Advisor that builds a channel around a moving average and opens a buy when price reaches the lower boundary or a sell at the upper boundary. A qualifying bar must touch the boundary after the preceding bar remained on the…
This Hummingbot controller guide describes a crypto futures strategy that watches Binance liquidation data and seeks a short-lived rebound after a large forced unwind. It aggregates liquidations over a configurable interval, checks whether their…
This semi-automatic trading assistant lets a user place grids of buy-stop, sell-stop, buy-limit, or sell-limit orders, then close positions by side or all at once. Users set the order count and spacing for each grid type, as well as the initial lot size and…
This educational MQL4 expert advisor uses a moving-average crossover as an example entry signal and demonstrates how orders can be managed across currency pairs. Each order receives a distinct magic number, allowing the program to identify and manage its…
The document describes a script for opening market orders and configuring pending orders. Its user-defined settings include order type, stop-loss and take-profit distances in pips, lot size, slippage, a trade magic number, and the price for a pending order.…
This stock-selection method combines three filters: a 14-period RSI below a ceiling, upward divergence or expansion in the day’s moving averages, and a positive but bounded return over the previous ten days. The article says selected stocks should receive…
The discussion asks whether Supermind provides a function for tracking how many days a stock has been held. A reply suggests maintaining a dictionary keyed by stock, initializing each position's count to zero when a buy occurs, and then using that stored…
The code describes a portfolio-wide risk overlay that scales all positions by a shared multiplier between zero and one. It computes separate multipliers from normal risk, volatility-shock risk, aggregate absolute risk, and leverage, then applies the lowest…
This brief description outlines a trading robot that monitors open positions across symbols and modifies stop losses for positions that are in profit. Its stated function is trailing: the stop can be adjusted as a position moves favorably. Two user…
This indicator studies monthly seasonality using separate in-sample and out-of-sample periods on monthly charts. For each calendar month, it calculates average open-to-close return and the share of observations that rose or fell. It then ranks average…
The EA begins by placing a sell limit just above a recent high and a buy limit just below a recent low, using a configurable lookback. If neither side has opened a position, it can refresh those orders after a set number of bars. Trading-day and…
This Expert Advisor combines three independent systems that use ColorXPWMA_Digit indicators. Each system signals a potential trend change when a bar closes and its indicator changes color. The systems can be enabled or disabled separately, allowing their…
The document describes an MQL5 utility for calculating pip values and position sizes from a target account-currency risk and stop-loss distance. It addresses cross-currency instruments by first using the platform’s symbol tick-value and tick-size properties,…
This Expert Advisor uses the Awesome Oscillator to generate buy and sell signals from changes in histogram color and the relative height of consecutive bars. It opens orders at each bar and closes the group of positions on an opposite signal. The oscillator…
This shared automated strategy trades USD/JPY on a one-minute timeframe. It uses three exponential moving averages with periods derived from 200, 300, and 600 bars to define trend direction, and a parabolic SAR reading relative to the current bar’s high or…
This sample configuration describes portfolio-level risk controls for a Chinese-market trading engine. It enables an intraday trailing-stop monitor that tracks dynamic equity and reduces the target position after a specified drawdown from the intraday high.…