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

Re: [amibroker] Amibroker-IB freezing (AFL problem)



PureBytes Links

Trading Reference Links

Hello,

You got it all wrong.

1. AmiBroker as any well-behaved application does NOT redraw INVISIBLE windows.
If you minimize - the window becomes invisible and stops redrawing.
So it actually multitasks as it should (because it does not eat resources!)

2. You can force refresh even if window is hidden if you use RequestTimedRefresh
function with onlyvisible set to FALSE.

3. It is generally *very bad* idea what you are doing. Indicators are not place to 
put such performance killer code. SQL server is slow. Much much slower than AFL. 
You should either place it in Auto-analysis and run as "Run every" 
OR (much better solution) - connect to IB/TWS directly via API or ActiveX
http://individuals.interactivebrokers.com/en/control/apicontrol.php?ib_entity=llc
and leave AmiBroker to do ANALYSIS, not the "data pump" as you are using it now.

Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message ----- 
From: "ugokanain" <ugokanain@xxxxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Friday, October 19, 2007 1:27 AM
Subject: [amibroker] Amibroker-IB freezing (AFL problem)


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


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/