I have a simple indicator I have been working, but have found that it does not perform in real time (during market replay) as I would like because of how the data is gathered intraday. I am simply trying to get a price range delta between a specific time period during the day and then maintain that as a running value by adding to the next days value...So on and so on.
I found that if I pick a range at the end of the day, it can't update intraday because it does not have the info so the real time execution does not work well. At least that is my theory. So I had a couple ideas:
1) If I lag the calculation by one day, then it should always have enough data to continue a running sum. This may not be the best option, but I think it will work.
2) Use the first option, but also have a range intraday that then carries from that point on... So I would have the last days range, then at a specific time, it would add the intraday range and carry that value forward. So I may have an early morning range that then is added to the previous days value and runs until EOD.
The issue I am having is coding the indicator to do either of these. Right now it works fine when just used for historical or backtesing purposes. But when I run real time, i see the problem. So I'm hoping I can get some suggestions on how to do this. I'm getting hung up on setting Values as well... Still not real clear how to use the last days value as todays. Also, I would think that I could pick an intraday period (lets say in the morning) and then have that add to the previous days value and carry that forward for the remainder of the day. (I'll have to add another set of input parameters to do this).
I have attached what I have for review. I am currently just testing this on SPY with a 30 min period. Please feel free to suggest better ways as well. I was thinking maybe a ToTime approach for the specific period might work better and be simpler, but it was not clear to me if this is the case.
Thanks to all of you that help us novice C# ers.
Regards,
Lee
Comment