Bars since open
24 May 2015, 10:30
Hi guys,
I am working on a strategy where close position happens after X bars.
in my OnBar() i obtain the current bar index: int index = MarketSeries.Close.Count - 1;
My question is: how I can obtain the bar index of a currently open position (I am using positions.find function) ?

mindbreaker
24 May 2015, 13:14
RE:
3052551 said:
int CountBars = 0; // close after int CloseAfter = 10; OnBar(){ CountBars++; if(CountBars > CloseAfter) { CountBars = 0; // close here Close(position); } }This simple example.
@mindbreaker