When I examined back test results, I realized that Ninja was computing ROC of first 40 candles incorrectly. It was computing ROC relative to the very first Candle of 1st October and not looking back into any earlier data even though it existed. This causes strategy to enter trade little sooner.
Reason for premature trades is fairly obvious once I saw the ROC code. First line of ROC sets barsAgo to lesser of CurrentBar and Period.
protected override void OnBarUpdate()
{
int barsAgo = Math.Min(CurrentBar, Period);
Value.Set(((Input[0] - Input[barsAgo]) / Input[barsAgo]) * 100);
}
Question one When Ninja has data of September, why did it not use that data to compute ROC?
Question 2) Is there a way to make Ninja look at data immediately prior to back test dates? I want to make Ninja use data for computing/plotting but not taking back-test trades.
I also happen to have Amibroker with identical data. Amibroker back-test did compute ROC of first 40 candles relative to actual 40th Candle in september. Net net, Amibroker handles strategy as I expected ...
Comment