[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Money management (was Re: Off-topic C++)



PureBytes Links

Trading Reference Links

<x-html><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=iso-8859-1" http-equiv=Content-Type>
<META content="MSHTML 5.00.2614.3500" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN 
class=790005618-25081999>Glen</SPAN></FONT></DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN 
class=790005618-25081999></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN class=790005618-25081999>I 
probably wasn't too clear on our money management approach.&nbsp; Our futures 
trading accounts represent about 10 to 15% of available capital.&nbsp; In the 
futures account, for an initial trade, we never&nbsp;invest more&nbsp;than 25% 
of the capital in that account (according to the charts and our profitability 
ratio, this keeps our risk of going broke to under 1%).&nbsp; If the trade goes 
against us, we will add to the position, usually at&nbsp;20 points&nbsp;and then 
at&nbsp;40 points.&nbsp; We never, ever, overinvest anymore!</SPAN></FONT></DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN 
class=790005618-25081999></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN class=790005618-25081999>On my 
brother's trade, the total value&nbsp;in the futures trading account represents 
less than 10% of available&nbsp;capital.&nbsp; The margin call was for only 
$4,600 and was caused by the rather dramatic drop in the S&amp;P (over 70 points 
against us, which is highly unusual with our system but the market is acting 
squirrelly lately).&nbsp; In actual fact, he should have met the margin call but 
was too lazy to go to the bank and wire the funds.&nbsp; That bit of laziness 
cost him approximately $37,000 on this trade so far (as of yesterday's 
close).&nbsp; Regardless of that opportunity loss, he's still ahead on the 
trade, just would have been a lot more ahead.&nbsp; In the account I trade, I 
decided not to overextend and buy more S&amp;P contracts at 1300.&nbsp; That was 
just a financial decision on my part.&nbsp; My brother is a little more 
aggressive (he's 6 years younger).&nbsp; Bottom line, we ended making about the 
same amount of money on the trade so far and I didn't have the stress. 
&lt;G&gt;</SPAN></FONT></DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN 
class=790005618-25081999></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN class=790005618-25081999>Each 
one of our trades stands alone and has no relationship with the trade(s) before 
it.&nbsp; Our probability of success on the current trade doesn't change based 
on prior trades; and win or lose, we don't change our percentage of initial 
investment.</SPAN></FONT></DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN 
class=790005618-25081999></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN class=790005618-25081999>What 
we've discovered in the past year, is that our system is actually a lot better 
than the approximately 75% profitable&nbsp;trades we've made in&nbsp;the past 15 
years, if we do the averaging I mentioned above.&nbsp; We used to use visual 
stops, basis close, and I can't tell you how many times we lost money on a trade 
when, in fact, we were right.&nbsp; Now, we average down (or up as the case may 
be) and have turned a lot of those losers&nbsp;into winners.&nbsp; Our last 3 
trades, for example, under our old money management system (for what it was 
worth) would&nbsp;all have&nbsp;lost money.&nbsp; With the new technique, they 
were (the last two) or are (the current one) profitable.&nbsp; 
</SPAN></FONT></DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN 
class=790005618-25081999></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN class=790005618-25081999>This 
does require starting each trade with a smaller position, but it also means that 
you always have to ability to stick out a severe drawdown (like the current 
one).&nbsp; It gets a little hairy swinging without a net, but except for one 
major loss in the past two years, it appears that this is the way to trade our 
system.&nbsp; Even with that major loss, we still wouldn't have wiped out the 
trading account necessitating a new beginning (like we've done too many times in 
the past).</SPAN></FONT></DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN 
class=790005618-25081999></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN 
class=790005618-25081999>Regards</SPAN></FONT></DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN 
class=790005618-25081999></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN 
class=790005618-25081999>Guy</SPAN></FONT></DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN 
class=790005618-25081999></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN 
class=790005618-25081999></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN 
class=790005618-25081999></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN 
class=790005618-25081999></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN 
class=790005618-25081999></SPAN></FONT>&nbsp;</DIV>
<DIV class=OutlookMessageHeader><FONT face="Times New Roman" 
size=2>-----Original Message-----<BR><B>From:</B> owner-metastock@xxxxxxxxxxxxx 
[mailto:owner-metastock@xxxxxxxxxxxxx]<B>On Behalf Of</B> Glen 
Wallace<BR><B>Sent:</B> Wednesday, August 25, 1999 9:54 AM<BR><B>To:</B> 
MetaStock listserver<BR><B>Subject:</B> Money management (was Re: Off-topic 
C++)<BR><BR></FONT></DIV>
<DIV>Guy:</DIV>
<DIV>&nbsp;</DIV>
<DIV>Couldn't help but stick my nose into a semi-private discussion; 
sorry.&nbsp; Your money management&nbsp;system is&nbsp;like the martingale 
style&nbsp;systems often used in negative expectation games like roulette.&nbsp; 
The general theory is, every time a person suffers a loss, they double up (or 
some smaller ratio) on the next trade because eventually there <EM>will </EM>be 
a win and they come out ahead.</DIV>
<DIV>&nbsp;</DIV>
<DIV>The problem with martingales is precisely what your brother 
experienced.&nbsp;&nbsp;A loss&nbsp;or series of losses is a mathematical 
certainty, and the amount&nbsp;risked will eventually reach the ceiling -- be it 
the "house limit", the extent of the investor's capital, or the investor's 
psychological&nbsp;threshold.&nbsp; As soon as the investor reaches this 
ceiling, the system collapses and they suffer a catastrophic loss.&nbsp; With a 
martingale, the investor will <EM>always </EM>eventually go bust --&nbsp;even 
with a positive mathematical expectation trading system.</DIV>
<DIV>&nbsp;</DIV>
<DIV>For a positive expectation system like your trading system (90% expectancy 
of a win), a small antimartingale system might be more appropriate.&nbsp; That 
is, risk more after a win and&nbsp;less after a loss.&nbsp; As long as you risk 
less than 100% (with some trading systems, much less) of your capital on each 
trade, you will recover from a large loss or series of losses.</DIV>
<DIV>&nbsp;</DIV>
<DIV>Regards.</DIV>
<DIV>&nbsp;</DIV>
<BLOCKQUOTE 
style="BORDER-LEFT: #000000 2px solid; MARGIN-LEFT: 5px; MARGIN-RIGHT: 0px; PADDING-LEFT: 5px; PADDING-RIGHT: 0px">
  <DIV><FONT color=#0000ff face=Arial size=2><SPAN class=440451500-25081999>Now 
  we start with an opening position of just 25% of our capital and if the trade 
  goes against us, add to our position to average out our costs.&nbsp; This has 
  worked quite well lately and we have eliminated using stops.&nbsp; 
  Occasionally, we make a mistake, like my brother just made, where we have too 
  many contracts because we over bought on the way down and had to take a loss 
  on some of them (or make a margin call which we try never to 
  do</SPAN></FONT></DIV></BLOCKQUOTE></BODY></HTML>
</x-html>From ???@??? Wed Aug 25 13:54:02 1999
Return-Path: <majordom@xxxxxxxxxxxxxxxxxx>
Received: from listserv.equis.com (listserv.equis.com [204.246.137.2])
	by purebytes.com (8.8.7/8.8.7) with ESMTP id NAA03766
	for <neal@xxxxxxxxxxxxx>; Wed, 25 Aug 1999 13:55:54 -0700
Received: (from majordom@xxxxxxxxx)
	by listserv.equis.com (8.8.7/8.8.7) id EAA11827
	for metastock-outgoing; Thu, 26 Aug 1999 04:22:20 -0600
X-Authentication-Warning: listserv.equis.com: majordom set sender to owner-metastock@xxxxxxxxxxxxx using -f
Received: from freeze.metastock.com (freeze.metastock.com [204.246.137.5])
	by listserv.equis.com (8.8.7/8.8.7) with ESMTP id EAA11824
	for <metastock@xxxxxxxxxxxxxxxxxx>; Thu, 26 Aug 1999 04:22:17 -0600
Received: from mail.ixpres.com (mail.ixpres.com [207.137.28.4])
	by freeze.metastock.com (8.8.5/8.8.5) with ESMTP id OAA04113
	for <metastock@xxxxxxxxxxxxx>; Wed, 25 Aug 1999 14:12:48 -0600 (MDT)
Received: from IXPRES.COM (01-036.015.popsite.net [192.216.6.36])
	by mail.ixpres.com (8.9.2/8.9.1) with ESMTP id NAA47942
	for <metastock@xxxxxxxxxxxxx>; Wed, 25 Aug 1999 13:03:20 -0700 (PDT)
Message-ID: <37C44AF5.3011581F@xxxxxxxxxx>
Date: Wed, 25 Aug 1999 12:58:45 -0700
From: Daniel Martinez <DanM@xxxxxxxxxx>
X-Mailer: Mozilla 4.61 [en] (Win98; U)
X-Accept-Language: en
MIME-Version: 1.0
To: metastock@xxxxxxxxxxxxx
Subject: Re: TAS
References: <004901beeddd$4abb5960$256d75ce@xxxxxxxxxxxx> <37C30D07.ED582E78@xxxxxxxxxx> <014401beee92$9be71080$9b28cfa9@xxxxxxx>
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
Sender: owner-metastock@xxxxxxxxxxxxx
Precedence: bulk
Reply-To: metastock@xxxxxxxxxxxxx
Status:   

<x-html><!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<body bgcolor="#FFFFFF">
Craig,
<br>yes, they are still there and they sell their (still) DOS-based product
for $249.00 US.&nbsp; I assume when you say "across multiple stocks", you
mean its language allows you to load many different ticker arrays and use
their data with one another (e.g., relative strength).
<p>Daniel.
<br>&nbsp;
<br>&nbsp;
<p>Craig Monroe wrote:
<blockquote TYPE=CITE><font color="#0000FF"><font size=-1>Tas was (is?)
a dos-based program that would run rings around MetaStock in System testing
(it actually tested across multiple stocks) and explorations at the time.
Martin Moore of Dublin, CA was the software writer and owner. Used to have
a website www.flexsoft.com. Don't
know if it's still there. Warning - it did take some learning to get to
know to use the language. These days a better choice is likely TechniFilter
Plus.</font></font>
<blockquote 
style="BORDER-LEFT: #0000ff 2px solid; MARGIN-LEFT: 5px; MARGIN-RIGHT: 0px; PADDING-LEFT: 5px; PADDING-RIGHT: 0px">
<div style="FONT: 10pt arial">----- Original Message -----</div>

<div 
  style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><b>From:</b>
Daniel Martinez</div>

<div style="FONT: 10pt arial"><b>To:</b> metastock@xxxxxxxxxxxxx</div>

<div style="FONT: 10pt arial"><b>Sent:</b> Tuesday, August 24, 1999 4:22
PM</div>

<div style="FONT: 10pt arial"><b>Subject:</b> Re: Off-topic C++</div>
&nbsp;Guy,
<br>not sure what you are referencing when you mention +/- 10 or 8 indicator.&nbsp;
Do you mean 10 or 8 digits of accuracy?&nbsp; Looked in MicroSoft's BookShelf
99 for "TAS" and searched the Net but couldn't find any reference.
<p>It sound like you have been programming stock database routines for
some time.&nbsp; If you don't mind my asking, have you made profits using
this type of programming?&nbsp; It seems like it would take a long time
to set up.
<p>Just for your info, that EBAY page you gave is also for the Academic
version.&nbsp; As for me, I'm not sure I want to go beyond the MetaStock/Excel
combo.&nbsp; Maybe later I'll get VC++ or Builder, after I become an expert
at TA.&nbsp; More likely I'll build a tradestation (no pun intended) here
with 4 monitors, perhaps L2, and trade short-term moves.&nbsp; Have already
decided on the hardware to use.
<p>Daniel.</blockquote>
</blockquote>

</body>
</html>
</x-html>From ???@??? Wed Aug 25 14:11:47 1999
Return-Path: <majordom@xxxxxxxxxxxxxxxxxx>
Received: from listserv.equis.com (listserv.equis.com [204.246.137.2])
	by purebytes.com (8.8.7/8.8.7) with ESMTP id OAA03908
	for <neal@xxxxxxxxxxxxx>; Wed, 25 Aug 1999 14:02:04 -0700
Received: (from majordom@xxxxxxxxx)
	by listserv.equis.com (8.8.7/8.8.7) id EAA12051
	for metastock-outgoing; Thu, 26 Aug 1999 04:42:45 -0600
X-Authentication-Warning: listserv.equis.com: majordom set sender to owner-metastock@xxxxxxxxxxxxx using -f
Received: from freeze.metastock.com (freeze.metastock.com [204.246.137.5])
	by listserv.equis.com (8.8.7/8.8.7) with ESMTP id EAA12047
	for <metastock@xxxxxxxxxxxxxxxxxx>; Thu, 26 Aug 1999 04:42:42 -0600
Received: from mail.ixpres.com (mail.ixpres.com [207.137.28.4])
	by freeze.metastock.com (8.8.5/8.8.5) with ESMTP id OAA04121
	for <metastock@xxxxxxxxxxxxx>; Wed, 25 Aug 1999 14:33:11 -0600 (MDT)
Received: from IXPRES.COM (01-036.015.popsite.net [192.216.6.36])
	by mail.ixpres.com (8.9.2/8.9.1) with ESMTP id NAA52811
	for <metastock@xxxxxxxxxxxxx>; Wed, 25 Aug 1999 13:23:46 -0700 (PDT)
Message-ID: <37C44FBF.95994241@xxxxxxxxxx>
Date: Wed, 25 Aug 1999 13:19:11 -0700
From: Daniel Martinez <DanM@xxxxxxxxxx>
X-Mailer: Mozilla 4.61 [en] (Win98; U)
X-Accept-Language: en
MIME-Version: 1.0
To: metastock@xxxxxxxxxxxxx
Subject: Re: beyond Metastock - Install MS Office Pro 2000 Upgrade?
References: <000801beee24$be40be60$fb906395@xxxxxx>
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
Sender: owner-metastock@xxxxxxxxxxxxx
Precedence: bulk
Reply-To: metastock@xxxxxxxxxxxxx
Status:   

<x-html><!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
To Group,
<br>about Excel 97 &amp; 2000:&nbsp; I only recently purchased/installed
MS Office Pro 97 on July 1.&nbsp; Before that I used Corel Pro 7 with Quattro
Pro 7.&nbsp; I was forced to add MS Office Pro 97 because Quattro "Pro"
7 is not OLE2 capable.&nbsp; I was able to purchase MS Office Pro 97, full
retail, for a total of $75 at EBAY which was an outstanding deal (it was
$520 at most retailers).
<p>I also was able to get, direct from MicroSoft, the MS Office Pro 2000,
upgrade version, for $8.&nbsp; Since I spent so much time installing 97
and downloading/upgrading various components, I don't really want to install
the 2000 right now (I'm actually a bit tired of installing software).
<p>Does anyone know how much of a difference there is between Excel 97
and 2000?&nbsp; Is it worth my upgrading right now?&nbsp; Does Excel 2000
have enough additional capabilities, especially with VBA, to warrant my
spending another 12 hours (with additional downloads for patches) upgrading?
<p>Daniel.
<br>&nbsp;
<br>&nbsp;
<p>Walter Lake wrote:
<blockquote TYPE=CITE>Hi Guy and Daniel
<p>"... For most MetaStock users, I believe the MS Excel/MetaStock combo
is
<br>plenty.&nbsp; Most users, myself included, don't know how to program
in Visual
<br>C++.&nbsp; It would also be time consuming. ..."
<p>The major problem that Metastockers have in moving to additional programs
<br>... whether they be Excel or VB or Visual C++ ... is how to use it
in their
<br>trading.
<p>Guy identified specific purposes that he has. As a spread trader I have
<br>specific uses for Excel etc.
<p>No one has written an article on the uses of Excel for trading and universe
<br>of stocks screening.
<p>We shall all have to wait and see what direction Metastock is going
in with
<br>version 7.0. Then the future will be a little clearer.
<p>As discussed earlier ... reluctance to rely on a retail version of a
program
<br>is a reason why many traders turn to programming.
<p>Another reason ... is the tremendous bias the retail program puts on
your
<br>trading thinking / mind set. I have to remind myself daily that technical
<br>analysis is only one piece of the puzzle.
<p>Each trader has to find his own market or structural inefficiency to
make
<br>money in. Going there is often off the beaten pathway with all of
<br>existential terrors of emptiness and nothing-ness and unknowing-ness
as your
<br>friend.
<p>Happy trails
<p>Walter</blockquote>
</html>
</x-html>From ???@??? Wed Aug 25 15:51:03 1999
Return-Path: <majordom@xxxxxxxxxxxxxxxxxx>
Received: from listserv.equis.com (listserv.equis.com [204.246.137.2])
	by purebytes.com (8.8.7/8.8.7) with ESMTP id PAA05683
	for <neal@xxxxxxxxxxxxx>; Wed, 25 Aug 1999 15:35:56 -0700
Received: (from majordom@xxxxxxxxx)
	by listserv.equis.com (8.8.7/8.8.7) id GAA13031
	for metastock-outgoing; Thu, 26 Aug 1999 06:04:29 -0600
X-Authentication-Warning: listserv.equis.com: majordom set sender to owner-metastock@xxxxxxxxxxxxx using -f
Received: from freeze.metastock.com (freeze.metastock.com [204.246.137.5])
	by listserv.equis.com (8.8.7/8.8.7) with ESMTP id GAA13028
	for <metastock@xxxxxxxxxxxxxxxxxx>; Thu, 26 Aug 1999 06:04:26 -0600
Received: from smtp02.wxs.nl (smtp02.wxs.nl [195.121.6.60])
	by freeze.metastock.com (8.8.5/8.8.5) with ESMTP id PAA04172
	for <metastock@xxxxxxxxxxxxx>; Wed, 25 Aug 1999 15:54:54 -0600 (MDT)
Received: from escom ([195.121.180.196]) by smtp02.wxs.nl
          (Netscape Messaging Server 3.61)  with SMTP id AAB6D0D
          for <metastock@xxxxxxxxxxxxx>; Wed, 25 Aug 1999 23:41:00 +0200
Message-ID: <008701beef42$4fcf0580$c4b479c3@xxxxx>
From: "A.J. Maas" <anthmaas@xxxxxxxxx>
To: <metastock@xxxxxxxxxxxxx>
References: <000701beef01$d56f4ec0$202567d1@xxxxxx>
Subject: Re: VBA is the core language 
Date: Wed, 25 Aug 1999 23:35:50 +0200
Organization: Ms-IRB
MIME-Version: 1.0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 8bit
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 5.00.2014.211
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2014.211
Sender: owner-metastock@xxxxxxxxxxxxx
Precedence: bulk
Reply-To: metastock@xxxxxxxxxxxxx
Status:   

> Ton will have to describe where VBScript fits into this overview.

As instructed..........see below (replaced the above line and have added
here and there, and have used capitol letters).

Regards,
Ton Maas
ms-irb@xxxxxxxxxxxxxxxx
Dismiss the ".nospam" bit (including the dot) when replying and
note the new address change. Also for my Homepage
http://home.planet.nl/~anthmaas


----- Original Message -----
From: Walter Lake <wlake@xxxxxxxxx>
To: Metastock bulletin board <metastock@xxxxxxxxxxxxx>
Sent: woensdag 25 augustus 1999 15:57
Subject: VBA is the core language


> Thanks for your emails
>
> As far as I understand it, VBA and NOT Visual Basic (VB) is the core
> language for Excel (XL), Word (W) and Visual Basic 6.0 (VB, which is the
> retail stand alone program).
>
> IN ANY VB LANGO (VB ITSELF AND SPIN-OFFS LIKE VBA AND VBSCRIPT)
> OBJECTS AND COMPONENTS ARE UNIQUELY IDENTIFYABLE TARGETS THAT
> WILL ALWAYS COME WITH THEIR OWN ALSO UNIQUE PROPERTIES.
> THEREFORE SOME OF THESE PROPERTIES "WILL/CAN OR WILL/CANNOT"
> FUNCTION IN ANY OF THE OTHER OF THE VB-SUBSET'S LANGOS.
>
> Each application (XL, W and VB) uses different objects' APPROACHING
> STATEMENTS AND COMMANDS, etc. therefore the VBA code looks
> different for each.
>
> Any custom workbook in XL plus the custom user forms, toolbars, etc.  and
> the underlying VBA code can be inserted as an Add-in into XL for easier
> access and use.
>
> VB stand-alone SELF-CREATED programs can access and use XL workbooks,
> data and charts etc. + any W documents, etc.
>
> VB programs cannot be inserted into XL as an Add-in because VB uses
> different STATEMENTS AND COMMANDS IN APPROACHING OBJECTS
> THAN FOR INSTANCE IN XL's OWN VBA.

> VB, VBA and VBScript FOR LANGUAGE all differ from oneanother (example: in
> approaching objects).
>
> FROM THE MICROSOFT SCRIPTING WEB-SITE:
>
> VBScript :
> Microsoft® Visual Basic® Scripting Edition, a subset of the Microsoft® Visual Basic®
> programming language, is a fast, portable, lightweight interpreter for use in World Wide
> Web browsers and other applications that use Microsoft® ActiveX® Controls,
> Automation servers, and Java applets.
> VBScript is designed to be a small and lightweight interpreted language, so it does not
> use strict types (only Variants). Also, because VBScript is intended to be a safe subset
> of the language, it does not include file I/O or direct access to the underlying operating system.
> You can find a complete list of the differences between VBScript and Visual Basic for
> Applications on the "VBScript: Working Description" page.
>
> WSH :
> The Microsoft® Windows Script Host® (WSH) is a tool that will allow you to run
> Visual Basic® Scripting Edition (and JScript®) natively within the base Operating System,
> either on Windows 95/98 or Windows NT 4.0/5.0.
>
> Using the scripting languages you already know you can now write script to automate
> common tasks, and to create powerful macros and logon scripts.
>
> THUS:
> VBSCRIPT CONTAINS VB-FEATURES FOR AUTOMATING TAKS, ROUTINES AND
> PROCEDURES THAT ALL DEAL WITH THE HANDLING OF OBJECTS AND THEIR
> POSSIBLE (ADDITIONAL) COMPONENTS.
>
> Maybe Metastock 7.0 will have better linkages so that the Metastock/Excel
> trading package is not quite so "clunky". IF METASTOCK WANTS TO BE TRULY
> MICROSOFT OFFICE COMPATIBLE (SEE STAMP ON MANUAL COVER) THAN
> THE IN 1995 ANNOUNCED AND TO BE ADDED VBA-FEATURE (SEE THE EQUIS
> MONITOR NEWSLETTER SPRING-1995) SHOULD BE SHIPPED ALONGSIDE.
> ELSE METASTOCK REMAINS ONLY PARTLY MICROSOFT OFFICE COMPATIBLE
> FOR WHICH MANY COMMON PROGRAMS ALSO QUALIFY (EVEN THE
> STANDARD IN WINDOWS BUILD-IN NOTEPAD, WORDPAD AND PAINT-PROGRAMS
> PASS THIS QUANTIFICATION EASELY).
>
> Best regards
>
> Walter
>
>

=================/////////////////////////////////////////////////////////////////====================

SCRIPT: A list of statements (procedures like instructions, methods + commands) entered in the VB Editor
                that a computer understands (when the correct applicable programs are also installed).

FORM:   A form is a document with empty areas in which to collect and organize information-tools that are to
                inter-act (communicate) with users of the program (or script), used by programmers, in a program
                and that can held sub-scripts (and for each tool).

CONTROLS: Controls are buttons or text fields or add-in's which can be used to get input from (or any other
                inter-action with) the user (in mind) and contain procedures (instructions, methods, commands etc.).

APPLICATION: A program written for computer usage by a user and on (program) specific (operating) systems.

OBJECTS: The unique program identifier (the target), shortly also called ProgID : eg object classes,
                the application IDs, the Type libraries and the interface definitions (which are not of
                interest for script programmers).

COMPONENTS: In Windows registered automation components (interfaces). There are several file types,
                which may be referenced to get the interface definitions (In short, any of these files too can
                contain their own unique "objects") :
                      - .EXE, DLL:
                         These files contains the executable program code of the out of-process-server
                      - .OCX:
                         These files are used to save the code for ActiveX controls.
                      - .TLB, OLB, DLL:
                         These files contain Type Libraries: -Type Libraries (TLB)
                                                                                     - Object Libraries(OLB)
                                                                                     - and Dynamic Link Libraries (DLL).

PROJECTS: A summing up of all availble objects, controls and components usable within a (later self
                createable) program (and pre-release='your' project).

=================/////////////////////////////////////////////////////////////////====================

Excerpts from Gunter Born's book "Windows Scripting Host Tutorial" available from
http://ourworld.compuserve.com/homepages/Guenter_Born/index0.htm
---------------------------------------------------------------------------------
Windows Scripting Host Tutorial - Inside Windows Scripting Host

Chapter 2 - Development Tools

-------------------------
The OLE/COM Object Viewer
-------------------------
As soon as you would like to use external automation objects within a script,
you need information about their interface definition. You must know for
instance the program identifier (shortly also called ProgID), to use the
GetObject or the CreateObject method. Furthermore it is important to know,
whether the automation object is registered already under Windows.
The Microsoft OLE/COM Object Viewer provides this information.
This is a tool written by Microsoft developers to analyze the Windows registry
and shows you the object classes, the application IDs, the Type libraries and
the interface definitions (which are not of interest for script programmers)
available on the current system (Figure 2.10).

Using the program is similar to the Windows Explorer.
At program start the viewer shows you in the left pane the available classes
obtained from the Windows Registry. Double-clicking an icon opens the sub-branch.
If no further sub branches exists, the program shows the registered program
information of the selected icon in the right pane of an associated entry.
The information is obtained from the Registry branch HKEY_CLASSES_ROOT.
For script developers this information might be quite interesting.
You can get, for instance, the ProgID (Programmatic Identifier), under which
the concerned component is registered in Windows.
This ProgID is required to access the object.
Furthermore the viewer indicates you the path of the file of the component.
These are EXE-, DLL- or OCX-files, from which the functions (method's properties)
of the component are loaded.
Using this path you can find out very easily, whether the concerned component is
still required and where the associated files are stored. This comes in handy,
for instance, during an uninstall of any ActiveX components (see below).
Furthermore, you need the path to an OCX-file, if you try to obtain information
about the automation interface of an object (functions like method's properties),
using the object browser.

(Picture)
Figure 2.10.
The OLE/Com Object Viewer


NOTE: The OLE/COM Object Viewer is part of several of the Microsoft's development
packages (for instance Visual Studio). You may also download the viewer from
http://www.microsoft.com/com/resource/oleview.asp

------------------------
Using the Object Browser
------------------------
One of the largest problems for a WSH programmer are caused from the missing
information about the features of automation objects. Of course, the best support
comes with the help files shipped with a component. But not all programmers ship
an online help. Even as I begun with scripting, not too much Microsoft
documentation about WSH was available then.
At this time I spend many hours reading several books on ActiveX programming, I
consulted the VBA programmer's title I wrote for Microsoft Press and checked other
sources available.
At this time I had a lot of questions like:

 - Which objects are available?
 - Which methods do I need?
 - How to get some information about the properties?
 - If you have an idea on which object to use, you always need further object's
   information, eg about its inter-face, its methods and method's properties.
   How to get all of this information, if no documentation is available?

The entire concept behind Windows automation for OLE, COM, ActiveX etc. is based
on the attempt that all automation objects communicate mutually accross certain
interfaces. Without bearing you with too much details, we can assume that Windows
must keep information, stored somewhere, about these installed automation objects.
And there must be also a way to obtain an interface's description from these
automation objects (to have the interface, as a "medium", that is negotiating with
the other components).

(Picture)
Figure 2.11.
VB 5 CCE with Object Browser window

On the previous page I mentioned that the program OLE/COM Object Viewer retrieves
some of this information from the Registry. Inspecting such an entry delivers
information about the files of a component, you get the ProgID (which is used
in CreateObject, to create a reference to an object).
To find out more about an object, we need a tool, which shows all information in
a human read-able format.
One tool that can do this for you is the Object Browser provided in the Visual Basic
development environment. And the Visual Basic editor is also included in all
Microsoft Office applications (Word, Excel etc.) or in the Visual Basic 5.0
Controls Creation Edition (VB 5 CCE), and on the website mentioned above.
If you have one of these applications you must enter the Visual Basic editor
(press Alt+F11 in Word, Excel etc.). The Object Browser may be invoked using
the Object Browser button in the toolbar of the development environment window
(Figure 2.11).

NOTE: The Visual Basic 5 Control Creation Edition (VB 5 CCE) can be downloaded
from Microsoft's Web site
http://www.microsoft.com/gallery/tools/visualbasic/vbcce.asp

The VB 5 CCE provides a Visual Basic 5.0 development environment without the
function for preparing standalone EXE files. As soon as you install the VB 5 CCE,
you dispose of the concerned VB development environment.
We will use this environment in this book in later chapters to prepare the
ActiveX controls to extend the Windows Scripting Host capabilities.

The Object Browser lists in the left pane all classes (objects) within a project.
If you select a class, the right pane shows the methods (marked with a green block)
and properties (indicated with a stylized hand) supported by this object.

(Picture)
Figure 2.12.
Selecting libraries

The objects shown in the Classes window may be selected within the Object Browser's
list box (Figure 2.12). If you select the entry »All Libraries«, the Object Browser
shows all objects (classes) known in the development environment.
Or your can select another entry to restrict the viewed content to a class library.
The right pane shows the methods and properties of the selected object of the class.

Click an object to retrieve the properties and methods within the Object Browser.
If you select an entry (method, property) in the right pane, the definition of the
entry is shown in the footer of the Object Browser's window.
For a property you get the information, whether these are read only items, about the
data type and to which class the property belongs.
For a method the Object Browser delivers in addition information about the interface
along with the required parameters.
In Figure 2.11 the interface definition of the Echo method is shown for instance.
The Object Browser indicates only the classes (objects as well as their methods and
their properties), which are currently registered within the development environment.

If you need information about a special component, you need to define a reference to
the required object library (before you open the Object Browser).
Use the following steps:

 1. Open the References dialog box. The References command may be found in the VB 5 CCE
    in the Project menu. In the VBA-development environment you must here choose the
    item References in the Tools menu.
 2. Figure 2.13 shows the References dialog (upper left). The list Available References
    contains the names of the libraries, which are known in the development environment.
    A checked checkbox in front of an entry indicates the associated Library is used
    within the project. Therefore these checked libraries will also be shown in the
    Object Browser. If the Available References-list contains a library that you want
    to use, check the checkbox in front of the library name.
 3. If the required library is missing in the Available References-list, click the
    Browse button. A second dialog box is shown (Figure 2.13, right). Browse for the
    requested library file and select it within this dialog box.

(Picture)
Figure 2.13.
Defining a new reference to an object library

After closing the Add Reference dialog box using the Open button, and after checking
the associated checkbox in the References dialog box, the Object Browser shows the
classes, methods and properties contained in the object library.

----------------
A few other tips
----------------
Above I had mentioned already in the OLE/COM Object Viewer section that this tool
indicates the path to the file(s) of a registered automation component.
This file contains however the description of all exported interfaces. As soon as
you know the location of the file, you can set the path to the registered automation
component. There are several file types, which may be referenced to get the
interface definitions:

 - .EXE, DLL: These files contains the executable program code of the out
    of-process-server.
 - .OCX: These files are used to save the code for ActiveX controls.
 - .TLB, OLB, DLL: These files contain Type Libraries:
    Type Libraries (TLB), Object Libraries(OLB) and Dynamic Link Libraries (DLL).

These file types can be selected over the File type list box within the dialog box.
The only difficulty exists therein, that you must know the path to the concerned files.
Furthermore not each file delivers the required information in great detail.
But I feel, this function is extremely helpfull to retrieve information about
an object, its methods and properties.

----------------------------------------
Installing/uninstalling ActiveX controls
----------------------------------------
Within a script you may use objects provided by applications like Microsoft Word or
Microsoft Excel. Other objects are exposed by the WSH itself or by the Windows
operating system.
Many objects are provided from ActiveX controls. Some of these ActiveX controls
may be downloaded from the Internet.
In some cases these controls come with a setup program that allows you to
install/uninstall the component.

NOTE: Some authors of ActiveX controls include these controls into a website.
If the browser detects a missing ActiveX control, a message box asking you
whether you like to to install this component. If you click Yes, the component
will be installed on your machine.

The installed ActiveX control can also be used in WSH scripts.
Uninstalling this control is discussed below.
 - Also, if you develop an ActiveX control using a development environment
   (like Visual Basic or the VB 5 CCE), the component is registered automatically
   on the development machine and the control is stored in a OCX file.
 - Before you can use a downloaded ActiveX control within a script, you need to
   register this control.
Do you dispose of an ActiveX control (an OCX file), which isn't registered yet?
If the developer of the OCX component doesn't provide an install program which
overtakes the necessary steps to register the object, you need to use the program
RegSvr32.exe.
Microsoft ships this program with several applications and operating systems.
To register the content of an OCX file as an ActiveX control, use the following
command:

RegSvr32.exe C:\Samples\chapter02\BornTest\BornActive.ocx

The program locates the file using the path, analyses files content and adds all
requested information into the Registry. After this step you can use the ActiveX
control within a WSH script.

(Picture)
Figure 2.14.
Options for RegSvr32

NOTE: RegSvr32.exe is part of all Microsoft development environments. Fortunately
a copy of this program is also shipped with Windows 98. You will find the program
in the Windows System folder.
If you invoke this program with the following command:

RegSvr32.exe /?

an error dialog with all possible options for this program is shown (Figure 2.14).

TIP: Within the sample files there is a file \Samples\chapter02\BornTest\OCXReg.reg
     Double-clicking this file once extends the shortcut menu of your OCX files with
     two new commands, Register OCX and Unregister OCX.
     One command registers the ActiveX control contained in the OCX file, and the
     other command unregisters the ActiveX control.
     The folder contains also the web page Active1.htm that registers the OCX control
     BornTest.ocx automatically when you view(open) the page in the Internet Explorer.

--------------------------
Licensing ActiveX controls
--------------------------
Whilst I was developing the samples of this book I discovered a major problem - the
licensing of ActiveX controls. It is not a problem to register an ActiveX control
using RegSrv32.exe.
The CD-ROM shipped with Microsoft Windows 98 contains several OCX-files, which might
be rather helpful for a script developer (for instance the file MSInfo.ocx).
I have had downloaded also several OCX files from websites. After installing these
OCX files, I failed to use the objects provided from these ActiveX controls.
Each attempt to access an object after executing the CreateObject method resulted
in the run-time error »Win32-Error 0x80040112«.
Unfortunately this error code is not documented.
So it took me a while till I found out that this error indicates a missing license
info for the control.

Microsoft started a while ago to add a kind of license check to its ActiveX controls.
Such ActiveX controls only works on the target machine, if a valid license key is
detected. For some ActiveX modules it was sufficient to install the VB 5 CCE, for
others I needed to install Visual Studio 6.0. For other ActiveX modules I needed to
install Microsoft Office 97.
For instance, the ActiveX control Mswinsck.ocx is part of the Microsoft Office 97
Developers Edition. Because I own this edition, I tried to register the OCX file
manually using the RegSvr32.exe. After getting the licensing error mentioned above,
I then tried to re-install the whole Microsoft Office package, without any positive
result.
The OCX control could not be used. Only after a clean install of the whole system
I was able to run the tests. This behavior is caused from the Microsoft Office
Setup-program that checks the system during the installation process only for
missing components. Components already installed or present will be left without
updating on your machine. So re-installing a feature won't fix the bad situation
of a missing license key.
Also many vendors of ActiveX controls use this license keys. ActiveX controls from
these vendors are only useable on the development machine.
And I need to mention another problem. Updating to a new version of some Microsoft
products (like updating to VB 5.0 or VB 6.0) causes licensing conflicts again,
because the new controls requires a different license key upose to the controls
from the previous version. Because Setup won't change Registry entries for existing
components, the license keys won't be updated properly. To solve this problem,
Microsoft provides some tools, which will fix the wrong license keys.
Microsoft's support pages (www.microsoft.com) contains two Knowledge Base-Articles,
Q181854 and Q194751, discussing such problems during upgrading new controls for
VB 5.0/VB 6.0. The tool Vbe.exe offered for download fixes a few (but not all)
problems with VB 5.0 controls.
After installing Visual Basic 6.0 my problems with these controls was gone.
Missing license information for updated VB 6.0 controls may be fixed using the
tool VB6Cli.exe (downloadable from the same web site).

ActiveX controls works like an onion:
internally they refer to other ActiveX controls.
It is highly probable that the dependencies caused by this architecture results in
missing components on the target machine. Then you are not able to use the control.
As long as such packages are distributed in whole, it will be no problem.
But ActiveX controls are offered many times for download from websites. And then you
take a high risk that not all parts of the »game« are already on your machine.
Just another »joke« which caused me a few more gray hairs. During developing the
samples for the German version of this book, I had installed Visual Studio for a week
on my development machine, so I could use many ActiveX controls coming with this package.
Then I send over parts of the samples to my technical editor for testing.
And it reported that nearly all my samples using external OCX files won't work (for
licensing reasons), till the VB 5 CCE is installed.
And a few examples depends on an installed Visual Studio 6.0. So I kept my test machines
as clean as possible (no Visual Studio installed), to recognize missing components.
But this situation is really bad, especially for the non-experienced script programmers.

----------------------
Uninstalling OCX files
----------------------
Above it was shown, how to install an ActiveX control.
After installing ActiveX controls using RegSvr32.exe, or after using a development
environment like Visual Basic or VB 5 CCE to create your own controls, your system
(and your Registry) becomes cluttered by installed ActiveX components.
Thus raises the question, how to remove unused ActiveX controls? It's not sufficient
to delete the OCX file only. Instead, you must uninstall the whole component, which
means remove the Registry entries.
Before you start to do this job in the Registry Editor, use the program RegSvr32.exe
and enter the following command:

RegSvr32.exe /u C:\Samples\chapter02\BornTest\BornActive.ocx

The program locates the OCX file given in the path. The switch /u forces the program
to remove all entries for this ActiveX component from the Registry. Afterwards, you
may then delete the OCX file safely, eg without taking the risks that unused entries
remains in your system.

TIP: If you import the REG file mentioned on the previous page, you can right-click
     the OCX file and use the shortcut command Unregister OCX, to unregister
     the OCX file.

----------------------------------------------------------------------
Uninstalling an OCX ActiveX control which was installed by the browser
----------------------------------------------------------------------
Did you install an ActiveX component using a browser and a web site?
The sample file ActiveX1.htm located in the folder \Samples\chapter02\BornTest
does this with BornTest.ocx.
In this case the browser stores the OCX file under Windows 98 in the folder
Temporary Internet files. And the module is getting registered automatically.
To uninstall an ActiveX module that is installed in this way you must process the
following steps:

 1. Launch the Internet Explorer and select Internet Options in the View menu
    (in Microsoft IE 5.0 you need to use the Tools menu).
 2. Select the General property page on the Internet Options property sheet and
    click on the Settings button (Figure 2.15, left).
 3. The browser opens a second dialog box Settings.
    Click the View Objects button (Figure 2.15,right).
 4. The Downloaded Program Files folder windows, which contains all program files
    downloaded and registered during an Internet session, is shown (Figure 2.16).
    Right-click the file, which you intent to remove and select Remove in the
    shortcut menu.

(Picture)
Figure 2.15.
Internet Options

The browser now shows a third dialog box, which you must confirm by clicking
the Yes button. Afterwards, Windows uninstalls this object (delete the file and
remove all Registry entries).

(Picture)
Figure 2.16.
Folder Downloaded Program Files

The objects in the Downloaded Program Files folder may be ActiveX objects stored
as OCX files and other items like Java class modules stored in CAB archives.
You may use the COM/OLE Object Viewer after uninstalling to check whether the
ActiveX entries are removed from the Registry.

TIP: Some ActiveX objects come with its own install program. In this case you may
     use the entry provided in the Install/Uninstall property page
     (use the Add/Remove Programs icon in the control panel folder to invoke the
     property page).