int barShift=-1; if(sec.Positions.LastPositionActive!=null) barShift=k-sec.Positions.LastPositionActive.EntryBarNum;