Metastock Formulas New -
Functions: These are pre-built commands like Mov() for moving averages or RSI() for Relative Strength Index.
Data Arrays: These represent price data points such as O (Open), H (High), L (Low), C (Close), and V (Volume). Operators: Standard mathematical symbols ( , −negative , , ), logical operators (AND, OR), and comparison operators ( >is greater than ,
Variables: Defined using the := assignment operator to store values for cleaner code (e.g., AvgPrice := (H+L+C)/3;). Recent Trending Formula Examples
Newer formulas often focus on volatility and trend filtering to handle modern market noise. Trend-Follower Filter
Logic: Uses a smoothed price action to identify long-term trends. Formula: Mov(C,20,S) > Mov(C,50,S) AND RSI(14) > 50 Volatility-Adjusted Breakout
Logic: Detects when price breaks out of a narrow range defined by Average True Range (ATR). Formula: C > Ref(H,-1) + (1.5 * ATR(10)) Mean Reversion Trigger Logic: Identifies "oversold" conditions within an uptrend. Formula: C < Mov(C,200,E) AND RSI(2) < 10 Advanced Functionality metastock formulas new
Custom Indicators: You can build your own visual tools via the Indicator Builder.
System Testing: Use formulas to backtest "Buy" and "Sell" rules (e.g., Cross(Mov(C,10,E), Mov(C,30,E))).
The Explorer: Write formulas to scan thousands of securities for specific technical setups.
External DLL Support: Advanced users can call C++ or C# functions through DLLs for complex calculations beyond the native language limits. Best Practices for New Formulas
Modular Coding: Break complex logic into smaller variables to make debugging easier. Functions : These are pre-built commands like Mov()
Comment Your Code: Use curly brackets comment to explain the logic for future reference.
Use Ref() Carefully: Always remember that Ref(C,-1) looks at yesterday’s close, while Ref(C,1) looks "forward," which will lead to unrealistic backtesting results (peeking). Resources for Formula Libraries
MetaStock Customer Formula Collection: The official repository for user-submitted and expert formulas. The Equis Formula Language Manual : The definitive technical guide for all syntax rules.
User Forums: Communities like MetaStock's own forum or external trading boards often share "new" formulas based on recently published trading books.
3. The Cum( ) Function for Regime Filtering
Stop looking for trends in a sideways market. Use cumulative logic to define regimes:
Sideways := (HHV(H,20) - LLV(L,20)) / LLV(L,20) < 0.05; This is not technical analysis
The Philosophical Leap: Non-Price Data
The most underutilized frontier in MetaStock is the incorporation of non-correlated data. A genuinely "interesting" new formula looks at the relationship between assets, not just the asset itself.
The Intermarket Divergence Formula: Buy when the S&P 500 is making a higher high, but the Volatility Index (VIX) is also making a higher high. (Fear confirming price is unsustainable).
// Divergence Detector (SPX vs VIX)
SPX_High := Security("SPX", H);
VIX_High := Security("VIX", H);
Signal := SPX_High > Ref(SPX_High, -5) AND VIX_High > Ref(VIX_High, -5);
Signal
This is not technical analysis; it is behavioral finance coded into a line of logic. Most traders ignore this because it requires two data feeds. That is exactly why it works.
3. Asynchronous Timeframe Normalization (The “Pseudo-Tick” Trick)
MetaStock cannot easily mix 1-min and daily bars in one system. But you can normalize using LastValue() + ValueWhen():
Get yesterday's daily close on an intraday chart
DailyClose := Security("", C, -1); -1 = previous daily bar
DayStartPrice := ValueWhen(1, DayOfWeek() <> Ref(DayOfWeek(),-1), DailyClose);
Intraday_Pct_Change := (C / DayStartPrice - 1) * 100;
Intraday_Pct_Change
Now overlay that on a 5-min chart to see if the current intraday move extends beyond yesterday's range.








