MaxList is a Tradestation EasyLanguage reserved word that returns the highest value among the inputs provided. It accepts up to 25 numeric inputs or numeric expressions. The function evaluates all supplied values and outputs the single maximum value. Example calls show that MaxList selects the largest number in a sequence, such as returning 125 from a list of five numbers or returning 98 from a list of six numbers. Related functions include LowestArray and HighestArray.
PercentRank in TradeStation measures where a specific value sits within a defined data set by returning a percentile from 0 to 100, allowing traders to see how today’s price compares with recent prices. Unlike averages—which assume a roughly normal distribution and can mislead when data is skewed, clustered, or volatile—percentile ranking shows the true position of a value within the actual distribution of prices, making it far more reliable for real-world market data that rarely behaves normally.
The LinearRegValue function in EasyLanguage calculates the value of a linear regression line for a given data series, based on the least squares method. It takes three numeric parameters: Price, which specifies the data to use (e.g., Close, Open, High, Low, Volume, or a custom expression); Length, which determines how many bars to include in the regression calculation; and TgtBar, which specifies the target bar for the regression value, with zero for the current bar, positive integers for past bars, and negative integers for future bars. The function returns a numeric value representing the regression line at the specified TgtBar and can be used with hard-coded inputs or dynamic EasyLanguage expressions for both Price and Length.
The AvgTrueRange function calculates the average level of market volatility by smoothing the True Range—the greatest of three values: today’s high–low distance, today’s high minus yesterday’s close, or today’s low minus yesterday’s close—over a specified number of bars. By providing a positive integer as the Length input, traders can measure how volatility behaves relative to recent history, making ATR a widely used tool for position sizing, stop-loss placement, and assessing shifts in market conditions.
This video explains the BarNumber reserved word in TradeStation EasyLanguage and why it is critical for accurate indicators and strategies. BarNumber does not refer to the first visible bar on the chart but to the first bar available for calculations, which is controlled by MaxBarsBack, and it is not zero-based. Understanding this prevents indexing errors when working with drawing objects, swing highs and lows, and other bar-referenced logic, making BarNumber a foundational concept for reliable EasyLanguage programming in TradeStation.
This video explains the EasyLanguage CountIf function and demonstrates how it can be used for practical intraday market analysis by counting true conditions over a defined number of bars. Using a 5-minute chart, the example evaluates bullish versus bearish bars over the first hour of trading by applying CountIf at 10:30 AM and looking back 12 bars, then storing the bullish-minus-bearish difference and date in vectors for multiple sessions. The script scans those stored values on the last bar to find the strongest bullish imbalance and automatically scrolls the chart to the corresponding date and time, showing how CountIf can be combined with time filters, vectors, looping logic, and chart navigation to build powerful analytical tools for algorithmic trading in EasyLanguage.
This video explains the EasyLanguage FindBar function and shows how it can be used to locate how many bars ago a specific date and time occurred on a chart. As part of the “50 Functions in Under Five Minutes” series, the example walks through FindBar’s two inputs—target date and target time—and highlights the importance of setting MaxBarsBack far enough to include the desired historical reference. Using a 60-minute chart, the script finds a specific 10:00 AM bar, verifies the result with a print statement, and then extends the concept by tying FindBar to a text label placed on the chart. By retrieving the label’s date and time and passing it into FindBar, the code confirms the same bar offset, demonstrating a practical technique for determining how many bars ago chart annotations or events occurred, which is especially useful for advanced analysis and automation in EasyLanguage
The Cum function in EasyLanguage is a series-based accumulation function that calculates a running total of a specified numeric value starting from the first bar on the chart (BarNumber = 1) through the current bar. It accepts a single parameter, Price, which can be any bar-based value such as Close, High, Low, Open, or Volume, as well as mathematical expressions or numeric functions like RSI, Stochastic, or ADX. The function returns a double representing the cumulative sum including the current bar, making it useful for tracking totals, averages, or growth over time. Common use cases include cumulative volume calculations and derived metrics such as average accumulated values by dividing the cumulative total by BarNumber.
The InfoBox function, provided by TradeStation Technologies for the EasyLanguage programming environment, allows developers to display a custom informational message within a chart or workspace using a defined caption. The function supports precise control over on-screen placement by allowing the message box’s X and Y coordinates to be set directly within the function call. This makes InfoBox a practical tool for communicating real-time program status, variable values, or execution context to the user without relying on plots or print statements, helping improve usability, debugging, and clarity in trading indicators and strategies.
Disparity is an EasyLanguage function on the TradeStation platform that measures how far a current value is above or below its average, expressed as a percentage. It takes two inputs—the data series (such as price or volume) and a lookback length—and returns a floating-point value where 100 percent represents the average itself. Readings above 100 percent indicate the value is above its average, while readings below 100 percent show it is below. Plotting a reference line at 100 percent makes interpretation intuitive, allowing traders to quickly see relative extremes and contextualize current conditions versus recent norms.
The ProbAbove function calculates the probability that a symbol’s price will rise to or remain above a specified target level at a defined point in the future, based on the current price, the symbol’s annualized volatility, and the number of bars remaining until evaluation. Designed primarily for use with Probability Maps, the function accepts a future price target, the current market price, a volatility input, and a forward-looking bar count, then returns a numeric probability value. This allows traders and system developers to quantify the likelihood of price behavior over time, supporting probabilistic analysis and forward-looking decision-making within algorithmic trading strategies.
Bollinger Bands are a widely used technical analysis indicator that measure market volatility and help traders identify potential overbought or oversold conditions. The indicator consists of a moving average with an upper and lower band plotted at a specified number of standard deviations, expanding during high volatility and contracting during low volatility. Traders commonly use Bollinger Bands to spot price extremes, volatility breakouts, trend continuation, and possible mean reversion opportunities, making them especially useful for intraday trading, swing trading, and short-term market analysis across stocks, futures, and cryptocurrencies.
When you’re building algorithms in TradeStation—or any trading platform—session naming is critical.
You want to keep track of both the session name and the session number.
Why does this matter?
When you’re reviewing trades later, you need to know exactly which session you were on, whether you traded the correct session, and whether your chart was actually calculating bars based on the intended time boundaries.
If your session is wrong, your data is wrong—simple as that.
The NthHighest function is an EasyLanguage utility that returns the Nth highest occurrence of a specified price, value, or formula over a defined lookback period. By setting the N parameter, traders can identify not just the highest value, but the second highest, third highest, and so on, within the most recent Length bars. This makes the function especially useful for analyzing prior resistance levels, ranking historical extremes, or building logic that reacts to repeated highs rather than a single peak. The function evaluates only trailing bars, requires the lookback length to be 100 bars or fewer, and enforces that the selected N value cannot exceed the length being analyzed, ensuring controlled and predictable calculations.
The Correlation function computes the statistical correlation coefficient between an independent and a dependent data series over a specified number of bars, returning a numeric value between -1 and 1 for the current bar. This value quantifies the strength and direction of the linear relationship between the two inputs, where values near 1 indicate a strong positive relationship, values near -1 indicate a strong negative relationship, and values near 0 indicate little to no linear relationship. The function is flexible in that both inputs can be price data, mathematical expressions, or other numeric functions, allowing traders and developers to evaluate how closely two instruments or variables move together over time. The Length parameter defines the lookback window used in the calculation and must be a positive whole number, making the function suitable for analyzing short-term or long-term relationships depending on the selected period.
The CloseDay function in EasyLanguage returns the daily closing price for a specified number of days in the past, making it a simple and reliable way to reference daily data inside indicators or strategies. By passing an argument such as 0 for today or 1 for yesterday, the function retrieves the corresponding daily close based on the chart’s session settings, including after-hours if enabled. When used with a condition like LastBarOnChart, the value can be printed once and verified directly against the Data Window on the chart. This same structure applies consistently to OpenDay, HighDay, and LowDay, allowing developers to easily access and combine daily open, high, low, and close values for analysis, validation, or trading logic.
The C_Marubozu function is a technical analysis utility designed to identify Marubozu Japanese candlestick patterns based on candle body size and shadow tolerance. It evaluates each bar and returns an integer value indicating whether a Marubozu pattern is present and, if so, the specific type detected, including black or white Marubozu as well as opening and closing variations. The function uses two parameters: BodyAvgLength, which defines the lookback period for calculating the average candle body size, and ShadowPercent, which sets the maximum allowable upper and lower shadow size as a percentage of the candle body. A return value of zero indicates no Marubozu pattern, while values one through six correspond to increasingly specific bullish or bearish Marubozu classifications, enabling precise pattern recognition for systematic trading and market analysis.