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

RE: LastBarOnChart seems to execute more than once



PureBytes Links

Trading Reference Links

This code is executed twice by TS.  Notice how it prints twice to the debug
window

If LastBarOnChart Then Begin
	For i = 0 To 10 Begin
		Print(C[i]);
	End;
	Print("-------");
End;

Take out the subscript i in the C statement and then code in the if block
only executes once

If LastBarOnChart Then Begin
	For i = 0 To 10 Begin
		Print(C);
	End;
	Print("-------");
End;

Notice how this prints once to the debug window.  This topic has been
discussed before on this list.

Would anyone care to comment about why TS does this?

B.



-----Original Message-----
From: Leslie Walko [mailto:l.walko@xxxxxxxxxxx]
Sent: Monday, November 11, 2002 9:27 AM
To: DH
Cc: Omega List
Subject: Re: LastBarOnChart seems to execute more than once


Thanks to Dennis and Bill Brower for replying.
(Ok, this is a bit of a complex topic.)

The short answer is that

(1)any system logging function will generate one additional call
(hence one more print statement) when the chart is redrawn with the
best results.
(2) Another line is generated when the optimizer sorts the results and
selects the best result.
(3) Another, 3rd call is made to the strategy, hence to the the print
function when the strategy is INSERTED into the window.

There is more to the issue than the summary,
but just be careful when collecting performance
statistics using custom calculations.

Leslie


DH wrote:
>
> > If I step a parameter from 30 to 50 in steps of 20, I expect TWO runs
> > and two lines.
> > However, I find FOUR lines in the .csv file.
>
> I'm not sure what's going on with the four lines. You already have the
> chart open when you delete the file, right? If so, I would expect three
> lines, the two for the optimization and then a third when it redraws the
> chart with the best value. Something sure looks screwy with the output
> values. Try hard coding your function code into the signal and see if
> that will get it down to three lines that make sense, i.e. correct
> numbers for all vars with the best run printed again at the end.
>
> --
>   Dennis

--
Regards,
Leslie Walko
610-688-2442
--
 "Life is a tragedy for those who feel, a comedy for those who think"
	Horace Walpole, 4th earl of Orford, in a letter dated about 1770