logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
Derek Worswick  
#1 Posted : Wednesday, July 25, 2007 3:47:48 AM(UTC)
Derek Worswick

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 8/11/2005(UTC)
Posts: 104

Hi,

Could you tell me how to write a MetaStock “LOOP” formula?
-------------------------------------------------------
Beginning at periods=6
  to periods=50
tx:=360*X*periods;
cosinepart:=sum(cleandata*cos(tx),50);
 sinpart:=sum(cleandata*sin(tx),50);
pr:=(power(cosinepart,2))+(power(sinpart,2));
Maxpr:=Max(Maxpr,pr);
 ----------------------------------------------------------------
{How do I then set up the value of dynamic variable “pr”
Is the formula below suitable?
How do I then put “pr” in a data Array for the Variable Period?}
ExtFml( "ForumDll.VarREF", Data Array, Variable Period)
-----------------------------------------------------------------
 Best Regards.
 Derek
wabbit  
#2 Posted : Wednesday, July 25, 2007 4:55:41 AM(UTC)
wabbit

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 10/28/2004(UTC)
Posts: 3,111
Location: Perth, Western Australia

Was thanked: 16 time(s) in 16 post(s)
Derek,

There is no looping function in the MetaStock Formula language. To compute the DFT you will need to use the MetaStock Developers Kit and another programming language to write this as an addin.


wabbit [:D]



Jose  
#3 Posted : Wednesday, July 25, 2007 6:45:06 PM(UTC)
Jose

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 1/19/2005(UTC)
Posts: 1,065
Location: Koh Pha-Ngan, Earth

Was thanked: 2 time(s) in 2 post(s)
Derek Worswick wrote:
pr:=(power(cosinepart,2))+(power(sinpart,2)); How do I then set up the value of dynamic variable “pr”
========== Power - variable ==========
{ Power(DataArray,VariablePower) MS function. With thanks to MG Ferreira. http://www.metastocktools.com } { Data array } DataArray:=C; { Variable Power example } VariablePower:=DataArray/Mov(DataArray,63,S); { Power(DataArray,VariablePower) equivalent } VarPower:=Exp(Log(DataArray)*VariablePower); { Output } VarPower
jose '-)
Derek Worswick  
#4 Posted : Thursday, July 26, 2007 3:16:10 AM(UTC)
Derek Worswick

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 8/11/2005(UTC)
Posts: 104

Hi,

Thank you for your replies on the question of a MetaStock “LOOP” Formula.

Best regards,

Derek

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.