Australian (ASX) Stock Market Forum

Help with simple MS formula

Joined
28 January 2009
Posts
46
Reactions
0
Hello All,

I am new to Metastock and I am trying to work out how to write a simple formula but I am unable to do it so I am hoping someone can help me here. It's should be very simple but still I cannot work out how to do it.

This is what I have so far -


EL:=H > Ref(HHV(H,20),-1); {Enter Long Position on a New 20 Period High}

CL:=L < Ref(LLV(L,10),-1); {Exit Long Position on a New 10 Period Low}

ES:=L < Ref(LLV(L,20),-1); {Enter Short Position on a New 20 Period Low}

CS:=H > Ref(HHV(H,10),-1); {Exit Short Position on a New 10 Period High}

EnterLongTrigger:= EL;


I want my "EnterLongTrigger" to only give me a signal to buy long if my previous trade WAS NOT Profitable.

In other words if my previous buy signal proved to be a profitable trade then disregard this buy signal.

How can I write this?

Thank You
 
Hey Dracuu,

The MS formula language seems to be pretty restrictive with this type of thing. There are a limited number of portfolio functions which you can find in the MS manual (search for "simulation functions" in the MS help) but I don't think they'll allow you to do this. If you can't find anything, try the equis forum link below - there's some guys on there who really know they're stuff and it's a great resource when you're new to the language.

http://forum.equis.com/

Cheers,

AMSH
 
Thanks AMSH, I have already posted on the Equis forum but no replies at all.
I have taken a look at the simulation functions but still I can't work out how to base a future trades on the outcome of a previous trade.
I have just got TradeSim so I will look into that today.
 
Quickly saw this today ... it can be done. Metastock is not that restrictive ... unfortunately it takes time to check coding ... something I am short of atm. I assume you are referring to a trade on the same symbol.

The metastock yahoo mailing list is another great resource, you could also post on The Chartist (as the following coders are members there too).

Roy Larson, Wabbit or Jose could probably knock something up quickly, pretty sure if you go looking you will find similar examples also on the same forums or lists through google or search facility etc.

I would join the yahoo Metastock mailing list, Pumrysh , is very helpful to new posters with code, and stuff like this. Roy is very active on that list as well.
 
Top