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

Re: [amibroker] This just doesn't work! Please help!



PureBytes Links

Trading Reference Links

Hello,

If you want doing bid/ask data collection you need to use given data source API directly.
--------------------------------------------------------------------------------------------------------------------------------

Indicators are for DISPLAY - i.e. to provide VISUAL INFORMATION THAT YOUR
EYE is supposed to process at the pace the human eye is capable of processing.
You simply can't collect bid/ask stream from indicator code
because indicators are only updated when TRADES are done,
and not during new bid/asks. Bid/asks are updated way more frequently
than new trades occur. Also indicator won't be displayed more often than 10 times per second
simply because your EYE is not able to process VISUAL information quicker than that.

Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message ----- 
From: "jorgen_wallgren" <jorgen.wallgren@xxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Thursday, November 20, 2008 4:15 PM
Subject: [amibroker] This just doesn't work! Please help!


I want to write an very interesting RT indicator and therefore I 
need the same RT data the Time & Sales window uses. As a start, I 
wrote some test code for catching Trades only - just to check if it 
works. Unfortunately it doesn't and I would highly appreciate some 
advice, since it's not much RT coding examples out there to look at.

The below code catch Trade data- but the problem is that it misses a 
lots of it and especially duplicates (Time, price and size- all the 
same). It creates its own duplicates. It also seems that for stocks 
like AAPL, the program just can't keep up with the speed of data 
coming in..

Advice is highly appreciated! Thanks- Jorgen

_SECTION_BEGIN("Time and Sales Data Collection Test");
RequestTimedRefresh(0);

// This simple method to check if we have changed Symbol only works 
if you 
// use only one chart! But good enough for testing and let change of 
symbol reset
// the Static data and start with a new test.
if(StaticVarGetText( "Old_Symbol_Name" ) != Name())
{
//Say("New Symbol");
StaticVarSetText( "Old_Symbol_Name", Name()); 
StaticVarSet("Bull_Volume", 0);
StaticVarSet("Bear_Volume", 0);
StaticVarSet("Neutral_Volume", 0);
StaticVarSet("TradedTotalVolume", 1);
// Put 1 since with 0, the variable will be "{Empty}"
StaticVarSet("AskPrice", 0);
StaticVarSet("BidPrice", 0);
} 

// ====== RETRIEVE RT DATA: ======
AskPrice = GetRTData("Ask"); 
AskSize = GetRTData("AskSize"); 
BidPrice = GetRTData("Bid");
BidSize = GetRTData("BidSize");
LastPrice = GetRTData("Last"); 
TradeVolume = GetRTData("TradeVolume");
TotalVolume = GetRTData("TotalVolume");
UpdateTime = GetRTData("UpdateTime");
//ChangeTime = GetRTData("ChangeTime");
// UpdateTime will unfortunately give the same time as
// "ChangeTime"- at least when using IQFeed.

Trade = IIf(StaticVarGet("TradedTotalVolume") < TotalVolume, 1, 0);
if(Trade)
{
 StaticVarSet("TradedTotalVolume", TotalVolume); 
 // Write the Data to file:
 Symbol = Name();
 fh = fopen( "C:\\SaveData\\" + Symbol + " Time and Sales 
Data.txt", "a");
 if(fh)
{ 
qsA = StrFormat("%.0f", UpdateTime); 
qsB = StrFormat("%.2f,%.0f\n", LastPrice, 
TradeVolume); 
fputs(qsA + "," + "Trade" + "," + qsB , fh);
fclose(fh); 
}
}

_SECTION_END();




------------------------------------

**** IMPORTANT ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

*********************
TO GET TECHNICAL 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

*********************************
Yahoo! Groups Links




------------------------------------

**** IMPORTANT ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

*********************
TO GET TECHNICAL 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

*********************************
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

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