Removes, inverts, or randomizes trend in historic price data. Can be set up for removing bias from the parameters, the trades, the indicators, or the whole price curve. Backtesting with detrended, inverted, or randomizied price curves is also a quick method to verify the robustness of a strategy. For removing trend, the curve or parts of it are "tilted" until the start and end prices have the same value.


The following flags can be set or combined with '+' or '|':
TRADES Detrend trade results. The trade return is corrected by the average price slope of the current WFO cycle. This removes trend bias from a backtest while keeping the properties of the price curve.
PRICES Detrend trade results and price functions. The prices are corrected by the average price slope of the current WFO cycle. For detrending indicators and signals based on series generated with price() calls.
CURVE Detrend the historical price data on loading. The curve is tilted so that it ends at the same level as the start after the lookback period. This also affects the displayed price curve in the chart.
RECIPROCAL Replace prices with their reciprocal values. This it can be used for creating an artifical asset as the reciprocal of an existing forex or crypto pair (f.i. convert BTC/USD to USD/BTC).
INVERT Similar to RECIPROCAL, but keep the price range while inverting the price curve. This reverses all trends in the curve, and can be used for a reality check of a system that is symmetric in long and short positions.
SHUFFLE Randomize the price curve by shuffling the price ticks. Keeps its overall trend and price range, but removes any short-term trends and correlations between the prices. Used for reality checks.
NOPRICE Do not subscribe the asset and do not detect gaps or fix outliers on loading. For data files that contain no prices, but other types of data.





if(is(TRAINMODE)) Detrend = CURVE; // detrend the whole price curve for training

See also:

mode, WFO, DataSlope, randomize


► latest version online