Rank: Newbie
Groups: Registered, Registered Users, Subscribers Joined: 2/25/2010(UTC) Posts: 6
|
Hi all new in the forum.
learning metastock :) let say I want to wirte a code like this ;
x:=C-Mov(C,1,e);
y:=Mov(x,2,e);
but instead of those MA, If I prefer to use Hullma how can I put in such this code?
x:=c-fml("hulma1")
y:= ?????
Jamal
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 10/26/2009(UTC) Posts: 76 Location: Toronto, Canada
|
Hi,
I'm not quite familiar with the formula for Hull MA, but when you go to your indicator builder copy it, paste it to a new indicator just replace all the values of the Closing price,or whatever price it uses within the formula,with x(which is C-fml("hulma1").
( I guess if that's not what your looking for maybe you could post the code for Hull MA and it will be more clear).
Cheers,
VT
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 10/26/2009(UTC) Posts: 76 Location: Toronto, Canada
|
OK I just got the formula for HMA. Here is the Code... Hope this is what you are looking for. Input this in your indicator builder.
{HMA}
Prd:= Input("Input Period in Hull MA",1,9999,20);
sqrtprd:= Input("Calculate Sqrt of MA lenght and Input the integer",1,9999,20);
WMA1:= Mov(C,prd/2,W);
WMA2:= Mov(C,prd,W);
Diff:= 2*WMA1 - WMA2;
HMA:= Mov(diff,sqrtprd,W);
{Custom Indicator}
x:= C - HMA;
NWMA1:= Mov(x,prd/2,W);
NWMA2:= Mov(x,prd,W);
NDiff:= 2*NWMA1 - NWMA2;
NHMA:= Mov(ndiff,sqrtprd,W);
NHMA;
//Keep in mind that whenever you input the periods you will have to manually calculate the square root of the periods because metastock does not allow to input non constant data in the periods space (e.i. take your calculator and square root the number you input into periods and put in that number in the Input for "Square root" periods)
|
|
|
|
Rank: Newbie
Groups: Registered, Registered Users, Subscribers Joined: 2/25/2010(UTC) Posts: 6
|
Thanks VT,
but its not about hullma, I just use it in post just for example, its about any custom indicator which is loook like MA that you create and used in code .. To be more clear;
lets say I have multi-time frame MA indicator I arrange its period and etcc.. and add to ind. builder with the name of multi and multi2... becasue its like a MA I want to use in any alghoritm.
x:=C-Mov(C,1,e); y:=Mov(x,2,e);
its just for example above I use 1 and 2 ema in code but I prefered to use Multi indicator so I make two copy anda arrange period to 1 and 2 after that I want use in code instead of ema
x:=c-fml("multi ") y:= ????? ------- y:= (x,2,fml("multi2")...?? absoulately wrong
x is ok may be it is not I do not know realy but I do not able to make y..
Jamal
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Unverified Users Joined: 9/13/2004(UTC) Posts: 673 Location: Salt Lake City, UT
|
FML does not work that way (in your Y example, X is fine). You do not get to specify the syntax of an FML call. FML simply calls the value of the other formula. You are trying to use FML like you are calling a function, but you are really just calling the value of that function.
|
|
|
|
Users browsing this topic |
Guest (Hidden)
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.