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

[amibroker] Amibroker-IB freezing (AFL problem)



PureBytes Links

Trading Reference Links

Am trying to store the data that amibroker gets from ib unto a database. However, found 
that amibroker doesn't seem to multitask very well. 

When i put amibroker to the background (collapse, switch to another application, 
desktop, etc) it stops storring data. If I switch to another chart it stops storring data 
(would be nice to be able to store information for several instruments).

Is this a limitation of amibroker, or am missing some setting or something.

Here is a copy of the AFL.

_SECTION_BEGIN("SQLinsert");
odbcOpenDatabase("ODBC;DATABASE=datastream;DRIVER={MySQL ODBC 3.51 
Driver};OPTION=0;PWD=root;PORT=0;UID=root");

if(IsEmpty(StaticVarGet("isInitialized")))
{
isInitialized = 1;
ultimo = WriteVal(Ref(DateTime(),-0),formatDateTime);
StaticVarSetText("ultimo",ultimo);
StaticVarSet("isInitialized" ,1);
}

ultimo = WriteVal(Ref(DateTime(),-0),formatDateTime);
if(ultimo != StaticVarGetText("ultimo"))
{
cierre = Close[0];
bajo = Low[0];
alto = High[0];
apert = Open[0];
vol = Volume[0];
StaticVarSetText("ultimo",ultimo);

temp= DateTimeConvert(0,Ref(DateTime(),-0));
temp1=int(temp / 10000);
fecha = NumToStr(temp1 + 1900,1.0,False);
temp = temp -temp1*10000;
temp1 = int(temp / 100);
fecha = fecha + "-" + NumToStr(temp1,1.0);
temp = temp - temp1*100;
fecha = fecha + "-" + NumToStr(temp,1.0) + " "+DateTimeConvert(5,Ref(DateTime(),-0));
fecha = fecha + ":" + DateTimeConvert(4,Ref(DateTime(),-0));
fecha = fecha + ":" + DateTimeConvert(3,Ref(DateTime(),-0));

symbol=odbcGetValue("Symbols",Name(),"id");
ultimo=odbcGetValueSQL("SELECT `date` FROM `ticks` WHERE `symbol` = "+symbol+" 
ORDER BY `Date` DESC LIMIT 1");

sqlqry=NumToStr(symbol)+", '"+ fecha+"', "+NumToStr(apert)+", "+NumToStr(bajo)+", 
"+NumToStr(alto)+", "+NumToStr(cierre)+", "+NumToStr(vol);
sqlqry="REPLACE INTO ticks (symbol, `date`, open, low, high, close, volume) VALUES 
("+sqlqry+")";
sqlqry=sqlqry+";";

odbcExecuteSQL(sqlqry);
GfxDrawText(ultimo+" "+cierre,20,20,400,100);
}
_SECTION_END();




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
 
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/