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

[amibroker] code logic help?



PureBytes Links

Trading Reference Links

Hi

I am having problem with a calc that I have worked around by manually
drawing the lines each morning on the different timeframe charts i
use. I have a calc that loops many many times and kills performance.

I think that i would be able to calc this while loop (once) and then
put the "roundedValue" to be plotted as a price s/r line in an array,
then just call the array continiously to plot the line as the day
progreses.

Is this correct thinking? If so, can someone point me in the right
direction to achieve this... If not don't laugh to hard at my
backwards thinking :) thanks for any help

PlotOHLC(O,H,L,C,"",colorBlack, styleCandle);

HHVBarsH = HHV(H, 100) ;
LLVBarsL = LLV(L, 100) ;
step = 8;
//maxDegreesZero = round(HHVBarsH);
//degreesZero = round(LLVBarsL);
maxDegreesZero = 900;
degreesZero = 1;
increment = 1;
degreesValueInt = 0;
angleFactor = 0;
sqrtDegreesZero = 0;
degreesValue = 0;
LastBar = BarCount-1;


while (degreesZero < maxDegreesZero)
{
sqrtDegreesZero = sqrt(degreesZero);

for (angle = 0; angle < 360; angle = angle + 11.25)
{
angleFactor = (angle / 360.0) * 2.0;
degreesValue = (sqrtDegreesZero + angleFactor) ^ 2;
roundedValue = round(degreesValue);

if (roundedValue[LastBar]< (HHVBarsH[Lastbar]) AND
roundedValue[LastBar]>(LLVBarsL[Lastbar]) ){
Plot(Prec(roundedValue,2), "",
colorGrey40,styleLine, -(LLVBarsL[Lastbar]),(HHVBarsH[Lastbar]));
}

}

degreesZero = degreesZero + increment;
increment = increment + step;
}

Title = Interval(2) + " " +
WriteVal( SelectedValue( DateTime() ),
formatDateTime) ;