PureBytes Links
Trading Reference Links
|
At 11:53 AM -0800 12/13/01, ztrader wrote:
>D> Z-man, I haven't tried your code but here's a theory. :-) Are you
>D> using the automatic MaxBarsBack?
>
>Bingo! Your theory is good. That was the problem - it does go through
>twice, and apparently from the VERY beginning, with defaults reset as
>well, just like turning status off then back on. This would make it
>very hard to set anything in the program to work around this, although
>a global variable outside the study would do it.
It is easy to observe if you simple print the value of MaxBarsBack:
if CurrentBar = 1 then Print(MaxBarsBack:4:0);
In complex cases where the look-back period is a function of the data, it might have to try many times to find a value that works.
It also forces the MaxBarsBack setting to a value of the maximum look-back interval even if you only look that far back on the last bar of the chart. For example, the following code requires a MaxBarsBack setting of 200 even though it plots back only on the last bar where you typically have far more than enough bars available. Frustrating...
if LastBarOnChart then begin
for j = 1 to 200 begin
Plot1[j](MyArray[j], "1");
end;
end;
Bob Fulks
|