Metastock to MT4 - page 4

 

thanx a million

that's exactly what I was looking for.

It's the formula for the Composite Index. I don't know if you have seen the cover of the book "Technical Analysis for the Trading Professional" by Constance Brown, but that is exactly the indicator that appears beneath RSI(14) on the cover of that book.

I stumbled on that formula in another book but I was never able to find it anywhere on the net. How did you find it?

d3cart3s

 
d3scart3s:
that's exactly what I was looking for.

It's the formula for the Composite Index. I don't know if you have seen the cover of the book "Technical Analysis for the Trading Professional" by Constance Brown, but that is exactly the indicator that appears beneath RSI(14) on the cover of that book.

I saw it only after your mention. Looks fine indeed.Maybe it's better to name it CI instead of RSI_Turn.

What I want for you to check if the values of indicator matches your Excel file.

I stumbled on that formula in another book but I was never able to find it anywhere on the net. How did you find it?

d3cart3s

I didn't find it on the net, the indicator was written (based on your formula) on a launch break.

All the best,

 

Could you please convert this mt4 code to metastock code?

//+-------------------------------+

//| HMA.mq4

//| Copyright ฉ 2006 WizardSerg , ?? ??????? ForexMagazine #104

//| wizardserg@mail.ru

//| Revised by IgorAD,igorad2003@yahoo.co.uk |

//| Personalized by iGoR AKA FXiGoR for the Trend Slope Trading method (T_S_T)

//| Link:

//| contact: thefuturemaster@hotmail.com

//+----------------------------------+

#property copyright "MT4 release WizardSerg , ?? ??????? ForexMagazine #104"

#property link "wizardserg@mail.ru"

#property indicator_chart_window

#property indicator_buffers 2

#property indicator_color1 Aqua

#property indicator_color2 Red

//---- input parameters

extern int period=80;

extern int method=3; // MODE_SMA

extern int price=0; // PRICE_CLOSE

//---- buffers

double Uptrend[];

double Dntrend[];

double ExtMapBuffer[];

//+-----------------------------------------+

//| Custom indicator initialization function |

//+-----------------------------------------+

int init()

{

IndicatorBuffers(3);

SetIndexBuffer(0, Uptrend);

//ArraySetAsSeries(Uptrend, true);

SetIndexBuffer(1, Dntrend);

//ArraySetAsSeries(Dntrend, true);

SetIndexBuffer(2, ExtMapBuffer);

ArraySetAsSeries(ExtMapBuffer, true);

SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,1);

SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,1);

IndicatorShortName("Slope Direction Line("+period+")");

return(0);

}

//+---------------------------------------------+

//| Custor indicator deinitialization function |

//+---------------------------------------------+

int deinit()

{

// ???? ????? ?????? ??????

return(0);

}

//+--------------------------------------+

//| ?????????? ??????? |

//+--------------------------------------+

double WMA(int x, int p)

{

return(iMA(NULL, 0, p, 0, method, price, x));

}

//+-------------------------------------------+

//| Custom indicator iteration function |

//+-------------------------------------------+

int start()

{

int counted_bars = IndicatorCounted();

if(counted_bars < 0)

return(-1);

int x = 0;

int p = MathSqrt(period);

int e = Bars - counted_bars + period + 1;

double vect[], trend[];

if(e > Bars)

e = Bars;

ArrayResize(vect, e);

ArraySetAsSeries(vect, true);

ArrayResize(trend, e);

ArraySetAsSeries(trend, true);

for(x = 0; x < e; x++)

{

vect[x] = 2*WMA(x, period/2) - WMA(x, period);

// Print("Bar date/time: ", TimeToStr(Time[x]), " close: ", Close[x], " vect[", x, "] = ", vect[x], " 2*WMA(p/2) = ", 2*WMA(x, period/2), " WMA(p) = ", WMA(x, period));

}

for(x = 0; x < e-period; x++)

ExtMapBuffer[x] = iMAOnArray(vect, 0, p, 0, method, x);

for(x = e-period; x >= 0; x--)

{

trend[x] = trend[x+1];

if (ExtMapBuffer[x]> ExtMapBuffer[x+1]) trend[x] =1;

if (ExtMapBuffer[x]< ExtMapBuffer[x+1]) trend[x] =-1;

if (trend[x]>0)

{ Uptrend[x] = ExtMapBuffer[x];

if (trend[x+1]<0) Uptrend[x+1]=ExtMapBuffer[x+1];

Dntrend[x] = EMPTY_VALUE;

}

else

if (trend[x]<0)

{

Dntrend[x] = ExtMapBuffer[x];

if (trend[x+1]>0) Dntrend[x+1]=ExtMapBuffer[x+1];

Uptrend[x] = EMPTY_VALUE;

}

//Print( " trend=",trend[x]);

}

return(0);

}

//+------------------------------------+

 

And could you please convert this metastock code to mt4 code?

Upper:=Mov(C,20,E);

Lower:=Mov(C,21,E);

Upper;Lower;

Buy := Cross(Upper, Lower);

Sell := Cross(Lower,Upper);

Bullish := BarsSince(Buy) < BarsSince(Sell);

Bearish := BarsSince(Buy) > BarsSince(Sell);

 

InToom,

The code from your post #34 is the Hull moving average and meatastock code of it is like this (without color coding)

period:=Input("period",1,200,20);

sqrtperiod:=Sqrt(period);

Mov(2*Mov(C,period/2,W)-Mov(C,period,W),LastValue(sqrtperiod),W);

Metastock code on the other hand is a system of 2 EMAs. Use MACD(20,21,1) and than the Buy and Sell signals would be when MACD line cross 0 line.

EAs coded for something similar are also numerous (one of them, the MACD sample comes with any metatrader installation, so it is available on any metatrader platform. It is coded for 12,26,9 MACD settings, but it is not difficult at all to change those)

 

Thank you very much mladen.

 

Could you please convert this Metastock code to MT4 code?

Bull Power UP signal with 13-period exponential moving average

a:=(H-Mov(C,13,E))>0-(L-Mov(C,13,E));

b:=(L-Mov(C,13,E))<0-(H-Mov(C,13,E));

state:=If(BarsSince(a)<BarsSince(b),1,0);

state>Ref(state,-1)

 
 

someone please convert this formula in mt4

D:=Input("Day of month",1,31,1);

M:=Input("Month",1,12,1);

Y:=Input("Year",1900,2100,2008);

wavelength:=250;

{bars}

start:=Cum(

(DayOfMonth()>=D AND Month()=M AND Year()=Y) OR

(Month()>M AND Year()=Y) OR

Year()>Y)=1;

start:=LastValue(ValueWhen(1,start,Cum(1 )));

{x axis values}

x:=360/wavelength * (Cum(1)-start);

{sine waves}

phase:=-90;

60DAY:=2*Sin(4*x+phase);

30DAY:=1*Sin(8*x+phase);

16DAY:=0.5*Sin(16*x+phase);

8DAY:=0.25*Sin(32*x+phase);

BTLP:=60DAY+30DAY+16DAY+8DAY;

BTLP;

 
Reason: