PureBytes Links
Trading Reference Links
|
Thanks Keith and Tomasz for you help and comments. As you both can
tell Im seriously handicapped when it comes to coding :). I also
hope I didn't come off like I thought there was something wrong with
AMibroker, I am fully aware that my lack of coding skill was the
issue, just didn't know how to fix it. Its a great program and I
love it, just trying to get things working for me. I will Do some
more work on it today
Brian
--- In amibroker@xxxxxxxxxxxxxxx, Keith McCombs <kmccombs@xxx> wrote:
>
> Brian --
> I believe you are having some of the same problems I had when I
first
> started using AmiBroker (even though, or maybe because, I had been
> programming in C since before either M$ or Borland had C
compilers).
> The two most troublesome for me were:
>
> 1. AB uses 'arrays' without declaring them as such (except
inside of
> loop structures such as for(){} where you must use [] for *all*
arrays.
> In your code below, you used [] to define the elements for the
HiVal
> array. However, you did not use set[], so AB did not treat set as
an
> array but only as a variable (and therefore the same goes for
> maxDegreesZero).
>
> 2. AB only makes a _*single pass*_ through the code. Read Fred's
> contribution 1/30/2006 at 11:49pm. I quote:
> " AmiBroker AFL is processed from top to bottom with each
statement
> being executed ONCE and ONLY ONCE ... NOT ONCE PER BAR ...
> Unless you build your own Do / While / For Loops and subscript the
> ARRAYS then typically each statement works on the entire ARRAY ..."
>
> BTW, you don't *need* loops in your code at all. For example,
your
> for(){} loop could (and should) be written as such:
> set = IIf(HiVal2>1 AND HiVal2<=25, 30,
> IIf(HiVal2>25 AND HiVal2<=50, 55,
> IIf(HiVal2>50 AND HiVal2<=100, 120,
> IIf(HiVal2>100 AND HiVal2<=200, 220,
> IIf(HiVal2>200 AND HiVal2<=500, 510,
> IIf(HiVal2>500 AND HiVal2<=900, 920, 1300))))));
> // I assume you meant 9000 and not 9000 and 13000
>
> -- Keith
>
>
>
>
> coba702002 wrote:
>
> > HI Tomasz
> >
> > Ok I have revised my incorrect code and removed other code to try
> > and pinpoint the problem, but I still get weird things happening
> > even without datafeed, which Im sure tomorrow when I have data
will
> > make the AMI unusable. Right now when I insert that code below
into
> > a new window switching between that window and others is ALOT
slower
> > ALSO when I select>>view and open say charts it will not open the
> > pane until I minimize ami and restore ami then it shows up... If
I
> > try and close that pane it will not close until I Minimize ami
and
> > then restore , then its gone. This Problem Does not show up
without
> > this code in any windows???
> >
> > Thanks for any thoughts or ideas to fix this
> >
> > Brian
> >
> > range2=95;
> > LastBar = BarCount-1;
> > HiVal2 = HHV(H,range2);
> > LoVal2 = LLV(L,range2);
> >
> > step = 8;
> > for( i = 0; i < BarCount; i++ )
> > {
> > if(HiVal2[i] >1.0 AND HiVal2[i]<=25 )
> > set = 30;
> > else if (HiVal2[i]>25 AND HiVal2[i]<=50 )
> > set = 55;
> > else if (HiVal2[i]>50 AND HiVal2[i]<=100 )
> > set = 120;
> > else if (HiVal2[i]>100 AND HiVal2[i]<=200 )
> > set = 220;
> > else if (HiVal2[i]>200 AND HiVal2[i]<=500 )
> > set = 510;
> > else if (HiVal2[i]>500 AND HiVal2[i]<=900 )
> > set = 920;
> > else if (HiVal2[i]>9000 AND HiVal2[i]<=13000 )
> > set = 13000;
> > else set = 13000;
> >
> > }
> >
> > maxDegreesZero = set;
> > degreesZero = 1;
> > increment = 1;
> > degreesValueInt = 0;
> > angleFactor = 0;
> > sqrtDegreesZero = 0;
> > degreesValue = 0;
> >
> >
> >
> > // Iterate through the set of squares
> > while (degreesZero < maxDegreesZero)
> > {
> > sqrtDegreesZero = sqrt(degreesZero);
> >
> > // Iterate through the circle for this square, in
11.25
> > degree increments
> > for (angle = 0; angle < 360; angle = angle + 11.25)
> > {
> > angleFactor = (angle / 360.0) * 2.0;
> > degreesValue = (sqrtDegreesZero +
> > angleFactor) ^ 2;
> >
> > roundedValue = round(degreesValue);
> >
> >
> > HHVBarsSince = HHV(H, 30) ;
> > LLVBarsSince = LLV(L, 30) ;
> >
> >
> > if (roundedValue[LastBar]< (HHVBarsSince[Lastbar])
> > AND roundedValue[LastBar]>(LLVBarsSince[Lastbar]) ){
> > Plot(Prec(roundedValue,2), "",
> > colorGrey40|styleLine, -(LLVBarsSince[Lastbar]),(HHVBarsSince
> > [Lastbar]));
> >
> > }
> >
> > }
> >
> > // Find the next 0 degree value
> > degreesZero = degreesZero + increment;
> > increment = increment + step;
> > }
> >
> > // End Square Of Nine ************
> >
> > PlotOHLC(Open,High,Low,Close,"",colorBlack, styleCandle);
> >
> > TitleStr= Interval(2) ;
> >
> >
> > Title = TitleStr;
> >
> > --- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko" <amibroker@>
> > wrote:
> > >
> > > Hello,
> > >
> > > No, I am referring to IIFs at the beginning that are written
> > incorrectly. I did not even
> > > check further since the beginning of the code is wrong.
> > > You are mixing up if (statement) with iif (function)
> > >
> > > Best regards,
> > > Tomasz Janeczko
> > > amibroker.com
> > > ----- Original Message -----
> > > From: "coba702002" <coba702002@>
> > > To: <amibroker@xxxxxxxxxxxxxxx>
> > > Sent: Saturday, February 04, 2006 9:05 PM
> > > Subject: [amibroker] Re: Help with code bringing Ami to a
grinding
> > halt
> > >
> > >
> > > > Thanks for your fast response... I can't test it today, no
> > datafeed
> > > > But just glancing at it, are you referring to the rounding
> > section
> > > > of the code? If so Im pretty sure that didn't make any
> > difference
> > > > when it wasn't in there.
> > > >
> > > > So what your saying is this code once correct shouldn't be a
> > problem
> > > > working in an indicator VS a plain jane price chart in real
> > time?
> > > > My test comparison of the two was a MAJOR slowdown with my
code
> > > > added.
> > > >
> > > > Thanks again for any thoughts
> > > > Brian
> > > >
> > > > --- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko"
<amibroker@>
> > > > wrote:
> > > >>
> > > >> The code contains numerous errors listed in "common coding
> > > > mistakes" in the User's Guide:
> > > >>
> > > >> http://www.amibroker.com/guide/a_mistakes.html
> > > >>
> > > >> Best regards,
> > > >> Tomasz Janeczko
> > > >> amibroker.com
> > > >> ----- Original Message -----
> > > >> From: "coba702002" <coba702002@>
> > > >> To: <amibroker@xxxxxxxxxxxxxxx>
> > > >> Sent: Saturday, February 04, 2006 8:10 PM
> > > >> Subject: [amibroker] Help with code bringing Ami to a
grinding
> > halt
> > > >>
> > > >>
> > > >> > Can anyone help me figure out why when I add a window with
> > this
> > > > code
> > > >> > in it.. Ami (ver-4.76, windows xp, Ib tws 1.51) slows
down to
> > > >> > unusable levels. ie switching windows takes forever...
> > candles
> > > > seem
> > > >> > stuck then suddenly change price.
> > > >> >
> > > >> > Is there a way to make this code work???
> > > >> >
> > > >> > any help or ideas would be greatly appreciated
> > > >> >
> > > >> > Thanks
> > > >> > Brian
> > > >> >
> > > >> > // Begin Square Of Nine ************
> > > >> >
> > > >> > range2=95;
> > > >> > LastBar = BarCount-1;
> > > >> > HiVal2 = HHV(H,range2);
> > > >> > LoVal2 = LLV(L,range2);
> > > >> >
> > > >> > step = 8;
> > > >> > IIf(HiVal2>1.0 AND HiVal2<=25 ,set = 30,0);
> > > >> > IIf(HiVal2>25 AND HiVal2<=50 ,set = 55,0);
> > > >> > IIf( (HiVal2>50 AND HiVal2<=100 ),set = 120,0);
> > > >> > IIf( (HiVal2>100 AND HiVal2<=200 ),set = 220,0);
> > > >> > IIf( (HiVal2>200 AND HiVal2<=500 ),set = 510,0);
> > > >> > IIf( (HiVal2>500 AND HiVal2<=900 ),set = 920,0);
> > > >> > IIf( (HiVal2>9000 ),set = 13000,0);
> > > >> > maxDegreesZero = set;
> > > >> > degreesZero = 1;
> > > >> > increment = 1;
> > > >> > degreesValueInt = 0;
> > > >> > angleFactor = 0;
> > > >> > sqrtDegreesZero = 0;
> > > >> > degreesValue = 0;
> > > >> >
> > > >> >
> > > >> >
> > > >> > // Iterate through the set of squares
> > > >> > while (degreesZero < maxDegreesZero)
> > > >> > {
> > > >> > sqrtDegreesZero = sqrt(degreesZero);
> > > >> >
> > > >> > // Iterate through the circle for this square,
in
> > > > 11.25
> > > >> > degree increments
> > > >> > for (angle = 0; angle < 360; angle = angle +
11.25)
> > > >> > {
> > > >> > angleFactor = (angle / 360.0) * 2.0;
> > > >> > degreesValue = (sqrtDegreesZero +
> > > >> > angleFactor) ^ 2;
> > > >> >
> > > >> > // round either to tenths, quarters, OR wholes
> > > >> > if (degreesValue <= 450)
> > > >> > {
> > > >> > degreesValue = degreesValue
> > > >> > * 10;
> > > >> > roundedValue = Prec
> > > >> > (degreesValue,2) / 10;
> > > >> > }
> > > >> > else if (degreesValue > 450 AND degreesValue
> > > >> > < 5000)
> > > >> > {
> > > >> > remainder = frac(degreesValue);
> > > >> > intValue = degreesValue - remainder;
> > > >> > if (remainder > 0 AND remainder
> > > >> > <= .25)
> > > >> > remainder = .25;
> > > >> > else if (remainder > .25 AND
> > > >> > remainder <= .5)
> > > >> > remainder = .5;
> > > >> > else if (remainder > .5 AND
> > > >> > remainder <= .75)
> > > >> > remainder = .75;
> > > >> > else
> > > >> > remainder = 1;
> > > >> > roundedValue = intValue +
> > > >> > remainder;
> > > >> > }
> > > >> > else
> > > >> > {
> > > >> > roundedValue = round(degreesValue);
> > > >> >
> > > >> > }
> > > >> >
> > > >> >
> > > >> > HHVBarsSince = HHV(H, 30) ;
> > > >> > LLVBarsSince = LLV(L, 30) ;
> > > >> >
> > > >> >
> > > >> > //if (roundedValue[LastBar]<(45) AND roundedValue
> > > >> > [LastBar]>(30) ){
> > > >> > if (roundedValue[LastBar]< (HHVBarsSince[Lastbar])
> > > >> > AND roundedValue[LastBar]>(LLVBarsSince[Lastbar]) ){
> > > >> > Plot(Prec(roundedValue,2), "",
> > > >> > colorGrey40|styleLine, -(LLVBarsSince[Lastbar]),
(HHVBarsSince
> > > >> > [Lastbar]));
> > > >> >
> > > >> > }
> > > >> >
> > > >> > }
> > > >> >
> > > >> > // Find the next 0 degree value
> > > >> > degreesZero = degreesZero + increment;
> > > >> > increment = increment + step;
> > > >> > }
> > > >> >
> > > >> > // End Square Of Nine ************
> > > >> >
> > > >> > PlotOHLC(Open,High,Low,Close,"",colorBlack, styleCandle);
> > > >> >
> > > >> > TitleStr= Interval(2) ;
> > > >> >
> > > >> >
> > > >> > Title = TitleStr;
> > > >> >
> > > >> >
> > > >> >
> > > >> >
> > > >> >
> > > >> >
> > > >> > 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
> > > >> >
> > > >> >
> > > >> >
> > > >> >
> > > >> >
> > > >> >
> > > >> >
> > > >> >
> > > >>
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > 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
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > >
> >
> >
> >
> >
> >
> >
> > 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
> >
> >
> >
> >
> >
> > SPONSORED LINKS
> > Investment management software
> > <http://groups.yahoo.com/gads?
t=ms&k=Investment+management+software&w1=Investment+management+softwa
re&w2=Real+estate+investment+software&w3=Investment+property+software
&w4=Software+support&w5=Real+estate+investment+analysis+software&w6=I
nvestment+software&c=6&s=200&.sig=_XXUzbE9l5lGlZNcMu4KNQ>
> > Real estate investment software
> > <http://groups.yahoo.com/gads?
t=ms&k=Real+estate+investment+software&w1=Investment+management+softw
are&w2=Real+estate+investment+software&w3=Investment+property+softwar
e&w4=Software+support&w5=Real+estate+investment+analysis+software&w6=
Investment+software&c=6&s=200&.sig=5_sgDczz3ArKGMtJ9tFSJA>
> > Investment property software
> > <http://groups.yahoo.com/gads?
t=ms&k=Investment+property+software&w1=Investment+management+software
&w2=Real+estate+investment+software&w3=Investment+property+software&w
4=Software+support&w5=Real+estate+investment+analysis+software&w6=Inv
estment+software&c=6&s=200&.sig=_N6zcwefgp4eg5n6oX5WZw>
> >
> > Software support
> > <http://groups.yahoo.com/gads?
t=ms&k=Software+support&w1=Investment+management+software&w2=Real+est
ate+investment+software&w3=Investment+property+software&w4=Software+s
upport&w5=Real+estate+investment+analysis+software&w6=Investment+soft
ware&c=6&s=200&.sig=MJ2jP31F3n64RDZkDadU8w>
> > Real estate investment analysis software
> > <http://groups.yahoo.com/gads?
t=ms&k=Real+estate+investment+analysis+software&w1=Investment+managem
ent+software&w2=Real+estate+investment+software&w3=Investment+propert
y+software&w4=Software+support&w5=Real+estate+investment+analysis+sof
tware&w6=Investment+software&c=6&s=200&.sig=GmF8PlAJASx0wrSaX5-Zlw>
> > Investment software
> > <http://groups.yahoo.com/gads?
t=ms&k=Investment+software&w1=Investment+management+software&w2=Real+
estate+investment+software&w3=Investment+property+software&w4=Softwar
e+support&w5=Real+estate+investment+analysis+software&w6=Investment+s
oftware&c=6&s=200&.sig=aMgGsKT4w29dMAYUzQUKzg>
> >
> >
> >
> > -----------------------------------------------------------------
-------
> > YAHOO! GROUPS LINKS
> >
> > * Visit your group "amibroker
> > <http://groups.yahoo.com/group/amibroker>" on the web.
> >
> > * To unsubscribe from this group, send an email to:
> > amibroker-unsubscribe@xxxxxxxxxxxxxxx
> > <mailto:amibroker-unsubscribe@xxxxxxxxxxxxxxx?
subject=Unsubscribe>
> >
> > * Your use of Yahoo! Groups is subject to the Yahoo! Terms
of
> > Service <http://docs.yahoo.com/info/terms/>.
> >
> >
> > -----------------------------------------------------------------
-------
> >
>
------------------------ Yahoo! Groups Sponsor --------------------~-->
Try Online Currency Trading with GFT. Free 50K Demo. Trade
24 Hours. Commission-Free.
http://us.click.yahoo.com/RvFikB/9M2KAA/U1CZAA/GHeqlB/TM
--------------------------------------------------------------------~->
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
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/
<*> 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/
|