{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:}
rll:=ROC(O,nio-1,%)/(nio-1);
rl:=ROC(O,nio,%)/nio;
rh:=ROC(O,nio+1,%)/(nio+1);
rhh:=ROC(O,nio+2,%)/(nio+2);
{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:}
rit:=(rll/(1+xio)+rl/(xio+.0001)+rh/(1-xio)+rhh/(2-xio))/(1/(1+xio)+1/(xio+.
0001)+1/(1-xio)+1/(2-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:}
ro:=LinRegSlope(LinRegSlope(rit,nio),nio);
{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) |
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
A.
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.
B.
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.
C.
Note here also that the above applies for MS6.x and
Excel8.0(OfficePro97).
D.
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) |
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) |
Lb:=Input("Look-Back Periods?",3,100,13);
ROC( LinRegSlope(C,Lb),Lb,$)
(Go
Top) |
Here are a few formula's that I picked up from a
mailing from George Angell
LSS 5 day Osc
X:=HHV(H,5)-Ref(O,-5);
Y:=C-LLV(L,5);
LSS:=100*(X+Y)/(HHV(H,5)-LLV(L,5))*2;
LSS;
LLS 5 DAY Osc Diff from 3 day osc
X:=HHV(H,5)-Ref(O,-5);
Y:=C-LLV(L,5);
LSS:=100*(X+Y)/(HHV(H,5)-LLV(L,5))*2;
Diff:=LSS-Ref(LSS,-3);
Diff;
LLS Strength Index(1 day)
100*(Ref(C,-1)-Ref(L,-1))/(Ref(H,-1)-Ref(L,-1))
LLS Pivot Breakout Buy Number
X:=(H+L+C)/3;
BBN:=2*X-L;
BSN:=2*X-H;
BBN;
BSN;
(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) |
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 Channel v2.0 }{ ©Copyright 2004
Jose Silva }{ josesilva22@yahoo.com }
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",
0,100,2);
x:=Input("use Open=1 High=2 Low=3 Close=4 Volume=5 P=6",1,6,4);
x:=If(x=1,O,If(x=2,H,If(x=3,L,If(x=5,V,If(x=6,P,C)))));
end:=Year()>EnYear
OR (Year()=EnYear AND (Month()>EnMnth
OR Month()=EnMnth AND DayOfMonth()>=EnDay));
end:=end AND Alert(end=0,2);
end:=If(LastValue(Cum(Ref(end,pds)))=0,
LastValue(Cum(1))=Cum(1),end);
lastValLRI:=LastValue(Highest(
If(end,LinearReg(x,pds),0)));
lastValLRS:=LastValue(Highest(
If(end,LinRegSlope(x,pds),-10000)));
adjust:=LastValue(LastValue(Cum(1))
-Highest(If(end,Cum(1),0)));
countback:=LastValue(Cum(1))-Cum(1)-adjust;
{ rem next line to extend plot to end of chart }
countback:=Ref(Ref(countback,-adjust),adjust);
LR:=lastValLRI-lastValLRS*countback;
restrict:=adjust-(LastValue(Cum(1))-pds);
LRT:=Ref(Ref(LR,-restrict),restrict);
upLR:=LRT+Stdev(LR,pds)*multi;
lwLR:=LRT-Stdev(LR,pds)*multi;
upLR;lwLR;LRT
(Go
Top) |
|