Profile Picture

Strange behavior with indicators calculated in trading system run on 16+ years of EOD data

Posted By dwalton 2 Years Ago

Strange behavior with indicators calculated in trading system run on...

Crazy Posted Thursday June 02 2016
Here is my setup...
* Using Norgate integrated watchlist data store.
* Simulating a stock universe (including delisted) of the S&P 500
* Data Start Date 1/1/1999
* Trade Start Date 1/1/2000

I'm seeing very strange behavior from indicators calculated in my trading system. Basically it looks like the calculation is shifted (look ahead) by over a year -- last indicator value is 5/17/2015 whereas last bar data is 5/31/2016. I've attached a chart illustrating this. I use the built-in simple moving average indicator with a 200 bar period (light blue line named _symbolSMA in the trading system). If I open a chart from the trading system results and then manually add another 200-bar simple moving average (Purple line in the chart), it is calculated correctly.

Some additional data... If I start the simulation later (shift data and trade start days a year later or more), the indicators get calculated correctly.

I can provide code if that helps debug it. Please advise if there is a known issue that would explain this.


Posted Friday June 03 2016
Can you add some logging to your system for the value of the SMA, and see whether those values are correct or whether they match what's shown on the chart?  It's possible the indicator is being calculated correctly but is being displaced when it is being displayed on the chart.

Posted Friday June 03 2016
Daniel, I added logging and the indicator is indeed calculated correctly and just wrong on the chart. I found this by using the chart and associated indicators to check my entry/exit signals. Obviously if the chart is wrong the signals don't make sense.
Posted Wednesday March 14 2018
I experienced the same error with a simple moving average. The average itself is calculated correctly but not displayed correctly on the chart. Is there a fix to this behaviour?

Similar Topics

Reading This Topic

2005-2018 © RightEdge Systems