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

LastBarOnChart seems to execute more than once



PureBytes Links

Trading Reference Links

Hello:

There is something strange about the interaction of LastBarOnChart and
the use of the optimizer.  Somehow, the code conditioned by
LastBarOnChart is called more than once!
This does not happen if the optimizer is NOT turned on.

Here is the code.  
In the signal I call a utility function, with the parameter settings.

{++++++++++++++++++++++++++++++}
vars: settings("");
	
if lastBaronChart then begin
	settings = "Deviations" + "," 
	+ numToStr(deviations, 2) + ","
	+ "popSize" + "," 
	+ numToStr(popSize, 2);
	
	value99 = _writeTradeResults(settings);
end;

{++++++++++++++++++++++++++++++}

The utility functions calculates statistics for plotting in Excel.

{++++++++++++++++++++++++++++++}
outFile = "C:\trade_out\" 
	+ GetStrategyName 
	+ "_" 
	+ leftStr(getSymbolName, 2) 
	+ ".csv" ;
{... calculations ...}

fileAppend(outfile, outString); 
_writeTradeResults = 1;
{++++++++++++++++++++++++++++++}

Whenever I run this:
(1) I manually delete the old file.
(2) I am careful not to view the performance report or the
optimization report prior to looking at the .csv file.

However, the .csv file contains MORE LINES than the number of
optimization runs!
Why?

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.
Here it is.

Net Daily Gain	214.02	Deviations	2	popSize	30
Net Daily Gain	79.96	Deviations	2	popSize	30
Net Daily Gain	214.02	Deviations	2	popSize	30
Net Daily Gain	214.02	Deviations	2	popSize	50

Notice that popSize = 30 showed up 3 times with different Net Daily
Gain values!
Strange.
Can someone explain this.
Help?

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