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

Notification

Icon
Error

Options
Go to last post Go to first unread
pepsi1834@hotmail.com  
#1 Posted : Sunday, May 24, 2015 2:57:56 PM(UTC)
pepsi1834@hotmail.com

Rank: Newbie

Groups: Registered Users, Subscribers, Unverified Users
Joined: 5/23/2015(UTC)
Posts: 2

In MetaStock language, can we use the FOR() loop?

 

 

mstt  
#2 Posted : Sunday, May 24, 2015 9:47:19 PM(UTC)
mstt

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 7/25/2005(UTC)
Posts: 1,042

Was thanked: 57 time(s) in 54 post(s)
Hi pepsi The short answer is NO. The MetaStock Formula Language is a purely sequential language. The nearest you can get to a Loop/Branch/Jump is to use the PREV function. PREV simply means "the previous bar's value of this variable". PREV is a resource-hungry function so should not be used lightly. Sadly there are times when there is no alternative to using it. On a brighter note, from time to time you'll come across code that uses PREV unnecessarily. The example below creates 3 variants a Heikin-Ashi OPEN, the lat two demonstrating that PREV is not needed. {Heikin-Ashi OPEN} HaClose:=(O+H+L+C) / 4; HaOpen:=(Ref((O+H+L+C)/4,-1)+PREV) / 2; HaOpen; HaOpen:=Mov(Ref(HaClose,-1),3, E); HaOpen; HaOpen:=Wilders(Ref(HaClose,-1),2); HaOpen; Roy
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.