Another thing that caught my attention, not sure if this is a bug or just me misunderstanding something.

My understanding is that LifeTime is supposed to set the maximum number of bars that a position is open. I think this parameter used to be called ExitTime, and my understanding was that ExitTime can still be used interchangeably with LifeTime. However when running a simple strategy like this with 1.74:

Code:
function run()
{
	StartDate = 2010;
	EndDate = 2011;
	LookBack = 200;
	BarPeriod = 240;
	
	vars close = series(priceClose());
	vars ll = series(LL(10));
	
	LifeTime = 5;	
	MaxShort = 1;

	if(close[0] < ll[1]) {
		enterShort();
	}	
}



I get this in the performance report
Code:
Avg trade bars      7 (+9 / -6)
Max trade bars      26 (4 days)


which is not at all what I would expect.

If however I change LifeTime to ExitTime, I get
Code:
Avg trade bars      4 (+4 / -4)
Max trade bars      4 (16 hours)


which is what I expect.

Is this a bug, or did I misunderstand LifeTime and ExitTime? I think at least the manual is LifeTime is very hard to misinterpret: "Trade time limit in bars. Close the trade automatically after the given number of bars (default: 0 for no time limit)."

Last edited by Dalla; 01/09/18 20:35.