Click here to Login

                                                   How to read date and get quote of next day.


Ulrich Proeller
2017-03-02 05:54:11


I am trying to write a screener script, in which I read the date of the last earnings report from the custom "earnings_cal" table.
I tried this code:
earnDate = GetDataString('earnings_cal', 'timeday', '');
AddColumn("earn Date", earndate);

However, the column remains empty.
What am I doing wrong?

Then, I want to get the quote of that date. So, I have to convert the date in a number of bars.
How can I do this?

Thank You!

2017-03-03 04:25:09


If the column remains empty then this means that you have no "timeday" value on the analyzed date.
The "GetDataString" gets the value of the database field on the analyzed date.

Here is what you need to do:
a = StringLength(GetDataString("earnings_cal", "timeday", "")) > 0;
b = valuewhen(a, close);
AddColumn("Earnings Close", b);

No more messages


No html code. URLs turn into links automatically.

Type in the trading objects you want to include: - Add Objects
To add a trading object in your message, type in the object name, select it and then click on "Add Objects"


Trading Items
Days To Next Date
Equity and Date Export To Excel
iShares ETFs - Class, Total Net Assets, Inception Date and Number...
Historical Earnings Surprise, EPS and Consensus Data
Historical Earnings Calendar Data for U.S. Stocks - Date/Time and...

How-to Lessons
How to download and use U.S. stocks earnings data
How to backup your databases (EOD, Intraday, Tick and Custom) and...
How to get fundamental data for U.S. Stocks
How to create and trade a Neural Network model
How to plot support and resistance lines automatically

Related Forum Threads
How to query quote database and bin symbols by some attribute
How to get the last day of the month in C#
How do I get the date of the current bar in a custom function?
How to download a item that need a user and password
How to browse and search the blog?

Blog Posts
How to get buy and sell orders for a portfolio based on a trading...
Step by step on how to get free realtime/delayed data for stocks,...
How to create buy and sell trading rules based on News Data
How To Create and Backtest an S&P 500 Trend Following System
How to build and backtest a robust stock trading system

Create an account
Affiliate Program
Contact Us
Trading Forum
How-to Lessons
About Us
Terms of Use

Copyright 2021
Social Media
Follow us on Facebook
Twitter Follow us on Twitter
Follow us on Google+
RSS Trading Items

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.