Hello,
Please tell me what is the purpose of sending the same post to
support and to the list?
Are you trying to double my work or what????
If you are sending to support - ALLOW ME TO ANSWER.
Bombarding us (actually only me
because Marcin is on vacation now) with multiple copies of the
same thing is bad idea.
Some facts because you are mixing things: 1. AmiBroker fully supports
TICK data (it displays as many ticks as data vendor provides, if there are 50
trades in one second it will display 50 trades). Granularity of timestamp has
NOTHING to do with that as in every application tick data usually have SAME
timestamp for multiple ticks happening in given second or any other granular
interval.
2. The timestamp you see is displayed in 5 second increments
but what you can not see in tick data that ticks also have their unique tick
number and they are differentiated by it if timestamp is the same. Again -
MANY ticks may have same timestamp in TICK mode. This is normal and
present in all applications.
3. AddToComposite is DIFFERENT
STORY. As it is impossible to match tick numbers from one symbol to another
(DIFFERENT INSTRUMENTS have VERY DIFFERENT trading activity and 10th tick for
symbol XYZ happens on completely different time thant 10th tick for symbol
ABC.
THEREFORE AddToComposite MUST use timestamp to match-and-align data
coming from DIFFERENT tickers. Now *AddToComposite* resolution is limited to
5 seconds.
As to the formula itself, I wrote you that I did not test
it.
You can easily modify it, to remove "crazy
values".
Replace tn = Now( 4 );
with: tn = LastValue(
Second() );
Also use the original code, not one with foreigns. The only
change really needed is using different flags:
tn =
LastValue(Second()); ltn = StaticVarGet( "LastTimeNum"+Name() );
if(
ltn != tn ) { StaticVarSet( "LastTimeNum"+Name(), tn
);
bidarray = 0; bidarray[ BarCount - 1 ] =
GetRTData("bid"); askarray = 0; askarray[ BarCount - 1 ] =
GetRTData("ask");
AddToComposite( bidarray, "~BA_"+Name(), "X",
atcFlagEnableInIndicator ); AddToComposite( askdarray, "~BA_"+Name(),
"H", atcFlagEnableInIndicator ); }
================ To use them
somewhere lese use:
askarray = Foreign("~BA_"+Name()", "H" ); bidarray
= Foreign("~BA_"+Name()", "L" );
Best regards, Tomasz Janeczko amibroker.com
----- Original Message -----
Sent: Tuesday, August 14, 2007 3:43
AM
Subject: Re: [amibroker] Re: Real time
indicators using GETRTDATA
Hi Tomasz or anyone,
I didn't realize the smallest time
period in AB was 5 seconds....
The formula didn't seem to work setting
the arrays to = 0 , as only the last value ended up in the composite, I assume
because of the reset in the addtocomposite defaults, so I set the arrays to
equal the composites
This seems to work ok except it gets strange
values in all fields when there is more than one tick / entry in a five second
time period in the original ticker..... any ideas?? eg if I look in quote
editor in original ticker and there is only one entry in a 5 second period in
matches in the composite, if there is more than one entry per 5 second in
original ticker I get crazy values in composite...
Is it possible to
match the number of fields to the original, eg if there are 3 entries in a
five second period in the original ticker to have 3 entries in the composite??
Any that way capture indivual trade sizes as well (up to resolution that IB
provides anyway)....
tn = Now(4); ltn = StaticVarGet(
"LastTimeNum");
if( ltn != tn ) { StaticVarSet( "LastTimeNum", tn
);
bidarray = Foreign("~BA_", "L" ); bidarray[ BarCount - 1 ] =
GetRTData("bid"); askarray = Foreign("~BA_", "H" ); askarray[ BarCount
- 1 ] = GetRTData("ask");
sizearray =
Foreign("~BA_","V"); sizearray[ BarCount -1 ] = GetRTData("tradevolume");
lastarray = Foreign("~BA_","C"); lastarray[ BarCount -1 ] =
GetRTData("last");
AddToComposite( lastarray, "~BA_","C",
atcFlagDefaults | atcFlagEnableInIndicator ); AddToComposite( sizearray,
"~BA_","V", atcFlagDefaults | atcFlagEnableInIndicator ); AddToComposite(
bidarray, "~BA_", "L", atcFlagDefaults | atcFlagEnableInIndicator );
AddToComposite( askarray, "~BA_", "H", atcFlagDefaults |
atcFlagEnableInIndicator ); }
Cheers, James.
On 8/13/07, Tomasz
Janeczko <groups@xxxxxxxxxxxxx> wrote:
Hello,
You should call GetRTData for bid and ask and store using
AddToComposite:
Appropriate code should look as follows (I DID NOT TEST IT
- I am writting off hand)
- it will create 5 second bid/ask "bars".
High will hold ask, Low will hold bid.
=== Code that generates array
tn = Now(4);
ltn = StaticVarGet( "LastTimeNum"+Name() );
if( ltn != tn )
{
StaticVarSet( "LastTimeNum"+Name(),
tn );
bidarray = 0;
bidarray[ BarCount - 1 ] =
GetRTData("bid");
askarray = 0;
askarray[ BarCount - 1 ] =
GetRTData("ask");
AddToComposite( bidarray, "~BA_"+Name(), "X",
atcFlagDefaults | atcFlagEnableInIndicator );
AddToComposite( askdarray, "~BA_"+Name(), "H",
atcFlagDefaults | atcFlagEnableInIndicator );
}
================
To use them somewhere lese use:
askarray = Foreign("~BA_"+Name()", "H" );
bidarray = Foreign("~BA_"+Name()", "L"
);
-----
Original Message -----
Sent:
Monday, August 13, 2007 3:19 AM
Subject:
Re: [amibroker] Re: Real time indicators using GETRTDATA
Tomasz,
could you point me in the right direction in how to code something to
do this in real time, or is it impossible at the moment??
Cheers, James
__._,_.___
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
SPONSORED LINKS
__,_._,___
|