# Metastock & Tradesim Questions



## Sugar Dunkaton (30 March 2009)

Good Afternoon.

I have recently puchased the Metastock & Tradesim combination to start testing a few systems. However after reading through a lot of code, and the metastock manual - i am still waiting on the tradesim manual -still at the printers, i have a few questions that may be able to be answered.

1) Is it possible to reference to the day that a trade was opened - ie if the system goes long on a stock, can you have your Exit Trigger at EntryDate(Low). I am looking to use this as part of the initial stop function.

2) How does the "cross" function work. And can it be used in the inverse, from what i gather from the primer, it only works if something crosses from under to above something else. If i am looking to create a buy signal for the cross function it would go something like Cross(mov(C,10,E),mov(c,40,e))=1 and that will buy when the EMA10 moves above EMA40?

3) If working on a breakout system, is it possible to code so that you buy - if the system is long) as soon as the signal is set off. At the momet I have been coding end of day data so that I buy on the next open after my signals go off, but i am wondering if there is a better way (I do understand that my exits are far more important than the entries BTW).

4) I have noticed reading through other peoples code that they seem to use some coding that i cannot find in the MS Primer - are there any internet based sources where i can find these extra codes?

5) For some reason, i can only test in TS from 09/02/2007, although in Metastock i have opened up the 65500 periods box in the options menu meaning that it should open all the data (which i have purchased through PremiumData). Is there something I have missed. I really would like to test some of my systems through that last great bullrun even though they are not indicitive of todays market!

Thank you for your time.

SD


----------



## tech/a (30 March 2009)

Hope this helps



Sugar Dunkaton said:


> Good Afternoon.
> 
> I have recently puchased the Metastock & Tradesim combination to start testing a few systems. However after reading through a lot of code, and the metastock manual - i am still waiting on the tradesim manual -still at the printers, i have a few questions that may be able to be answered.
> 
> ...


----------



## tech/a (30 March 2009)

If you go here you'll find some basic Code for setting up Tradesim.

Just add your own code for entry exit etc.

http://www.thechartist.com.au/forum/ubbthreads.php?ubb=showflat&Number=65771#Post65771


----------



## AMSH (31 March 2009)

Hey Sugar Dunkerton,

Just to expand on a couple of techs answers:

No 2.
The cross function does relate to the first argument crossing above the second. The argument Cross(mov(C,10,E),mov(c,40,e)) will generate a signal when the 10 period EMA crosses above the 40 period EMA. In other words a signal is generated on the first day that the value of the 10 period EMA is greater than value of the 40 period EMA.

The way that you invert this is to simply swap the arguments around. If i say: cross(mov(C,40,e),mov(C,10,e)) a signal will be generated when the "40 period EMA crosses above the 10 period EMA" but also in effect when the "10 period EMA crosses below the 40 period EMA". By changing the order of the arguments you can end up with the code you want. Do you follow?

No 4.
I don't use anybody elses code, I prefer to write all the stuff myself; that way I have a better understanding of what the system's actually doing. There is some 3rd party stuff out there but this might not be what you're seeing. With a lot of the more complex code it becomes necessary to define arguments at the beginning of some code and then refer to the defined arguments in the code. To explain, I could write the following as my buy signal:
EMACross: cross(mov(C,9,e),mov(C,21,e));
EMACross AND (C>Ref(C,-1))

The "EMACross" bit is just an arbitrary name that I've given that specific argument. The actual buy signal is the second line, not the first. This might be the type of code that you're seeing. Also, the primer doesn't seem to be exhaustive and there are some (a lot i think) functions not explicitly referred to in it. You should also remember that when you're using tradesim you'll have a lot of code that doesn't appear in the Metastock documents and this could also be some of what you're seeing. If you can give an example of the code, I can tell you if it's Tradesim code or whatever.

I'd also recommend looking in your tradesim folder becuase I got a pdf of the manual included. You might have one.

Hope that helped,

Cheers,

AMSH


----------



## Wysiwyg (4 October 2009)

> These days so much trading software is written for computer programmers and not for the less computer literate trading community who's main concern is to* focus on their trading system and not the idiosyncracies **of the software or it's language. TradeSim addresses these **needs by providing an intuitive streamlined user interface whilst not **compromising on performance, power and flexibility!*




Can someone please tell me if the "intuitive streamlined user interface" still requires computer programming knowledge. I do not want to have to know code to generate a strategy for backtesting.


----------



## tech/a (4 October 2009)

W

You'll need either Metastock or Amibroker code knowledge or someone who can code your ideas for you.
I have only a basic code knowledge which gets me by,wish I had the abilities of the Roy Larsen's and Howard Bandy's of the world!

Even basic knowledge can open many doors and help you to see what it is that makes a system work.Many of our pre concieved ideas vanish as we test results.


----------

