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

Notification

Icon
Error

Options
Go to last post Go to first unread
kalyan  
#1 Posted : Tuesday, July 27, 2010 9:20:17 AM(UTC)
kalyan

Rank: Member

Groups: Registered, Registered Users
Joined: 12/21/2009(UTC)
Posts: 10

Hi, I would like to pass variables instead of constants for box size in P&F for my testing in the ExtFml("PointFig.pointfig",.....) function. Ideas are welcome. thanks -kalyan
mstt  
#2 Posted : Tuesday, July 27, 2010 1:44:51 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 Kalyan

Use this expression as your constant.

LastValue(MyVariable+PREV-PREV), or the slightly shorter and slightly slower version

LastValue(MyVariable+PREV*0).

Roy

kalyan  
#3 Posted : Tuesday, July 27, 2010 10:55:45 PM(UTC)
kalyan

Rank: Member

Groups: Registered, Registered Users
Joined: 12/21/2009(UTC)
Posts: 10

Roy, Thanks a ton, works fine. As I assumed due to "PREV" the explorations are slow but it is ok. Thanks again -kalyan
kalyan  
#4 Posted : Wednesday, July 28, 2010 11:23:09 AM(UTC)
kalyan

Rank: Member

Groups: Registered, Registered Users
Joined: 12/21/2009(UTC)
Posts: 10

Roy, I tried passing lastvalue(fml(boxsize)), where I wrote the code for box size without the PREV functions and it works fine and fast. Any particular reason you suggested PREV Thanks -kalyan
mstt  
#5 Posted : Wednesday, July 28, 2010 1:51:41 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 Kalyan

LastValue() converts a variable into a constant. Unfortunately it also fulfills its primary purpose at the same time and returns just one (constant) value across all data. That's fine for an exploration where the last value is all that you're interested in, but it's not particularly helpful if used in an indicator, expert or system.

LastValue(MyVariable+PREV-PREV) is a curious mix of code that uses features of both LastValue() and PREV to create a variable that MetaStock will accept as a constant.

This curious mix is the same piece of code that Equis have used to create the MetaStock 11 adaptive functions. Unfortunately they used three times as many PREVs as really necessary making them very slow. There's also a problem where the values returned by the adaptive functions are "off" by a small amount every few bars. The March 2010 issue of MSTT has revised code for about 80% of those functions that eliminates PREV and the "off" values while speeding up execution.

Roy

kalyan  
#6 Posted : Wednesday, July 28, 2010 7:17:32 PM(UTC)
kalyan

Rank: Member

Groups: Registered, Registered Users
Joined: 12/21/2009(UTC)
Posts: 10

Hi roy Great input, I noticed the expert and there were changes if don't use the PREV, so I have modified experts and indicators to have PREV. I really appreciate your help. Thanks -kalyan
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.