Discussions
»
Product and Service Development
»
MetaStock
»
what is the initial value of function PREV?
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?
|
|
|
|
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)
|
|
|
|
|
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?
|
|
|
|
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".
|
|
|
|
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?!
|
|
|
|
Rank: Member
Groups: Registered, Registered Users Joined: 11/2/2012(UTC) Posts: 15
|
understood !!
thank you guys so much!!
|
|
|
|
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)
|
Discussions
»
Product and Service Development
»
MetaStock
»
what is the initial value of function PREV?
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.