Metastock to MT4 - page 6

 

MT4 indicator doesn't work

Hi,

mladen, thank you for your all help. I tested the lasted indicator you designed, but it doesn't work as it works in stock market. Never mind. Thank you for your time.

I tried to code another indicator of my own in MT4. With the help of your codes =) But, I cant understand why it doesnt work. Even a line doesnt seem on the graphic. Here is my codes. Where am I wrong?

#property indicator_separate_window

#property indicator_buffers 1

#property indicator_color1 Green

#property indicator_width1 2

#property indicator_level1 100

#property indicator_level2 120

extern int MAMethod = MODE_SMA;

extern int MAPrice = PRICE_CLOSE;

extern int MAPeriod1 = 2;

extern int MAPeriod2 = 19;

extern int MAPeriod3 = 15;

//---- buffers

double buffer1[];

double ma3;

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

//| Custom indicator initialization function |

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

int init()

{

SetIndexBuffer(0,buffer1);

//---- indicators

//----

return(0);

}

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

//| Custom indicator deinitialization function |

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

int deinit()

{

//----

//----

return(0);

}

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

//| Custom indicator iteration function |

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

int start()

{

int counted_bars=IndicatorCounted();

int i,r,limit;

if(counted_bars<0) return(-1);

if(counted_bars>0) counted_bars--;

limit = MathMin(Bars-counted_bars,Bars-1);

for(i=limit; i>=0; i--)

{

double ma1 = iMA(NULL,0,MAPeriod1 ,0,MAMethod,MAPrice,i);

double ma2 = iMA(NULL,0,MAPeriod2,0,MAMethod,MAPrice,i);

if(ma2 !=0)

{

double ma3 = ma1/ma2;

buffer1= iMA(NULL,0,MAPeriod3,0,MAMethod,ma3,i);

}

}

//----

//----

return(0);

}

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

 

indicator again

I partly have the indicator worked. But there is a little problem. I need to multiply some part with 100, but when I add 100 there, it again doesnt seem, the indicator disappears. Here is the code, and the number "100" where I add.

#property indicator_separate_window

#property indicator_buffers 1

#property indicator_color1 Green

#property indicator_width1 2

#property indicator_level1 100

#property indicator_level2 120

extern int MAMethod = MODE_SMA;

extern int MAPrice = PRICE_CLOSE;

extern int MAPeriod1 = 2;

extern int MAPeriod2 = 19;

extern int MAPeriod3 = 15;

//---- buffers

double buffer1[];

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

//| Custom indicator initialization function |

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

int init()

{

SetIndexBuffer(0,buffer1);

//---- indicators

//----

return(0);

}

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

//| Custom indicator deinitialization function |

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

int deinit()

{

//----

//----

return(0);

}

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

//| Custom indicator iteration function |

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

#define value 100

int start()

{

int counted_bars=IndicatorCounted();

int i,r,limit;

if(counted_bars<0) return(-1);

if(counted_bars>0) counted_bars--;

limit = MathMin(Bars-counted_bars,Bars-1);

for(i=limit; i>=0; i--)

{

double ma1 = iMA(NULL,0,MAPeriod1 ,0,MAMethod,MAPrice,i);

double ma2 = iMA(NULL,0,MAPeriod2,0,MAMethod,MAPrice,i);

if(ma2 !=0)

{

//I need ma1*100, but I dont know why it doesnt work.

double ma3 = (ma1*100)/ma2;

double ma4=iMA(NULL,0,MAPeriod3,0,MAMethod,ma3,i);

buffer1= ma4;

}

}

//----

//----

return(0);

}

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

 

Stop_Trail

Hi, guys:

I was just wondering if there are any one can transfer

the following Metastock code into MT4:

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

InpDay:=Input("Day",1,31,1);

InpYear:=Input("Year",1800,2050,2009);

LongShort:=Input("1=Long or 2=Short? ",1,2,1);

InitStop:=Input("Initial Stop Price",0.1,10000,10);

Perc:=Input("Trailing Stop Percentage",1,30,12);

Loss:=C*Perc/100;

Entry:= InpYear=Year() AND InpMonth=Month() AND InpDay=DayOfMonth();

EntryLock:=If(Ref(Entry,-1)=0 AND Entry=1,1,PREV);

support:=If(LongShort=1,C-loss,C+loss);

StopLong:= If(EntryLock=0 OR Entry=1,InitStop,

If(support>Ref(Support,-1),Max(support,PREV),PREV));

StopShort:= If(EntryLock=0 OR Entry=1,InitStop,

If(support>Ref(Support,-1),Min(support,PREV),PREV));

Trail:=If(LongShort=1,Stoplong,Stopshort);

Trail

thanks a lot in advance

 

Composite Momentum ...

I found this indicator for metastock....looks interesting....could anyone write it for metatrader4?

Thanks!

Key

FORMULA

MOM:=Mov((Mov(C,3,S)-Mov(C,9,S)),1,E) / Mov(C,3,S) *100;

Mov(

((Ref(Sum(If(MOM>Ref(MOM,-1),MOM-Ref(MOM,-1),0),5),-1)-

(Ref(Sum(If(MOM>Ref(MOM,-1),MOM-Ref(MOM,-1),0),5),-1)/5)+ If(MOM>Ref(MOM,-1),MOM-Ref(MOM,-1),0)) /

(Ref(Sum(Abs(MOM-Ref(MOM,-1)),5),-1) -

(Ref(Sum(Abs(MOM-Ref(MOM,-1)),5),-1)/5) + Abs(MOM-Ref(MOM,-1)))*100) -

Abs(

((Ref(Sum(If(MOM<Ref(MOM,-1),MOM-Ref(MOM,-1),0),5),-1)-

(Ref(Sum(If(MOM<Ref(MOM,-1),MOM-Ref(MOM,-1),0),5),-1)/5)+ If(MOM<Ref(MOM,-1),MOM-Ref(MOM,-1),0)) /

(Ref(Sum(Abs(MOM-Ref(MOM,-1)),5),-1) -

(Ref(Sum(Abs(MOM-Ref(MOM,-1)),5),-1)/5) + Abs(MOM-Ref(MOM,-1)))*100))

, 3, E)

XTL quarterly expl

FORMULA

(Mov( Stoch(5,3),3,S))*2-100

Composite momentum

FORMULA

Mov((Fml( "Key") + Fml( "XTL quarterly expl"))/2,2,W)

 

Yo MetastockTrader,

"Mov((Fml( "Key") + Fml( "XTL quarterly expl"))/2,2,W

This function is calling external library / function in metastock which you cannot open and see what it is.

(Usually it means it is something which actually working well in the market if it is hided).

For this reason I believe your code would not work in MT because you do not know what algo is hided behind of the key.

Kaori

 
kaori:
"Mov((Fml( "Key") + Fml( "XTL quarterly expl"))/2,2,W

This function is calling external library / function in metastock which you cannot open and see what it is.

(Usually it means it is something which actually working well in the market if it is hided).

For this reason I believe your code would not work in MT because you do not know what algo is hided behind of the key.

Kaori

Sorry...but...is this not the algo hide behind the key?!?!

XTL quarterly expl

FORMULA

(Mov( Stoch(5,3),3,S))*2-100

 
 

MetaServerRt

Please help...

Haw can i import on offline mode in Metastock datafeed from mt4 step by step.

Is there any indicator for this stuff?

I have trying MetaserverRt but no succesfull.Is there a manual to import data from MT4 to Metastock ??

Please Help....

 

Beta Coefficient---Metastock->Mt4

This is the Beta Coefficient s code write in metastock language, can anyone code it in mt4, please??

Prd:=14;

( ( Prd * Sum( ROC( CLOSE ,1 ,% ) * ROC( P ,1 ,% ) ,Prd ) ) -

( Sum( ROC( CLOSE ,1 ,% ) ,Prd) * Sum( ROC( P ,1 ,% ) ,Prd ) ) ) /

( (Prd * Sum( Pwr( ROC( P ,1 ,% ) ,2 ) ,Prd )) - Pwr( Sum( ROC( P ,1 ,% ) ,Prd ) ,2 ))

Thank s in advance

 

How to convert a MT4 formula to Metastock one

Thanks..

Files:
ultra_trend.mq4  26 kb
Reason: