With the latest build there is no crash but it still takes about 15 seconds to load the indicator. Again, that is very unusual as I have very complex strategies that load almost instantly on my (very fast) system.
This is my current OnBarUpdate() method:
/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
if (Bars.BarsSinceSession > 5) {
//Log("" + Bars.BarsSinceSession, LogLevel.Information);
// highest bar of day:
double dailyHigh = MAX(High, Bars.BarsSinceSession)[0];
Log("Bars since Session: " + Bars.BarsSinceSession, LogLevel.Information);
if (dailyHigh == High[0]) {
BarColor = colorDayHigh;
Log("Highest at: " + High[0], LogLevel.Warning);
//DrawText("highest" + CurrentBar, false, "highest", 0, High[0], 10, Color.White, new Font("Arial", 8, FontStyle.Bold),
// StringAlignment.Center, Color.Transparent, Color.Transparent, 0);
}
}
If I change the code to this:
/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
if (Bars.BarsSinceSession > 5) {
//Log("" + Bars.BarsSinceSession, LogLevel.Information);
// highest bar of day:
double dailyHigh = MAX(High, Bars.BarsSinceSession)[0];
double dailyLow = MIN(Low, Bars.BarsSinceSession)[0];
//Log("Bars since Session: " + Bars.BarsSinceSession, LogLevel.Information);
if (dailyHigh == High[0]) {
BarColor = colorDayHigh;
Log(Instrument.FullName + " touching daily HIGH at: " + High[0], LogLevel.Warning);
//DrawText("highest" + CurrentBar, false, "highest", 0, High[0], 10, Color.White, new Font("Arial", 8, FontStyle.Bold),
// StringAlignment.Center, Color.Transparent, Color.Transparent, 0);
} else if (dailyLow == Low[0]) {
BarColor = colorDayLow;
Log(Instrument.FullName + " touching daily LOW at: " + Low[0], LogLevel.Warning);
}
}
}
double dailyHigh = MAX(High, Bars.BarsSinceSession)[0];
double dailyLow = MIN(Low, Bars.BarsSinceSession)[0];

Comment