[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] referring to a future date



PureBytes Links

Trading Reference Links

If I wanted to compare a future date (has not occurred yet) that I have stored in a file and see if its < 15 days from the last bar (today) and return true if that were the case or false if not, how would I do that???
 

odbcOpenDatabase("DSN=Fin");
AB=
CreateObject("Broker.Application");
temp = odbcGetArraySQL("select case timeofday when 'B' then 1 when 'A' then 1 when 'D' then 1 when 'U' then 1 else 0 end,Date from epsreportdates where symbol='"+Name()+"'");
temp =
IIf(temp ==1 AND IsNull(Ref(temp,-1)),1,0);
temp2 =
odbcGetArraySQL("select date,Date from epsreportdates where symbol='"+Name()+"'");

y = LastValue(Year());
m =
LastValue(Month());
d =
LastValue(Day());
Ld = y *
10000 + m * 100 + d;
printf("\n y = "+y);printf("\n m = "+m);printf("\n d = "+d);
printf("\n ld = "+WriteVal(Ld,1.0));

ry =
LastValue(ValueWhen(temp,Year()));
rm =
LastValue(ValueWhen(temp,Month()));
rd =
LastValue(ValueWhen(temp,Day()));
rLd = ry *
10000 + rm * 100 + rd;
printf("\n\n ry = "+ry);printf("\n rm = "+rm);printf("\n rd = "+rd);
printf("\n rld = "+WriteVal(rLd,1.0));

dif = Ld - rld;
printf("\n\n dif = "+dif);
printf("\n temp2 = "+WriteVal(temp2,1.0));

I was hoping that  dif would be something like 15 if temp2 were 15 days in the future, but I'm not getting that.  I think its because there are no bars out there.  I'm sure there's an easier way than this path I'm headed down.

__._,_.___

Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html




Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___