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

[amibroker] Referencing an intraday time each day



PureBytes Links

Trading Reference Links

HI:  I want to capture the value of an index at noon each day and make
some calculation using that value for the rest of the day.

I used the following code but it does not work in that it does not
"reset" to the most recent day.  Addcolumn results show a constant
captured value for the value of "Val" (below) even when dates change.  I
thought the "1" in the ValueWhen function would capture value of C each
time it was noon, thus changing each day.

Can someone suggest a change or addition I need to make.

Thanks,

Ken

x=TimeNum()>120000;
Val=ValueWhen(TimeNum()==120000,C,1);
Diff = C-Val;
Y=IIf(x,Diff,0);
Color=IIf(Diff>0,5,4);
Plot(Y,"Diff Since 1130",Color,2);
Filter=1;Buy=0;
AddColumn(x,"Time>1130",1.0);
AddColumn(Val,"ValueWhen 1130",1.2);
AddColumn(Diff,"Diff C - Val",1.2);
AddColumn(Y,"if>1130 Diff",1.2);



Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/