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

Notification

Icon
Error

Options
Go to last post Go to first unread
a26174980  
#1 Posted : Saturday, November 3, 2012 3:30:25 AM(UTC)
a26174980

Rank: Member

Groups: Registered, Registered Users
Joined: 11/2/2012(UTC)
Posts: 15

for examples, if(c>prev,100,150) what is the initial value of PREV? another example, abc:=prev+1 what is the initial value of PREV?
jjstein  
#2 Posted : Saturday, November 3, 2012 10:44:54 AM(UTC)
jjstein

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 5/13/2005(UTC)
Posts: 715
Location: Midwest, USA

Was thanked: 1 time(s) in 1 post(s)
N/A
a26174980  
#3 Posted : Sunday, November 4, 2012 8:31:46 PM(UTC)
a26174980

Rank: Member

Groups: Registered, Registered Users
Joined: 11/2/2012(UTC)
Posts: 15

in if(c>prev,100,150) what C>prev will return? TRUE or FALSE? and what if(c>prev,100,150) will return? 100 or 150?
jjstein  
#4 Posted : Sunday, November 4, 2012 8:54:52 PM(UTC)
jjstein

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 5/13/2005(UTC)
Posts: 715
Location: Midwest, USA

Was thanked: 1 time(s) in 1 post(s)
It will return TRUE or FALSE, unless PREV is N/A, which is similar to the Excel NA() function, meaning "no value available". After the first bar, it will return 100 or 150, depending on the CLOSE price. Try this: Create and Indicator "if(c>prev,100,150) " and plot it. Then use the menu command VIEW, DATA WINDOW. Scroll all the way to the left, and move your mouse pointer to the first bar. In the Data Window, you will see the Indicator value, just as MetaStock sees them. At the extreme left, it will be "N/A".
wabbit  
#5 Posted : Sunday, November 4, 2012 8:56:04 PM(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)
Try plotting your indicator on the chart yourself.

See that on the first bar, the indicator returns N/A because there is no previous value in the self-data array.
On the second bar, the value will be FALSE (150) because of the comparison between price and N/A
Thereafter, it depends on the comparison between price and the previous value of the self-data array.

What are you trying to achieve? Be specific.


wabbit [:D]

[edit]and by doing the experiment you find out more... the value of the second bar is dependent on the test on the first bar which happens, but N/A is still returned?!

a26174980  
#6 Posted : Sunday, November 4, 2012 11:01:22 PM(UTC)
a26174980

Rank: Member

Groups: Registered, Registered Users
Joined: 11/2/2012(UTC)
Posts: 15

understood !! thank you guys so much!!
mstt  
#7 Posted : Monday, November 5, 2012 2:41:43 AM(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)

PREV assumes that an N/A value is zero or FALSE and will build on that from the first valid bar.

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.