Profile Picture

Misaligned indicators

Posted By andreas_clenow 3 Years Ago
Message
Nuclear Posted Tuesday March 04 2014
I've come across an odd behavior and possibly a bug in regards to making custom indicators. In simulations on multiple instruments, the custom series sometimes get displaced on the x-axis.

I made a clean example to demonstrate. My indicator here simply returns the current close value (input value). As a test, I made this simple indicator both as a compiled dll and in a class in a RE project.

 
protected override double CalcNewValue(int index)
{
return inputs[0].LookBack(index);
}


If I run this on any single instrument, and plot the indicator in a chart, it comes out just fine. See reSeries1.png attached. It even works fine with some combinations of instruments. No pattern found yet. If I run on many instruments, it fails. If I keep increasing the portfolio, one instrument at a time, it fails after a few are added. No pattern as to which instruments cause the problem. If it was fine with three instruments, and adding a fourth fails, it still fails if that fourth instrument is removed before the next run.

So what does fail mean? It means that the series got misaligned. See image reSeries2.png attached. Same function used. The indicator line is in effect showing the future.

I tried setting Synchronize Bars to both true and false, but no difference.

Am I missing something big here, or did I stumble upon a pretty serious bug?

Update:
Further investigations tell me a couple of interesting points:
1. Even if the data is drawn wrong, it appears as if the series are in fact correct. I did a test in NewBar for (Close.Current == indicator.Current), which is always true as it should be. Even if the data is drawn like in image 2.
2. The problem seems related to LeadBars and only occurs if this property is set. Setting Data Start and Trade Start instead makes the whole problem go away.

Attachments
reSeries1.png (273 views, 41.00 KB)
reSeries2.png (242 views, 39.00 KB)

Edited: Tuesday March 04 2014 by andreas_clenow
Posted Sunday March 23 2014
Hi Andreas,

Does this occur with a non-custom indicator? I tried to reproduce this just using a 1-period SMA, and wasn't able to do so.

Any chance you could provide a set of symbols and data where you hit this issue?

Thanks,
Daniel


Similar Topics


Reading This Topic


2005-2017 © RightEdge Systems