Graham
I have finished testing with some dummy intraday data and
can confirm your statement:
"...but if the underlying ticker does not have a bar at
that particular day/time bar then the foreign ticker will not show data
there"
It makes total sense on the face of it but I did not
expect the feature to propogate UP to longer timeframes such as 30
minute, daily or weekly charts (i.e. produced from intraday data). I
must be doing something wrong for sure, because the following test
results means that comparing tickers on an intraday database could be
inconsistent and produce unexpected results especially when using ASX
data.
This is what I found:
Local Database (no RT Interface activated): 1 Minute Bars
Ticker XIJ has quotations for every Odd Minute between
3:31 and 4:00pm, OHLC non zero, V = 0
Ticker CPU has quotations for every Even Minute between
3:31 and 4:00pm, OHLCV non zero
Both tickers have quotations that overlap in time for the
previous half hour periods.
Indicator/AFL programmed to detail OHLCV values for the
ticker selected and for Foreign Ticker CPU with Padding disabled. Chart
displayed candles for OHLC and V from the foreign ticker.
The code uses the following statements to plot:
if ( SetForeign("CPU",0) ) {
CPUvol = V;
RestorePriceArrays();
}
Plot( C, "Close", ParamColor("Color", colorYellow ), styleNoTitle
| ParamStyle("Style")
| GetPriceStyle() );
Plot( CPUVol, _DEFAULT_NAME(),
IIf( C
> O, ParamColor("Price Up Color", colorLightGrey ), ParamColor("Price Down
Color", colorGrey50 ) ),
ParamStyle(
"Price Style", styleHistogram
| styleThick | styleOwnScale, maskHistogram ) )
1.. Display Price Chart
Interpretation and chart display values for CPU odd
minute periods only on a 1 Minute Timeframe
Interpretation and chart display values for CPU EVERY
period when using a 5,15,30,hourly,daily Timeframe
Interpretation
This was the expected behaviour - OK so far.
2. Display Price Chart for XIJ.
Interpretation and chart display values for XIJ odd
minute periods only on a 1 Minute Timeframe
Interpretation and chart display values for XIJ EVERY
period when using a 5,15,30,hourly,daily Timeframes
Interpretation for Foreign Ticker CPU showed NO Data
on a 1 Minute Timeframe (expected behaviour)
Interpretation for Foreign Ticker CPU showed NO Data
on 5,15,30 bar between 3:30 and 4pm
The 1 minute chart behaved as expected, CPU vol was empty
for the periods it did not exist. This is easy to compensate for in
code by doing the following inside the SetForeign code section:
CPUVol
= IIf(IsNull(V),0,V) ;
I did not expect NO DATA for the foreign ticker CPU for
timeframes greater than 1 minute.
What I expected was for the 5,15,30 minute bars be
generated for CPU prior to aligning with XIJ, thus no data would be
lost at the higher timeframe.
Now, if XIJ had a quotation for every 1 minute bar then
the volume check above could correctly compensate for the missing bars
in the constituent stocks (vis CPU). The OHLC would be OK too I think.
I will send this email to support, and hopefully Amibroker
can shed some light on my problem and help solve it. I am looking
forward to progressing past my "learning to walk with AFL phase" with
Amibroker for I have many ideas I'd like to put to code.
If anyone can see where I have gone wrong, I'd be glad to
hear your thoughts.
regards
Chris
-------Original
Message-------
Date:
04/01/05 17:03:00
Subject:
Re: [amibroker] Intraday Data - SetForeign and data alignment
Thanks Graham
That might be the clue but I think now that there might be
more to it.
If I am displaying the chart as a daily then one would
expect that if each ticker shows a daily bar for that day (in fact they
show a daily bar for all bars as every ticker in my sample has been
trading each day), then the code would have bar values for each foreign
ticker. The same applies when viewing 15 minute, 30 minute and hourly
bars. Each ticker has non zero data for every bar when viewed
separately and there are no periods missing.
However, a daily/15 minute/30 minute/hourly bar etc is
generated from the underlying 1 minute quotations.
This is where the problem might be: EVERY ticker has
missing 1 minute bars, but has at least ONE 1 minute bar inside the
Timeframe being displayed (e.g. daily). As per the other post on pitch
forks Aussie shares are not liquid enough to ensure trade activity
every minute of every day. Even BHP takes a breather.
So I guess that if the underlying ticker and foreign
tickers do not line up sufficiently at the 1 minute bar level then the
"emptiness" is propogated up to the daily/hourly chart. Hope this makes
sense, if not I can give an example.
How can I work around this or is this where one needs to
call on Thomaz for help?
Maybe if I could EXPAND the underlying ticker to have a
bar for EVERY time period then the problem might go away. I might try
testing this on the weekend with a temporary local database where I can
add/delete quotations.
regards
Chris
-------Original
Message-------
Date:
04/01/05 11:26:45
Subject:
Re: [amibroker] Intraday Data - SetForeign and data alignment
Padding allows indicators to fill across data gaps, but if
the
underlying ticker does not have a bar at that particular
day/time bar
then the foreign ticker will not show data there.
> Chris,
>
> I don't know the answer to your question. I just
observe that yesterday
> someone was asking for data hole filling on intraday
data. AB does (if you
> tell it) fill data holes on daily data. Sounds like
more than one user sees
> that it does not fill holes intraday.
>
> Terry
>
> Chris Shawcross wrote:
>
> I'm not sure where the problem is and I think there
is more than one problem
> to solve. My assumption at present is that I have
done something really
> silly. I hope someone can help me out.
>
> I have constructed a volume calculation for Aussie
sector indexes using the
> SetForeign function. The code works great on EOD
local data (even where some
> of the constituent stocks have missing bars) BUT it
performs totally
> differently for intraday data.
>
> Data sources tested:
> A. EOD Data only
> B. Marketcast RT plugin (1 minute data local storage
in AB)
> C. Local data store of 1 minute data
>
> Cut down version of the code is provided at the base
of this post.
>
> On EOD data, whilst displaying XIJ, the volume
indicator provides a
> summation of each days volume as a histogram and
details the individual
> volumes in the interpretation section. I consciously
delete a couple of
> daily bars for CPU and the code correctly replaced
the gaps with zero volume
> for that period.
>
> However, when switching to the intraday databases,
holes suddenly appear in
> the data when each constituent ticker has valid data
for that period. i.e.
> if I display the daily price/volume chart for each
ticker, the code below
> shows the correct volume for today for the same
ticker (and every period as
> there are no missing days in the data for any
ticker). However there are
> zero volume values for some of the other tickers
9depending on which bar is
> selected) even though individually each has volume
for that day.
>
> It is very hard to describe, so I hope someone
understands what I am getting
> at. It appears to me that when the intraday data is
compressed to provide
> daily bars, some empty bar characteristics may be
propogating to a daily
> bar, but only when accessed via GetForeign. Or
rather, I have made an
> obvious and silly coding error. I truly hope it is
the later. What concerns
> me is that I cannot replicate the problem on the EOD
data whilst viewing
> daily/weekly/monthly charts. But it is easily
reproduced using daily/30
> minute/weekly etc charts with a 1 minute database.
Note that the tickers DO
> have gaps between 1 minute bars as the stocks are not
continuously traded.
> This is the norm for Aus as mentioned in a recent
query on pitch forks.
>
> The code below allows for fill to be enabled, this
produces some more
> interesting (but undesirable) effects which deserve
their own post. Once
> again, I hope it is my code that has stuffed up (and
easily rectified). But
> one problem at a time.
>
> regards
> Chris (Shawky)
>
> P.S. I really like the new formula environment,
include files, parameter
> options etc, drag and drop, especially the insert
linked facility. Looking
> forward to an Overlay Linked option in the future ;)
> The code:
>
> PadEmptyBars=ParamToggle("Pad Empty Bars","No|Yes",0);
> tickers="CPU,BCA,IRE,VSL";
> MyVol = 0;
> for ( num = 0; ( sym = StrExtract(tickers,num) ) !=
"" ; num++)
> {
> if ( SetForeign(sym,PadEmptyBars) )
> {
> VarSet("Vol"+num, IIf(IsNull(V),0,V) );
> RestorePriceArrays();
> }
> else
> {
> printf("Ticker "+sym+" not found\n");
> VarSet("Vol"+num, 0);
> }
> }
>
> for ( i = 0; i < num; i++ )
> {
> MyVol = MyVol + VarGet("Vol"+i);
> }
>
> Plot( MyVol, _DEFAULT_NAME(),
> IIf( C > O, ParamColor("Price Up Color",
colorLightGrey ),
> ParamColor("Price Down Color", colorGrey50 ) ),
> ParamStyle( "Price Style", styleHistogram |
styleThick | styleOwnScale,
> maskHistogram )
> );
>
> for ( i = 0; i < num; i++ )
> printf( " " + StrExtract(tickers,i) + " " +
WriteVal(VarGet("Vol"+i),10.0)
> + "\n");
>
>
>
>
>
>
>
> 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 other support material please check also:
>
>
>
>
>
>
> 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 other support material please check also:
>
>
>
>
> Yahoo! Groups Sponsor
> ADVERTISEMENT
>
> ________________________________
> Yahoo! Groups Links
>
> To visit your group on the web, go to:
>
> To unsubscribe from this group, send an email to:
>
> Your use of Yahoo! Groups is subject to the Yahoo!
Terms of Service.
--
Cheers
Graham
------------------------ Yahoo! Groups Sponsor
--------------------~-->
What would our lives be like without music, dance, and
theater?
Donate or volunteer in the arts today at Network for Good!
--------------------------------------------------------------------~->
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 other support material please check also:
Yahoo! Groups Links
<*> To visit your group on the web, go to:
<*> To unsubscribe from this group, send an email to:
<*> Your use of Yahoo! Groups is subject to:
|