Traderji.com - Discussion forum for Stocks Commodities & Forex

Metastock bug?

Discuss Metastock bug? at the MetaStock within the Traderji.com - Discussion forum for Stocks Commodities & Forex; Hi, I'm trying something with metastock and the results are not what i was expecting. ...


Go Back   Traderji.com - Discussion forum for Stocks Commodities & Forex > TOOLS & RESOURCES > Software > MetaStock

Notices


Advertise Here

Reply
 
Thread Tools
Sponsored Links
  #1  
Old 25th April 2007, 03:29 AM
Member
 
Join Date: Apr 2007
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
jmmac is on a distinguished road
Reputation: 20
Default Metastock bug?

Hi,

I'm trying something with metastock and the results are not what i was expecting. If you create an indicator with the following code:

a:=0;
a:= Ref(a,-1) + 1;
a;

You get a straight line with the value 1, and i was expecting a line with increasing values, +1 for each new bar. Do you know why this doesn't happen?

I'm using MS Pro 8.0.

Thank you,
Jaime.
Reply With Quote
  #2  
Old 25th April 2007, 12:50 PM
Member
 
Join Date: Sep 2006
Location: Chennai
Posts: 942
Thanks: 12
Thanked 42 Times in 34 Posts
oxusmorouz will become famous soon enoughoxusmorouz will become famous soon enough
Reputation: 118
Default Re: Metastock bug?

Quote:
Originally Posted by jmmac View Post
Hi,

I'm trying something with metastock and the results are not what i was expecting. If you create an indicator with the following code:

a:=0;
a:= Ref(a,-1) + 1;
a;

You get a straight line with the value 1, and i was expecting a line with increasing values, +1 for each new bar. Do you know why this doesn't happen?

I'm using MS Pro 8.0.

Thank you,
Jaime.
Hi Jamie,
For continuous adding, why don't you use "cum" function instead?

a:= Cum(1);
a;

As far as I can see, metastock does not recognize 2 variables with the same name and I guess is confused it,lol.


Oxymoron.

Last edited by oxusmorouz; 25th April 2007 at 01:14 PM.
Reply With Quote
  #3  
Old 25th April 2007, 02:55 PM
Member
 
Join Date: Apr 2007
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
jmmac is on a distinguished road
Reputation: 20
Default Re: Metastock bug?

Hi Oxymoron, thanks for the reply.

My goal isn't really continuous adding, i just simplified my script to post the issue, i cannot use Cum()...

Jaime
Reply With Quote
  #4  
Old 25th April 2007, 03:03 PM
Member
 
Join Date: Sep 2006
Location: Chennai
Posts: 942
Thanks: 12
Thanked 42 Times in 34 Posts
oxusmorouz will become famous soon enoughoxusmorouz will become famous soon enough
Reputation: 118
Default Re: Metastock bug?

Quote:
Originally Posted by jmmac View Post
Hi Oxymoron, thanks for the reply.

My goal isn't really continuous adding, i just simplified my script to post the issue, i cannot use Cum()...

Jaime
Your formula:
a:=0;
a:= Ref(a,-1) + 1;
a;

When metastock reads this formula, I guess it uses the previous value of the 1st "a" variable in the reference function which remains constant at 0. This could explain why there is an error.
Try contacting Equis. Maybe they have a solution.
Reply With Quote
  #5  
Old 25th April 2007, 09:29 PM
Member
 
Join Date: Jul 2005
Posts: 106
Thanks: 1
Thanked 3 Times in 2 Posts
moneypick is on a distinguished road
Reputation: 26
Default Re: Metastock bug?

Hi jmmac,

Post your problem in the Equis forum-

http://forum.equis.com/forums/default.aspx
Reply With Quote
  #6  
Old 25th April 2007, 10:22 PM
Moderator
 
Join Date: Nov 2005
Posts: 9,401
Thanks: 571
Thanked 1,155 Times in 486 Posts
uasish has much to be proud ofuasish has much to be proud ofuasish has much to be proud ofuasish has much to be proud ofuasish has much to be proud ofuasish has much to be proud ofuasish has much to be proud ofuasish has much to be proud ofuasish has much to be proud of
Reputation: 1227
Default Re: Metastock bug?

Quote:
Originally Posted by jmmac View Post
Hi Oxymoron, thanks for the reply.

My goal isn't really continuous adding, i just simplified my script to post the issue, i cannot use Cum()...

Jaime

Jaime,

Until you clarify ( we are least interested in your code ,writing MS code for others for money is my past time ,but here in traderji,no question of money rather i have freely given my own codes here) ,all this to alley your worry,we will be unable to help you.

Asish
Reply With Quote
  #7  
Old 26th April 2007, 10:39 PM
Member
 
Join Date: Apr 2007
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
jmmac is on a distinguished road
Reputation: 20
Default Re: Metastock bug?

Oxymoron,

Its something like that, yes. But it's not the first value of “a” that is used. If you try this code:

a:=0;
a:=1;
a:=2;
a:= Ref(a,-1) + 1;
a;

MS will plot 3. MS Mysteries!


moneypick,
Maybe i'll try that forum even if it seem a little abandoned.
Thanks.


Asish,
Thank you for the reply.
I can tell you that i tried to translate a small program from wealth-lab developer to MS (for others benefit) and i was unable to do it. It seemed i had found a way but because of the issue mentioned, my idea isn't valid.
I need to refer to the past value of a variable and i cannot for reasons i don’t understand. I don't understand why the code i showed doesn't plot an increasing line, why ref(a,-1) shows always the constant i first assign and not the value i assign later.
I have to assign a constant value first to initialize the vars, otherwise they remain forever NA.

Maybe version 9 or 10 behave in a different manner with this code?

Thank you and regards,
Jaime
Reply With Quote
  #8  
Old 27th April 2007, 12:23 AM
Member
 
Join Date: Apr 2007
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
jmmac is on a distinguished road
Reputation: 20
Default Re: Metastock bug?

I just read a message regading this issue in a different forum that may explain MS behaviour in this case. It seems that MS takes each line of script at a time and calculates in one go the values for all the bars, then takes the next line of script and does the same.

What i was expecting MS to do was calculate all the lines of the script for one bar, then advance to the next bar and calculate all the values again, and so on for every bar.

The results are different for each algorithm. In the example i gave, MS will calculate "a:=0;" for all the bars, then calculate "a:=ref(a,-1); +1" for all the bars and when ref(a,-1) is called, the value returned is always 0.

I'm not sure i was able to explain correctly.
Thank you all for the help.

Regards,
Jaime.
Reply With Quote
Sponsored Links

Reply

Bookmarks


Advertise Here


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads for: Metastock bug?
Thread Thread Starter Forum Replies Last Post
metastock r_sajnani MetaStock 15 15th August 2007 02:12 PM
eod for metastock fantastic MetaStock 2 29th July 2007 08:21 AM
metastock help? shorttermer MetaStock 10 16th July 2007 10:37 PM
metastock butta_trader MetaStock 1 16th June 2005 06:03 PM


All times are GMT +5.5. The time now is 09:57 AM.

Indemnity, Disclaimer & Disclosure Notice:
• By visiting Traderji.com you indicate your acceptance of our Forum Rules Disclaimer & Disclosure and indemnify Traderji.com, its associates and related parties of all claims howsoever resulting from the usage of the forum.
Disclaimer: Trading or investing in stocks & commodities is a high risk activity. Any action you choose to take in the markets is totally your own responsibility. Traderji.com will not be liable for any, direct or indirect, consequential or incidental damages or loss arising out of the use of this information.
Disclosure: The information in this forum is neither an offer to sell nor solicitation to buy any of the securities mentioned herein. The writers may or may not be trading in the securities mentioned.
• All names or products mentioned are trademarks or registered trademarks of their respective owners.
General Content Disclaimer Notice:
In light of our policy of encouraging candid, open exchanges of views and the rapid distribution of information originating from many sources, Traderji.com cannot determine the accuracy of information that may be uploaded to the forum. Opinions, advice and all other information expressed by participants in discussions are those of the author. You rely on such information at your own risk. You are urged to seek professional advice for specific, individual situations and not rely solely on advice or opinions given in the discussions. Since Traderji.com is an open and free discussion forum, any comments made by members of this forum in their posts reflect their own views and not of the owner or administrator of Traderji.com. Thus the owner/administrator indemnify themselves of all claims whatsoever and will not be liable or responsible for any members comments/views in this forum Traderji.com. If you find any objectionable or offensive posts made by members of this forum which you would like to bring to our notice for removal then please Contact Us.
 


Copyright © 2001 - 2008, Traderji.com All Rights Reserved.

Recommended Websites - www.TradersEdgeIndia.com - www.TradingPicks.com - www.MasterOfTrading.com