# Metastock Code help



## Herlequin (17 December 2008)

Hi guys,
Could really use your help on some Metastock coding.

I want to know when the Intraday Momentum Index indicator in Metastock has turned up. Ie I want to find all stocks where the indicator value for this indicator has turned up.

and

A serach to find when the Parabolic SAR indicator has generated a long entry signal.

thanks in advance.


----------



## MS+Tradesim (17 December 2008)

The basic logic for the Intraday Momentum Index will be:

IMI(x) > Ref(IMI(x),-1) AND Ref(IMI(x),-1) < Ref(IMI(x),-2)

However, that will provide a lot of false positives so you will need to adjust it or use another filter. One way might be to use a cross of the IMI above a moving average of the IMI.

Basic logic for Parabolic SAR should be:

Cross(Data Array, sar(x,y)) eg. Cross (Close, sar(0.02,0.2))

...again will need lots of adjusting.

I haven't tested either of these but that should help you get started.


----------



## Herlequin (18 December 2008)

Thank you very much 

I am using this as a final search so stocks have already passed certain criteria.


----------



## Herlequin (18 December 2008)

This isn't getting the results i am looking for 

Am looking for this:


----------



## MS+Tradesim (18 December 2008)

Herlequin said:


> This isn't getting the results i am looking for





If you want to PM me with exactly what you're trying to achieve I can have a go at the coding for you.


----------



## tech/a (18 December 2008)

Herlequin said:


> This isn't getting the results i am looking for
> 
> Am looking for this:




To find that you need a code for the bar before the first bar turning up.
The long tail.
Stuffing around trying to find these with indicators is a waste of time.
code up the type of bar your looking for.

IE
Long tail
Closing in the upper quartile of the bar
Closing above the open.

You could have this as the initial search say as an alerts held as true for say 3 days then other conditions to trigger the entry.
Try pure price action--far more accurate.

I'll have a go myself when I have sometime.
My codings pretty rudimentary!


----------



## MS+Tradesim (19 December 2008)

Hi Herlequin, 

I think this is a time where you know what you want and you can see it in a chart but your mind is filtering out all the examples where the signal occurs but fails.  It's very easy to "see" an idea on a chart but coding it to remove the false positives is not always simple.

I've attached a chart and you can see on the IMI where I've placed yellow circles in a few cases where the IMI has "just turned up". To define "just turned up" needs more precision in order to code it. As you can see, these examples catch major turns as well as failed turns as well as chop. (Click on the chart to see it larger)

What you should do is study your charts to see what characteristics belong to the turns you're wanting to isolate. Then find examples where turns with those same traits have failed. See how reliable the pattern is that you want to use. Remember that looking over a chart you are viewing the past and when a signal is unfolding in real time you don't have the luxury of knowing how it turns out. 

As suggested you could filter out some of these false positives by using a cross of either a short IMI over a long IMI, or a cross of the IMI above an MA of itself. eg. Cross(IMI(14),Mov(IMI(14),10,s)) I've just used any old values there.

Also as suggested by tech/a, if you can identify the price/volume characteristics of what you are looking for it may be more effective to just code for that rather than using an indicator.


----------



## Herlequin (19 December 2008)

Thank you very much guys.

You all rock


----------

