// Would the following be doable?
// I didn't test out this code but this is the idea:
EarningsYield = ToUSD(GetSeries("mstar", "eps ttm"), GetSeries("mstar", eps currency")) / ToUSD(Close, Currency);
and the custom function ToUSD
Is the following code in the nearly correct to get fx data?
VectorCustomDouble FX_Rates = cFunctions.GetTimeframeData("USD" + FromCurrency, "daily", "close");
What is the second parameter really supposed to be (I know, it is supposed to be a number not a string, but what number)?
What is the difference between cFunctions.GetTimeframeData() and cFunctions.GetTimeframeRawData()?
I am trying to convert fundamental data from another currency to the USD. I plan to use this together with the Morningstar downloader for international stocks. For my non-US list of stocks Morningstar has many with a EPS currency different than the trading currency. One way to measure the earnings yield properly is by converting the price and EPS to USD before building the ratio. Something like this:
Putting together the documentation from the Script Help which states:
cFunctions.GetTimeframeData(symbol String, timeframe Int32, close, open, high, low, volume or openint String) returns VectorCustomDouble.
and from the intellisense which states:
cFunctions.GetTimeframeData(String symbol, Int32 timeframe, String arrayType)
Param 1: symbol
Param 2: timeframe
Param 3: close, open, high, low, volume or openint
I understand what Param 1 is and what param 3 is but what is Param 2? What are the choices and what does it mean? Can you write an example?
The second parameter is the time frame.
If you are applying the function in a daily system and you want to get weekly data, type:
VectorD v = cFunctions.GetTimeframeData("Symbol", 7, "close").ToVectorD();
If in a 60-min chart/system you want to get daily data:
VectorD v = cFunctions.GetTimeframeData("Symbol", -1, "close").ToVectorD(); // Negative value to get EOD time frame in an intraday time frame
Trading financial instruments, including foreign exchange on margin, carries a high level of risk and is not suitable for all investors. The high degree of leverage can work against you as well as for you. Before deciding to invest in financial instruments or foreign exchange you should carefully consider your investment objectives, level of experience, and risk appetite. The possibility exists that you could sustain a loss of some or all of your initial investment and therefore you should not invest money that you cannot afford to lose. You should be aware of all the risks associated with trading and seek advice from an independent financial advisor if you have any doubts.