I have studied the differences between historic and live bars and in order to create the custom series the same as live data , once the first tick is seen after the 10 min bars close, I set my custom series, (if its not the tick after the min bar closed I just update index 0 of my custom series)
if(barJustClosed) { Print("First Tick of min bar just seen. Current 1 tickBar = "+ CurrentBars[0] + " Price " + Closes[0][0]); barJustClosed = false; //set our custom series to replicate closings of live bars fastClose[1] = Closes[0][1]; fastClose[0] = Closes[0][0]; } else //keep custom series updated with current close fastClose[0] = Closes[0][0];
I have run the attached indicator on the same days data and compared the output of both and despite the series being extremely close,( there are a few ticks difference due to the expected differences due to different data sources.). The Linear Regression of both have huge differences and the Linear Regression of the custom data series is way out from expected values.
Here is an example of the outputs form the run on Live via Historic ;
HISTORIC
Current 1 Tick Bar number 163265 Time 20/04/2016 21:46:50 Price 163.27
fastClose[0] = 163.27
fastClose[1] = 163.27
fastClose[2] = 163.27
fastClose[3] = 163.25
fastClose[4] = 163.26
fastClose[5] = 163.26
fastClose[6] = 163.26
fastClose[7] = 163.26
fastClose[8] = 163.26
fastClose[9] = 163.25
Time 20/04/2016 21:46:50 LinReg FastClose 163.46872727273
LIVE
Current 1 Tick Bar number 210727 Time 20/04/2016 21:46:49 Price 163.27
Closes[0] = 163.27
Closes[1] = 163.27
Closes[2] = 163.27
Closes[3] = 163.25
Closes[4] = 163.26
Closes[5] = 163.26
Closes[6] = 163.26
Closes[7] = 163.26
Closes[8] = 163.26
Closes[9] = 163.25
Time 20/04/2016 21:46:49 LinReg Closes Min Bars 163.270000000002
So I would like to get to the bottom of why the LinReg on the custom series is so out. I have attached a sample indicator to demo the problem. Couldn't attach the output files as they were to big
Comment