How to date reference the symbols in options database.

Dear Group,

This refers to options database, wherein because of changes in price the strike prices change. As the strikes go deeply out of money the liquidity of options at those strikes squeezes. Finally this may lead to strikes being traded / no-traded on a daily basis (Trades somedays, Somedays not).

While running exploration, run on 1 last day/bar returns values of earlier days as well. The work around would be giving the "From-To" dates in parameter. However the same when run in "batch exploration" needs to be managed. The temporary turnaround was achieved through a filter:


startdate = ParamDate( "Start date", Now(0));
enddate = ParamDate( "End date", Now(0));
dn = datenum();
datewindow = dn >= startdate-3 AND dn <= enddate;
Filter = datewindow;

Now if I put "datewindow = dn >= startdate AND dn <= enddate;" the exploration runs only on single day that's today. That means the exploration remains void for tomorrow till the new datapoints are imported. Similarly issue arises on weekend, when data is for Friday & exploration is run on Sunday. Hence have put in "datewindow = dn >= startdate-3 AND dn <= enddate;".

On logical scale, I wish to a check to find last traded date of a reference symbol and then run the exploration through batch for that date.

Since you are using Daily bars, why don't you just try

recentDay = Day() == LastValue(Day());
Filter = recentDay;

Even Datenum() instead of Day() would make sure its the most recent bar for that symbol.

How do I reference it to a "Reference Symbol"

What do you mean by Reference it? Can you explain with an example?

Did you add the code and try running it atleast?

Dear Travick,

Did try it - with the following code:

QUOTE

recentDay = Day() == LastValue(Day());
datewindow = recentDay;

/*
startdate = ParamDate( "Start date", Now(0));
enddate = ParamDate( "End date", Now(0));
dn = datenum();
wd = DayOfWeek();
wdnum =LastValue(wd);
tuetosat = 0=6;
mon = wd==1;

datewindow = iif (tuetosat,dn >= startdate-1 AND dn <= enddate, dn>= startdate-3 AND dn <= enddate);
*/
UNQUOTE

and it puts through the last state of all the symbols

LastValue%2011

That's not what is required

Did you try with DateNum() ??

I added this option because I don't know if people will have multi month Date ranges.

You should read the posts attentively. I suggested the other option too.

recentDay = DateNum() == LastValue( Datenum() );
Filter = recentDay;

LastValue%2011

It's still the same.

I think logically DateNum of Reference symbol needs to be checked withe DateNum of each symbol

see this post if its what you mean.

If this is on a daily frequency, then another way I can think of is:

1 put all the symbols you want to check in a watchlist.
2 Use

StaticVarSetText( "LDate" + Name(), NumToStr( LastValue( DateNum()), 1, False ), True);

3 put this code in a new AFL and run exploration.
Our idea is to create static variables with each symbol containing Datenum() stored as string

4 then you can just use StaticVarGetText() to get Last DateNum of that symbol and use it.

All the standard disclaimers regarding Abuse of apply. Be careful. Persist is set to true.

Well the symbols too would change as they get added with fresh strikes opening UP with every passing day.

https://forum.amibroker.com/t/get-last-datetime-stamp-from-database/9194/16

Can "qt.Date" be checked as a string with the date of a symbol?

In the thread you referenced, I clearly stated that in v 6.30 (and above) qt.Date can be read as text (code was also given there). Note that follow-up questions to that thread should be posted in that thread, not here.

@pushkan It is very explicitly mentioned as TJ has said. You have to Read
After you read, test it yourself.
.
I've posted 5 replies here and a possible solution but there is no appreciation or Like in any post.