Metastock code

187969_2687

.

The following codes for the MIDAS Support/Resistance curve to run in Metastock and Metastock Pro were supplied by Andrew Coles in his September 2008 article “The MIDAS Touch, part 1″ in volume 26: September issue of Technical Analysis of STOCKS & COMMODITIES.

Because this article was Article of the Month, readers who do not use Metastock should be aware that the following trading platform providers were also asked to submit code. Readers using these platform providers can access their codes either via the article above in the Traders’ Tips section or by contacting their providers directly:

TradeStation

eSignal

Wealth-Lab

AmiBroker

Neuroshell Trader

CQC

AMERITRADE

AIQ

TRADERSSTUDIO

TICKQUEST NEOTICKER

STRATASEARCH

TS SUPPORT MULTICHARTS

Ninja Trader

CMS FOREX

Investor/RT

While readers will find that the MIDAS Support/Resistance curve will work reasonably well on daily charts in Metastock, even with multiple curves running, there is a much more severe drain on memory resources when multiple curves are running on intraday charts. Ideally if day traders were using a 1m chart, at least 4/5 curves should be running on that chart plus a couple more on higher intraday timeframes such as the 5m and 15m charts.

Because of the memory drain on Metastock Pro, hardcore users of the MIDAS Support/Resistance curve are probably advised to use an external DLL for this indicator, even though the code is freely available below. Even the external DLL doesn’t remove the memory problems entirely, but it’s a lot better than an internally generated code.

Readers should also be aware that very few trading platforms are able to code the MIDAS TopFinder/BottomFinder. As David Hawkins and I explained in our July 2009 article “Market Trend and MIDAS” in volume 27: July issue of Technical Analysis of STOCKS & COMMODITIES, this is because the algorithm requires linear interpolation, which in turn requires a higher-level programming language (such as C++) which supports looping.

Again readers with an interest in this indicator who cannot program it directly into their own platforms using the platform scripts are obliged to use an external DLL.

.

Code for the MIDAS Support/Resistance curve to run in Metastock on the daily charts

Users will be prompted to input a year, month, and day corresponding to an appropriate swing high or low.

{User defined input}

sm:=Input(”starting month”,1,12,1);

sd:=Input(”starting day of month”,1,31,1);

sy:=Input(”starting year”,1980,2100,2000);

start:= sd=DayOfMonth() AND sm=Month() AND sy=Year();

{mid price}

pv:=MP()*V;

{Midas calculation}

denom:= If(Cum(V)-ValueWhen(1,start,Cum(V))=0,1,Cum(V)-ValueWhen(1,start,Cum(V)));

If(BarsSince(start),(Cum(pv)-ValueWhen(1,start,Cum(pv)))/ denom,MP())

.

Code for the MIDAS Support/Resistance curve to run in Metastock Pro on intradaily charts

As well as the above, users will also be prompted to supply an hour and a minute corresponding to an appropriate swing high or low.

{User defined input}

sm:=Input(”starting month”,1,12,1);

sd:=Input(”starting day of month”,1,31,1);

sy:=Input(”starting year”,1980,2100,2000);

sh:=Input(”hour”, 1,24,1);

se:=Input(”minute”,0,60,0);

start:= sd=DayOfMonth() AND sm=Month() AND sy=Year() AND sh=Hour() AND se=Minute();

{mid price}

pv:=MP()*V;

{Midas calculation}

denom:= If(Cum(V)-ValueWhen(1,start,Cum(V))=0,1,Cum(V)-ValueWhen(1,start,Cum(V)));

If(BarsSince(start),(Cum(pv)-ValueWhen(1,start,Cum(pv)))/ denom,MP())

.

- Problems in implementing this code in Metastock and Metastock Pro should be addressed to Andrew Coles. He is not able to help with the coding in other platforms.

Post to Twitter Tweet This Post

Print
6 visitors online now
6 guests, 0 members
Max visitors today: 6 at 03:28 am UTC
This month: 20 at 07-27-2010 07:13 am UTC
This year: 35 at 05-31-2010 08:28 pm UTC
All time: 123 at 11-07-2009 12:04 am UTC