PureBytes Links
Trading Reference Links
|
Herman,
Wow! Excellent post. You have some really great suggestions for
working with the software. I've used several of the techniques that
you have described below, with great success. But you've offered some
new ones, tied it all together, and opened some very interesting
possibilities with the reverse OLE idea!
Both yours and Roy Larsen's System Tester formulas are "must reads"
for system developers in the Metastock formula language.
================
Dave Nadeau
Fort Collins, CO
> -----Original Message-----
> From: owner-metastock@xxxxxxxxxxxxx
> [mailto:owner-metastock@xxxxxxxxxxxxx]On Behalf Of Herman
> van den Bergen
> Sent: Thursday, August 16, 2001 7:58 AM
> To: metastock@xxxxxxxxxxxxx
> Subject: Debugging Techniques
>
>
> Perhaps the methods outlined below are obvious and are not
> new to you but I
> found they helped me so I'll post them for the less
> experienced MS users
> who want to develop more complicated formulae.
>
> 1) Before writing a Trading formula I group my variables:
>
> Analog values (Yes: my background is electronics :-)) i.e.
> those that can
> take on any numerical value, like EntryPrice, $Profit, %Profit,
> DailyEquity, TradeEquity, DD, etc.
>
> Digital (Binary) variables that can only take on the values
> of 1 and 0,
> like: GoLong, GoShort, GoCash, ExitLong, etc.
>
> Mixed variables that, for example, takes on certain
> specific values 1
> (Long), 0 (Cash) and -1 (Short).
>
> 2) I develop my trading formula in small steps starting with the
> lowest/simplest variable, make an indicator for each variable and
> plot/verify them on the price chart. It is very useful to
> plot your binary
> signals too, I often have 3-8 binary signals below the
> price chart during
> the development. Just like a Logic Analyzer ... To make the
> signals plot
> nicely you can multiply them by 5 or 10 and give them an
> offset, modify the
> trace as you like. Like:
>
> GoLong*10;
> GoShort*10-20;
> GoCash*10-40;
> Position*10-60;
> etc.
>
> This will make it very easy to see what is happening and
> whether your
> timing is correct - It is often a struggle to get your
> signals in sync and
> this way you can easily modify or add a ref(x,-1) function
> and see what
> happens to the binary signals.
>
> 3) When the formula is finished (?) make a backup by adding
> BAK to the end
> of it's name. Now create separate indicators for all
> significant variables
> you defined (with := )in your trading formula. This is very
> easy and allows
> you to use them for debugging and further development work.
> Suppose you
> have a trading fomula named "MySystem" and it contains a
> variable named
> "Position", you can make an indicator to display this
> varibale with a
> single line like FmlVar("MySystem","Position"); You can
> then use this in
> other formulae and/or combine a number of them to allow you
> to easily plot
> sets of indicators to facilitate subsequent work.
>
> 4) It may help you to put a custom grid on your chart to
> more clearly show
> the relationship between the various events by adding
> vertical lines like
> this:
>
> If(GoLong, Close,0);
> If(GoShort, Close,0);
>
> Plot the value, assign a color of your choice, assign the bar graph
> pattern, and set the line-width to this thinnest available. This
> combination will plot straight vertical lines up from zero
> to the Close or
> Equity (use P) WITHOUT the zero interconnect that messes up
> the display.
>
> 5) Now, you got it all working... :-) but are you sure
> that the numbers
> are correct? Next you can (should?) display ALL significant
> traces at the
> same time and copy all the data arrays to Excel to verify
> vales and perform
> parallel/supplementary calculations outside of MS.
>
> To copy a data array you select it (Click on it), place
> your cursor on one
> of the little square handles, right click and copy. Go to
> Excel, select
> your left-upper destination cell and go Edit, Paste
> Special, Csv, OK.
> You'll get a column with dates and one with the values of
> the selected
> chart. You will have to do this trace by trace, putting
> them side by side,
> and Delete the duplicate data columns. Be sure to also
> export binary values
> to show you where the triggers are! Not only can you verify the
> calculations performed in MS with parallel calculations in
> Excel, you can
> also perform addition analysis.
>
> To make the Excel sheet easier to read you can select the
> entire page and
> click Format, Conditional Formatting, Cell Value Is, Equal
> To, 0, Format,
> Color=White, OK. This will display all zeroes on the page
> in white - they
> will only become visible when you select the area.
>
> 6) Now for the ambitious developer :-) You can save your
> crowded MS display
> in a template and when exporting data arrays use Paste Link
> instead of
> Paste in Excel. This will result in a spread sheet that
> uses OLEs and the
> sheet will update automatically with new values whenever you change
> formulae - as long as you don't change the names I presume.
>
> 7) If you are more ambitious than that you can make a
> reverse OLE link to
> display a calculated column of values in Excel, in a
> MetaStock chart that
> updates in real time. I have only briefly tested this and
> it is NEAT! Lots
> of possibilities...
>
> Well, in conclusion I must say that while MS has some bugs
> I enjoy using
> the program immensely.
>
> Hope this is useful info,
> If you have some debugging techniques of your own to share
> please do so.
>
> Happy Trading,
> Herman.
>
>
>
>
>
>
>
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
|