Support Board
Date/Time: Mon, 25 Nov 2024 07:52:42 +0000
Post From: Can I plot data from file into the future on a chart?
[2014-01-14 17:13:49] |
WarEagle - Posts: 73 |
I just wanted to update this thread for users in the future facing a similar issue. I found my mistake thanks to your help. First of all I was not even running the for loop at the end because I used if(sc.Index >= sc.ArraySize)
instead of if(sc.Index+1 >= sc.ArraySize)
so the loop was never entered. Once I fixed that, I still had the problem of not accessing the correct PriceArray value from the second chart. It was simply a matter of getting the correct index value from PriceArray[]. After several different ideas I figured it out: if(sc.Index+1 >= sc.ArraySize)
{ for (int i = sc.ArraySize;i < sc.ArraySize + NumberOfBarsToForwardShift ;i++) { int PriceArrayShift = i - sc.ArraySize +1; ForecastOverlay[i] = PriceArray[TheirIndex + PriceArrayShift]; } } I just needed to start with the last known index value for PriceArray[] (when it was equal to sc.Index) and then add PriceArrayShift for each iteration of the plot forward to keep the indexes aligned. Hope that helps in the future. Thanks again SC! |