![]() |
|
| 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. ... |
|
|||||||
| Notices |
![]() |
|
|
Thread Tools |
| Sponsored Links |
|
#1
|
|||
|
|||
|
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. |
|
#2
|
|||
|
|||
|
Quote:
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. |
|
#3
|
|||
|
|||
|
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 |
|
#4
|
|||
|
|||
|
Quote:
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. |
|
#5
|
|||
|
|||
|
|
|
#6
|
|||
|
|||
|
Quote:
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 |
|
#7
|
|||
|
|||
|
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 |
|
#8
|
|||
|
|||
|
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. |
| Sponsored Links |
|
|
![]() |
| Bookmarks |
| Thread Tools | |
|
|
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 |
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.