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

Re: [amibroker] IB RT + Foreign() + 100% CPU Usage -- price formula



PureBytes Links

Trading Reference Links

hello tomasz,
 
i don't use built-in price formulas, i have made some custom formulas. does this formula require all bars?
 

_SECTION_BEGIN("Price pair01a");

//MPT

//PRICE for pair01a (Intraday)

//General & Time

#pragma nocache

#include <MPT Active Pairs.afl>

#include <pairEODValues.afl>

SetForeign(pair01a);

AvgVol=MA(V,5000);

pair01aiC=TimeFrameGetPrice("C",inDaily,-1);

RestorePriceArrays();

SetForeign(pair01a,0);

y=(jahr-1900)*10000;

m=100*monat;

d=tag;

time=y+m+d;

//Close & Volume

ydayclose=IIf(DateNum()>time,pair01aC,pair01aiC);

V=IIf(DateNum()>time,V*100,V);

//Color & Scale

Volcolor=IIf(V>AvgVol,colorLightOrange,colorLavender);

Volscale=Param("Volume Scale",0.001,0.001,1,0.001);

//Plot

Plot(C,"",1,64);

Plot(ydayclose,"",6,8|styleNoRescale);

Plot(ydayclose-pair01aATR,"",colorViolet,8|styleNoRescale);

Plot(ydayclose+pair01aATR,"",colorViolet,8|styleNoRescale);

Plot(V,"",Volcolor,styleNoTitle|ParamStyle("Style",styleHistogram|styleOwnScale|styleThick|styleNoLabel,maskHistogram)

,0,Volscale*LastValue(Highest(V)));

Plot(AvgVol,"",colorGold,styleNoTitle|ParamStyle("Style",styleHistogram|styleOwnScale|styleThick|styleNoLabel,maskHistogram),

0,Volscale*LastValue(Highest(V)));

//C for Title

C=IIf(IsTrue(C),C,

IIf(IsTrue(Ref(C,-1)),Ref(C,-1),IIf(IsTrue(Ref(C,-2)),Ref(C,-2),IIf(IsTrue(Ref(C,-3)),Ref(C,-3),IIf(IsTrue(Ref(C,-4)),Ref(C,-4),

IIf(IsTrue(Ref(C,-5)),Ref(C,-5),IIf(IsTrue(Ref(C,-6)),Ref(C,-6),IIf(IsTrue(Ref(C,-7)),Ref(C,-7),IIf(IsTrue(Ref(C,-8)),Ref(C,-8),

IIf(IsTrue(Ref(C,-9)),Ref(C,-9),IIf(IsTrue(Ref(C,-10)),Ref(C,-10),IIf(IsTrue(Ref(C,-11)),Ref(C,-11),IIf(IsTrue(Ref(C,-12)),Ref(C,-12),Ref(C,-13))))))))))))));

//Title

Title=EncodeColor(colorBlue)+"01a "+pair01a+" "+EncodeColor(colorBrown)+Date()+EncodeColor(colorSeaGreen)+" V: "+

WriteVal(V,1)+"\n"+EncodeColor(colorBlue)+WriteVal(O,1.2)+EncodeColor(colorGreen)+"\n"+WriteVal(H,1.2)+EncodeColor(colorRed)+"\n"+

WriteVal(L,1.2)+EncodeColor(colorBlack)+"\n"+WriteVal(C,1.2);

_SECTION_END();

 
 
thank you for your time,
dirk
 
 
 
 
----- Original Message -----
Sent: Thursday, April 14, 2005 1:09 PM
Subject: Re: [amibroker] IB RT + Foreign() + 100% CPU Usage

Hello,
 
In addition to unchecking
"Force instant quote retrieval for all symbols"
box in File->Database Settings-Configure,
 
Make also sure not to use old price chart formula that was using LastValue() function (that causes all bars to be required).
Instead use new price formula (without LastValue), i.e:
 
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1
) ) ));
Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );

Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message -----
Sent: Thursday, April 14, 2005 12:25 PM
Subject: [amibroker] IB RT + Foreign() + 100% CPU Usage

hello group,
i recently ran into problems with 100% CPU usage running amibroker RT with IB plugin. i wondered if someone could share some technical insight as to the tech specs needed for the type of trading i am doing.
 
here is the scenario:
i run amibroker pro RT with the latest IB plugin. i switch between various layouts, which usually have 6 different windows open. one of these windows is my "statistics" formula which references about 20, sometimes up to 40 different tickers via Foreign() statements. the formula in itself does not include heavy calculating (i think), no Cum() or other stuff, just some basic %change and loads of WriteIf() and AlertIf().  - still it eats up 100% CPU usage all the time, quite apparently because of all those Foreign() statements.
 
what type of machine would i need to run this type of scenario?
my specs: AMD Athlon 1700+, 256 RAM, Win XP, ADSL 512/128, AB Pro RT with IB, 1min database, chart refresh at 20sec
specs needed ??
 
note that AB can actually do this, my system does not hang up (for 6 and a half hours trading at 100% CPU though) and i can trade the way i want to. but when switching between layouts or alt-tabbing to another application, amibroker may take 5-20 secs.
 
so, what's the way? more cpu? eSignal? is eSignal plugin less CPU-intensive?
 
thanks for any insight,
dirk


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:
http://www.amibroker.com/support.html




Do you Yahoo!?
Yahoo! Small Business - Try our new resources site!


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:
http://www.amibroker.com/support.html





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:
http://www.amibroker.com/support.html





Yahoo! Groups Links


Do you Yahoo!?
Yahoo! Small Business - Try our new resources site!