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

[amibroker] Help with code bringing Ami to a grinding halt



PureBytes Links

Trading Reference Links

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;





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