PureBytes Links
Trading Reference Links
|
Not sure what you are actually trying to find. But here is
the code I have for weekly chart in daily window. I only go from Monday to
Friday, or if the Monday is non trading day then Tuesday open is week open etc
<font size=2 color=green
face="Courier New">//weekly chart to be placed in indicator window with daily setting
<font size=2 color=black
face="Courier New">
<font size=2 color=black
face="Courier New">firstday = <span
lang=EN-AU >ValueWhen<font
color=black face="Courier New">( <span
lang=EN-AU >Cum<font
color=black face="Courier New">(<span
lang=EN-AU >1<font
color=black face="Courier New">)==<span
lang=EN-AU >1<font
color=black face="Courier New">, <span
lang=EN-AU >DayOfWeek<font
color=black face="Courier New">() );
<font size=2 color=black
face="Courier New">Lastday = <span
lang=EN-AU >LastValue<font
color=black face="Courier New">(<span
lang=EN-AU >DayOfWeek<font
color=black face="Courier New">());
<font size=2 color=black
face="Courier New">Countweekends = <span
lang=EN-AU >IIf<font
color=black face="Courier New">(firstday==<span
lang=EN-AU >1<font
color=black face="Courier New">, (<span
lang=EN-AU >Cum<font
color=black face="Courier New">(<span
lang=EN-AU >DayOfWeek<font
color=black face="Courier New">()<<span
lang=EN-AU >Ref<font
color=black face="Courier New">(<span
lang=EN-AU >DayOfWeek<font
color=black face="Courier New">(),-<span
lang=EN-AU >1<font
color=black face="Courier New">))), <span
lang=EN-AU >1<font
color=black face="Courier New">+ (<span
lang=EN-AU >Cum<font
color=black face="Courier New">(<span
lang=EN-AU >DayOfWeek<font
color=black face="Courier New">()<<span
lang=EN-AU >Ref<font
color=black face="Courier New">(<span
lang=EN-AU >DayOfWeek<font
color=black face="Courier New">(),-<span
lang=EN-AU >1<font
color=black face="Courier New">))) );
<font size=2 color=black
face="Courier New">numweeks = <span
lang=EN-AU >LastValue<font
color=black face="Courier New">(Countweekends);
<font size=2 color=black
face="Courier New">
<font size=2 color=black
face="Courier New">numweek = Countweekends;
<font size=2 color=black
face="Courier New">
<font size=2 color=black
face="Courier New">firstbar = <span
lang=EN-AU >LastValue<font
color=black face="Courier New">(<span
lang=EN-AU >Cum<font
color=black face="Courier New">(<span
lang=EN-AU >1<font
color=black face="Courier New">))-<span
lang=EN-AU >LastValue<font
color=black face="Courier New">(numweek);
<font size=2 color=black
face="Courier New">weekref = <span
lang=EN-AU >Min<font
color=black face="Courier New">(<span
lang=EN-AU >0<font
color=black face="Courier New">, <span
lang=EN-AU >5<font
color=black face="Courier New">-lastday-<span
lang=EN-AU >4<font
color=black face="Courier New">*( <span
lang=EN-AU >LastValue<font
color=black face="Courier New">(<span
lang=EN-AU >Cum<font
color=black face="Courier New">(<span
lang=EN-AU >1<font
color=black face="Courier New">)) - <span
lang=EN-AU >Cum<font
color=black face="Courier New">(<span
lang=EN-AU >1<font
color=black face="Courier New">) ) );
<font size=2 color=black
face="Courier New">
<font size=2 color=black
face="Courier New">wo = <span
lang=EN-AU >IIf<font
color=black face="Courier New">(<span
lang=EN-AU >IsEmpty<font
color=black face="Courier New">( <span
lang=EN-AU >Ref<font
color=black face="Courier New">(<span
lang=EN-AU >DayOfWeek<font
color=black face="Courier New">(),-<span
lang=EN-AU >DayOfWeek<font
color=black face="Courier New">()) ), <span
lang=EN-AU >ValueWhen<font
color=black face="Courier New">(<span
lang=EN-AU >DayOfWeek<font
color=black face="Courier New">()==firstday,<span
lang=EN-AU >O<font
color=black face="Courier New">), <span
lang=EN-AU >ValueWhen<font
color=black face="Courier New">(<span
lang=EN-AU >DayOfWeek<font
color=black face="Courier New">()==<span
lang=EN-AU >1<font
color=black face="Courier New">,<span
lang=EN-AU >O<font
color=black face="Courier New"> ) );
<font size=2 color=black
face="Courier New">wh = <span
lang=EN-AU >HHV<font
color=black face="Courier New">(<span
lang=EN-AU >H<font
color=black face="Courier New">,<span
lang=EN-AU >Min<font
color=black face="Courier New">(<span
lang=EN-AU >DayOfWeek<font
color=black face="Courier New">(),<span
lang=EN-AU >5<font
color=black face="Courier New">));
<font size=2 color=black
face="Courier New">wl = <span
lang=EN-AU >LLV<font
color=black face="Courier New">(<span
lang=EN-AU >L<font
color=black face="Courier New">,<span
lang=EN-AU >Min<font
color=black face="Courier New">(<span
lang=EN-AU >DayOfWeek<font
color=black face="Courier New">(),<span
lang=EN-AU >5<font
color=black face="Courier New">));
<font size=2 color=black
face="Courier New">wc = <span
lang=EN-AU >C<font
color=black face="Courier New">;
<font size=2 color=black
face="Courier New">
<font size=2 color=black
face="Courier New">weeko =<span
lang=EN-AU >Ref<font
color=black face="Courier New">(wo,weekref);
<font size=2 color=black
face="Courier New">weekh = <span
lang=EN-AU >Ref<font
color=black face="Courier New">(wh,weekref);
<font size=2 color=black
face="Courier New">weekl = <span
lang=EN-AU >Ref<font
color=black face="Courier New">(wl,weekref);
<span
lang=EN-AU >weekc
= <span lang=EN-AU
>Ref<font
color=black face="Courier New">(wc,weekref);
<font size=3 color=teal
face="Times New Roman">Cheers,
Graham
<font size=2
color="#339966" face="Times New Roman"><font
color="#339966">http://groups.msn.com/ASXShareTrading
<font size=2
color="#339966" face="Times New Roman"><font
color="#339966">http://groups.msn.com/FMSAustralia
<span
>-----Original Message-----
From: kk2628
[mailto:kk2628@xxxxxxxxxxxxxxxx]
Sent: Wednesday, 23 April 2003
5:13 PM
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] trading days
in a week
<font size=2
face="Times New Roman">
<span
>Hi,
<font size=2
face="Times New Roman">
<span
>So far the following code works to
calc number of trading days in a week except the first week and the last
week of the ticker. I do not understand why tday still return 5 even though
last week only have 2 trading days (since the week is not over yet) ? Any help
is much appreciated.
<span
>dw=<span
>DayOfWeek<font size=1
color=black>();
<span
>firsttday = <font size=1
color=blue>IIf<font
size=1 color=black>(<font
size=1 color=blue>Cum<font
size=1 color=black>(<font
size=1 color=fuchsia>1<font
size=1 color=black>)==<font
size=1 color=fuchsia>1<font
size=1 color=black>,<font
size=1 color=fuchsia>1<font
size=1 color=black>,dw < <font
size=1 color=blue>Ref<font
size=1 color=black>( dw, -<font
size=1 color=fuchsia>1<font
size=1 color=black> ));
<span
>tday = <font size=1
color=blue>ValueWhen<font
size=1 color=black>( firsttday, <font
size=1 color=fuchsia>1<font
size=1 color=black>+ <font
size=1 color=blue>BarsSince<font
size=1 color=black>(<font
size=1 color=blue>Ref<font
size=1 color=black>(firsttday,-<font
size=1 color=fuchsia>1<font
size=1 color=black>)),<font
size=1 color=fuchsia face="Courier New">0<font size=1
color=black>);
<span
>Many thanks
<span
>KK
<font size=2
face="Times New Roman">
Send
BUG REPORTS to bugs@xxxxxxxxxxxxx<span
>
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to:
amiquote@xxxxxxxxxxxxxxx
(Web page: <a
href="">http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: <a
href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Your use of Yahoo! Groups is subject to the <a
href="">Yahoo! Terms of Service.
Yahoo! Groups Sponsor
ADVERTISEMENT
Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
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 the Yahoo! Terms of Service.
|