Metastock Formulas - L
Click here to go back to Metastock Formula Index

IMPORTANT: These formulas aren't my complete collection. For my complete collection of instantly usable, profitable and powerful MetaStock formulas Click Here

Would You Like To Use MetaStock To Its Full Potential? Discover the Amazingly Simple Secret to Master Metastock Step-By-Step - click here

A | A 1 | B | B 1 | C | C 1 | D | D 1 | E | F | G | H | I | J | K | L | M | M 1 | N | O | P | R | S | S 1 | T | U | V | W | Z |

Linear Regression Slope
Linking Metastock Updates to Excel Files
Lone Ranger

Linear Regression Trendline
LRS-ROC Indicator--another one
LSS Oscillator & Pivot Point

Last Date Exploration

Linear Regression Slope

{The basic "programming" in MetaStock of the LRS-ROC indicator is like this: NIO is the _basic_ number of points taken to calculate the ROCs. The four  ROCs _per day_ used for interpolation are:}


{Now, interpolation is done at a point XIO (0<=xio<=1), i.e., between the points NIO and NIO+1, using a simple interpolation formula weighting with the _distances_ of the four ROCs from the interpolation point XIO:}


{Then the LinearRegressionSlope is taken _twice_ (for numerical reasons) from the interpolated ROC, using the basic number of points; i.e., NIO. That is where we get our LRS-ROC indicator, named RO here:}


{NIO+XIO together represent the _real_ (not integer!) number of points or days, the LRS-ROC indicator is calculated for, e.g. 4.57 days. Unfortunately, MetaStock is not able to use _one_ real number (e.g., 4.57) as input to be splitted into NIO and XIO and to be used in the formulas above. So NIO and XIO have to be provided separately, because of the restrictions in MetaStock, and both are subjected to some "optimization" in accordance to the historical prices.

To be clear: This LRS-ROC indicator triggers _only the timing_ for entering/closing a position, using an appropriate criterion. Additional (also ROC-based) criterions are used to stay out/in during extreme bearish/bullish situations.

Additionally: This "TA" is only one basic element of my option trading system, primarily to catch some "special reality effects" that cannot be modeled by example-based know-how recycling from historical data. But probably this TA system may also be used as a "stand-alone" system.

(Go Top)

Linking Metastock Updates to Excel Files

As I understand your desire, it's to take data from a MetaStock file and use it to update an Excel file. The way to have this update-process automatically done requires for you to have an OLE-link capable object (chart or indicator) to be present. In MetaStock this can be easy established by creating separate Charts for each security. Follow and execute these steps below. Here I am using a single daily closing price as object, for a simplified use of the Win 95's OLE program.

1. First make a new indicator Close Only :

  • Start MetaStock and click the button for the Indicator Builder
  • In Indicator Builder create a custom indicator named "Close Only" (without the quotations) and in the formula field type CLOSE and click OK

2. To create a Close Only Template :

  • Start the Win95-Explorer and create a new folder named OLE(which folder will hold your Template and Charts used for this OLE) below your working folder(that is holding your metastock files dat/dop/master/emaster etc.)
  • Then switch back to MetaStock
  • Open the by you desired security using Smart Charts as type
  • Delete all other charts and all inner windows and all indicators that are open in the current screen(=layout) except for the base securities' Price indicator
    (the bar, line, sticks)
  • Drag the newly created Close Only indicator down from the IB-Quick List (from the small window in the middle at the top) and release it to have the newly created indicator displayed in its own inner-window
  • Now SAVE AS the current screen (with Template as the file type) using the CloseOnly name(without a space) as the Template's name("CloseOnly.mwt")
  • Close down MetaStock + Win95-Explorer

3. To create the separate Charts used for OLE :

  • Start MetaStock (fresh again) and click New|Chart or click Open
  • Click Apply Template (this action is always required prior to selecting a security) and scroll to the OLE folder to apply the newly created CloseOnly Template
  • On Opening of this New Chart the above mentioned Template's layout containing the Price and the Close Only indicators will be displayed
  • Now SAVE AS the current screen (with Chart as the file type) using the security's name as the Charts' pointer name("SecurityX.mwc") to the newly created OLE-folder
  • Close Metastock

4. To create the OLE link from Metastock to an Excel spreadsheet :

  • Start MetaStock (fresh again) and click Open
  • Open the required security in the newly created OLE-folder
  • Right-click to Select and click Copy to have the security's CloseOnly indicator copied to the Clipboard
  • Start Excel and check that the first cell at the top-left is been selected(=black line bordered rectangle)
  • Select the required cells by placing the mouse-pointer at the right corner of the selected rectangle and click and press down the Left-mouse button and whilst at the same time holding the mouse-button down, drag down this first column(A) and release button until you have reached record row #999 and all of the selected cells will be colered black(Note that this selection made, has to be done in one(1) straight firm move down the column, eg a one single selection has been made)
  • Now let the mouse-pointer float on this blackened selection and Right-click to choose Paste Special
  • In the Paste Special's Dialog Window click the Paste Link radio-button and choose CSV as file-type
  • With plenty of system memory on board it will not take that long before the Special Linked data is calculated and displayed (as the cell's contents), and
    that the Link has been made
  • Close and Save As the Excel file to the OLE folder(with standard XLS as file type) with the security's name as the pointer name
  • Each time now, that you Open this XLS-file again, automatically the Excel program will have you prompted if you would to update the Link. Within the Excel program's options (Tools|Options|Calculations or Edit|Link|Manual) you can pre-set this to "manual" as well, but then you will have to click Edit|Link|Update Now to update once the spreadsheet's above Linked cell selection entirely

Note here that the more history is stored in your 'original' Metastock files, eg the files the Chart uses as its base, the longer the column contents(displayed cells), the longer it will take to calculate and also the more memory is being used, so you will have to keep this 'history' as short as what can be possible for any fast results.

Note here too that you can then apply the special instructions (mailed in a previous mail to the List) to have the Linked cells' contents SPLIT UP over more cells in the spreadsheet(s), so as to enable you to make calculations in Excel, eg using Excel's cell linking(referencing) and formula language(the tiny editor) capabilities and/or apply any of the other Excel program's features.

Note here also that the above applies for MS6.x and Excel8.0(OfficePro97).

To reverse this OLE linkage back into MetaStock , do not forget to create an empty Inner Window first, prior to creating the Link. In MS click Window|New Inner Window and then Right-click in this Inner Window and choose Paste Special|Paste Link (with CSV as file type). See MS-Help or MS-Manual
or Equis' Customer|Support Website for more detailed instructions.

(Go Top)

Lone Ranger

This is the calculation:

There are 2 calculations needed for this.
For the first, just take the highest value of the close in the past 3 days (including todays close) and take this away from the lowest value of the cose in the past 3 days. Call the result of this a.

Then divide a by volume. Subtract the result of this by the value of a divided by volume 5 days ago.

Finally, multiply this number by -1.

Simple Interpretation:
This is a short term indicator which will show short term divergences against the market instrument. You can also use it to compare its rate of change against that of the market.
Extreme lows or highs in the indicator may be a signal of similar instances in the market, however you would want to define a time period to make use of this function.

Metastock code for Lone Ranger:

(( Fml( "Z Range" ) / V) - Ref((Fml( "Z Range" ) / V),-5)) * -1

Where Fml( "Z Range" ) = (HHV(c,3) - LLV(c,3))

(Go Top)

LRS-ROC Indicator--another one

Lb:=Input("Look-Back Periods?",3,100,13);
ROC( LinRegSlope(C,Lb),Lb,$)

(Go Top)

LSS Oscillator & Pivot Point

Here are a few formula's that I picked up from a
mailing from George Angell

LSS 5 day Osc

LLS 5 DAY Osc Diff from 3 day osc

LLS Strength Index(1 day)

LLS Pivot Breakout Buy Number

(Go Top)


Formula: X := Stdev(C, 30);
Y := Ref(X, -1);
Z := 1+((X-Y)/X);
If(Cum(1)=1, 20, Min(Max(Prev*Z, 20), 60))

Name: BuyBreak
Formula: HHV(H, LastValue(Fml("LookBack")+Prev-Prev))

Name: BuyExit
Formula: LLV(L, LastValue(Fml("LookBack")/2+Prev-Prev))

Name: SellBreak
Formula: LLV(L, LastValue(Fml("LookBack")+Prev-Prev))

Name: SellExit
Formula: HHV(H, LastValue(Fml("LookBack")/2+Prev-Prev))

Name: BreakWhere
Formula: TopB := Ref(Fml("BuyBreak"), -1);
LowB := Ref(Fml("SellBreak"), -1);
((O+H+L+C)/4 - LowB)*100/(TopB-LowB);

Name: DBS-System
Enter Long: H > Ref(Fml("BuyBreak"), -1)
Close Long: L < Ref(Fml("BuyExit"), -1)
Enter Short: L < Ref(Fml("SellBreak"), -1)
Close Short: H > Ref(Fml("SellExit"), -1)

This is George Pruitt's ("Futures Truth") basic system. It is also the basic system used as the basis for Thomas Stridsman's year-long series of articles about system development and tweaking.

(Go Top)

Last Date Exploration

This set of column formulae allows you to either scan the results of a previous MetaStock exploration or the whole market to view the last trading date of each code.

To delete all securities that have been non-trading since a user specified date, you will need to use a program such as StockDelete.

MetaStock Column Formula

{Day} Column A: Dayofmonth()
{Month} Column B: Month()
{Year} Column C: Year()

No filter is required for this formula. Text in {} indicates the column name (not required)

Download the Last Date Formula for use in your MetaStock software by clicking here.

(Go Top)

Linear Regression Trendline

{ Linear Regression Trendline Channel v2.0 }{ ©Copyright 2004 Jose Silva }{ [email protected] }

EnDay:=Input("end Day",1,31,31);
EnMnth:=Input("end Month",1,12,12);
EnYear:=Input("end Year",1800,2200,2006);
pds:=Input("Linear Regression Trendline periods",2,2520,63);
multi:=Input("Channel Standard Deviations",
x:=Input("use Open=1 High=2 Low=3 Close=4 Volume=5 P=6",1,6,4);

 OR (Year()=EnYear AND (Month()>EnMnth
  OR Month()=EnMnth AND DayOfMonth()>=EnDay));
end:=end AND Alert(end=0,2);


{ rem next line to extend plot to end of chart }


(Go Top)

If you have Metastock formulas you would like to share,
Please email to MetaStock Formula
We look forward to hearing from you!

To learn more about how to use Metastock and its formula click here.

copyright 2003 MetaStock Website Home
Metastock® is a registered trademark of Equis International.