Hi, many times HasStreamingBar does not detect that it's real-time. The following was run during trading hours. Note the text label in the screenshot.
The strange thing is that if I uncheck the stream button it will indicate that it's real-time.
The strange thing is that if I uncheck the stream button it will indicate that it's real-time.
CODE:
//create indicators and other objects here, this is executed prior to the main trading loop public override void Initialize(BarHistory bars) { if (bars.HasStreamingBar){ DrawHeaderText("Real Time", WLColor.Azure, 15); } else DrawHeaderText("Not real Time", WLColor.Azure, 15); }
Rename
HasStreamingBar is not intended to be used in a Strategy. It's used internally by our charting component.
From our docs:
Is there a better way to accomplish that?
What are you trying to accomplish?
I am trying to update the last bar indicator based on the latest price.
I think I found the solution. Check Bars.Close.StreamingValue for NaN.
I think I found the solution. Check Bars.Close.StreamingValue for NaN.
Well, that's also unreliable :(
It's just not feasible in a Strategy. A Strategy executes at one specific point in time. For backtesting purposes, what difference does it make what the current streaming price is?
You got it.
Here's how CalculatePartialValue() starts for the Indicators that do that ...
Here's how CalculatePartialValue() starts for the Indicators that do that ...
CODE:
//calculate partial value public override bool CalculatePartialValue() { StreamingValue = Double.NaN; TimeSeries source = Parameters[0].AsTimeSeries; if (Double.IsNaN(source.StreamingValue)) return false; Int32 period = Parameters[1].AsInt; : :
Your Response
Post
Edit Post
Login is required