CalculateOnClose = true throughout this discussion.
The StopLoss was set or "submitted to" the secondary bar series, so I would expect that unless the secondary bar series trades through the stop loss, it would not be triggered in a back test.... as would be the case in real life.
//Submit SL to secondary Bar Series
if(BarsInProgress == 10)
{
...
EnterLong(100000);
SetStopLoss(CalculationMode.Ticks,upStopLoss);
}
This is a shot of the back test results showing an entry time of 8:56:28 AM which is the timestamp of the entry bar on the secondary bar series. (timestamps are close of bar, the open of the entry bar is at 8:37:04)

It shows an exit at SL at 8:40:48 AM which is a timestamp at close of a primary bar series bar.
This is apparently made possible because the entry bar on the secondary time series Opens before the primary bar series bar closes. Secondary entry bar Opens at 8:37:04, where the primary series bar closes at 8:40:48, with the primary series bar having traded during its formation below the SL level.
Here's a shot of the secondary bar series with the entry:

Here's a shot of the Primary Bar Series.

Please confirm that I am interpreting these results accurately.
If I am I have two ideas to solve this problem, and would appreciate feedback on these two ideas.
1. Since it appears that SetStopLoss always applies to the primary bar series, I could do away with it, and get the behavior of a SL by submitting an order in the opposite direction, submitted to the secondary bar series under BarsInProgress == 1, using Positions[1].MarketPosition to know where I am.
2. Easier and I think with some side benefits, I could use a very small chart period for the primary bar series... adding granularity. I could use a 100 tick chart as the primary bar series and have all my logic applied to secondary... much larger chart periods, so that I would never run into the above problem.
I know this is long post, but I wanted to be clear on a confusing situation. Hopefully it will help others in the future. Please tell me if my diagnosis is correct what you think of my solutions... I particularly like adding granularity.

Comment