Originally Posted by: maeday I am currently struggling to master MS15 after my horific discovery of not being able to reinstall my beloved MS11 onto a new computer. I used to be able to plot a yes/no custom indicator that showed whether an index (the XAO) was trading with the 10Emav above or below its 30Emav using the formula:
Security("C:\Shares\ASX\Indices\XAO", Mov(C ,10 ,E) < Mov(C ,30 ,E ) )
I work off-line using local data and "C:\Shares\ASX\Indices\XAO" was, and still is, the path to where my XAO data was held, however MS15 now returns the error message "Error for receiving data for secutity()function. No error Symbol XAO"
The MS help section in MS15 gives as an example: Security("ONLINE:MSFT",Mov(C,30,S)) which is the same example given in the old MS11 manual. It looks to me as though I am using the correct format but I'm guessing something has changed with MS15 and that I now have to add something else to pick up the off-line data. Any help would be much appreciated.
Hi,
The security function has gone through various changes since version 11. In version 12, Local functionality was stripped from the function - making it so that all security function calls were treated as online calls (even if a path was defined).
As we have been adding local support back to MetaStock, we have revisited the Security function, adding back functionality that was removed but also expanding the functionality to support the new Local data types.
The Help file should discuss the various ways the Security function can be used.
SYNTAX
security("SYMBOL",DATA ARRAY)
FUNCTION
Returns the value of DATA ARRAY for the specified instrument. The referenced instrument cannot be a CSV or TXT data file.
Four different tags can be put before the SYMBOL to designate the data format of the instrument: BASE, ONLINE, LEGACY, MSLOCAL.
BASE: indicates the base instrument's data source is to be used. If the base instrument is from online data, the function will also access online data. If the base instrument is a local instrument (either legacy or MS local) the security data function will use the same path. A security function without a tag or a path implies BASE. Note: if the base instrument is a CSV or TXT file, using the BASE tag will be undefined.
ONLINE: indicates the instrument is to be requested as an online instrument. Note: It is not valid to include a path with the ONLINE tag.
LEGACY: indicates the symbol is a local instrument in the old MetaStock data format. A data path by itself is presumed to be a reference to a legacy data file. Note: Use of the LEGACY tag without a path will only be defined if both the base instrument and the referenced instrument are legacy data files and both are in the same data folder.
MSLOCAL: indicates the symbol is a local instrument in the new MS Local format. Note: Use of the MSLOCAL tag without a path will only be defined if both the base instrument and the referenced instrument are MS local data files and both are in the same data repository.
EXAMPLES
Using BASE
Security("BASE:IBM",C)
Security("IBM", C)
Using ONLINE
Security("ONLINE:IBM",C)
Using LEGACY
Security("LEGACY:C:\MetaStock Data\My Stocks\IBM",C)
Security("C:\MetaStock Data\My Stocks\IBM",C)
Security("LEGACY:IBM",C)
Using MSLOCAL
Security("MSLOCAL:C:\MetaStock Local Data\Watchlist\IBM",C)
Security("MSLOCAL:IBM",C)
What I would suggest is adding the Legacy prefix to the Security function in the manner of the example above: Security("Legacy:C:\Shares\ASX\Indices\XAO", Mov(C ,10 ,E) < Mov(C ,30 ,E ) )
If you let the Security function assume "Base" it attempts to look for a security in the same format as the base security. So if you had some data stored in the MSLocal format and attempted to insert your Security function into the chart as an indicator, it would likely fail as it would be looking for MSLocal data in the path above vs. the Legacy (MSFL) formatted data.
It could possibly be failing for other reasons, but I would rule out these potential issues first. In theory, the data path alone should cause the formula to assume Legacy but it would be good to rule this out by explicitly specifying Legacy. Another test would be to simply add the Data folder as a Local list and see if you are able to open the instrument (XAO) that directly as a chart.
Edited by user Thursday, August 3, 2017 4:07:59 PM(UTC)
| Reason: Not specified