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

Re: CL_Need ELA help PLEASE!



PureBytes Links

Trading Reference Links

I am mistaken about the MBB not eliminating the first "Hello". Set MBB
to 11 does eliminate it.

If the code is modified as below and the debug window viewed, some
interesting things are revealed. For the chart given below there are a
total of 15 bars. When MBB is set to 11 (the minimum possible), 11 of
the first bars are used to initiate settings relating to the plots. From
the plots k = 2, j=9. From the prints k=2, j=9, barnumber is 1 to 4, and
1 "Hello". This shows that the first part of the code is restricted from
using the first 11 bars (otherwise k would be larger). There are a total
of 10 instances of where the condition High[i] - Close[i + 1] > .10 can
be meet. 9 of these are recorded only inside the for loop which is not
restricted to only the last 4 bars but has access to the last 11 (i=0 to
10) the bars. There are 2 cases of the condition being meet in the last
4 bars.

When MBB is set to 14, from the plots k = 1, j=9. From the prints k=1,
j=9, barnumber is 1 (= bar 15), and 1 "Hello". 14 bars are stipulated
for setup and the first part of the code is not allowed to see these
bars. On the last bar (#15) the condition is meet once and k=1. Again,
the for loop has access to the last 11 bars. 

The conclusion is two fold:

1.) MBB, if set on auto, runs all the bars through the code once to
determine MBB and then starts again that many bars from the beginning
bar. If manually set, it runs through only that number set to do the
initialization and continues calculation starting at that number of bars
from the beginning bar.

2.) Lookback code, such as loops, can access the MBB bars that were used
for initialization whereas other code can not.

To see how many MBB TS determines, set it on auto and add a print the
number of bars (print(barnumber)) in the code. View the debug or
messagelog window and see the difference between the first time through
compare to the second time through. This is MBB.


var: j(0), i(0),x(0), b(0), k(0);

If High[0] - Close[1] > .10 then begin
	k = k + 1;
	plot2(k,"k");
print(d,t,k, "K");
end;

If lastbaronchart then begin
     for i = 0 to 10 begin
        If High[i] - Close[i + 1] > .10 then 	j = j + 1;				
     end;
	 Print(j,"Hello" );
	 plot1(j,"j");

 end;
print(d,t,barnumber,"bar");





John Manasco wrote:
> 
> Why does this code print the word Hello twice and what can I do about it? I
> only want it to print once. Seems TS2Ki wants to initialize the code by
> going through it once and then executing it. I'm trying to create a report
> for EOD data.
> 
> Thanks
> John
> 
> If lastbaronchart then begin
>     for i = 0 to 10 begin
>        If High[i] - Close[i + 1] > .10 then j = j + 1;
>     end;
>     Print( "Hello" );
> end;
Attachment Converted: "f:\eudora\attach\ACV.gif"