Without using the Trend series, the algorithm works well on historical data. With it, it does nothing. No compilation errors or log errors were given. I am assuming therefor that I am not adding the string values correctly to the Trend series.
I would appreciate it if someone can point me in the right direction to fix this.
Below is the skeleton code I am using to execute.
else if (State == State.DataLoaded)
Trend = new Series<string>(this);
protected override void OnBarUpdate()
{
if (IsFirstTickOfBar)
{
CheckMarketTrend();
}
if (Trend[0] == "long")
{
///Execute logic to enter long position
}
}
private string CheckMarketTrend()
{
if (stochastic5min.D[0] <= 20)
{
return Trend[0] = "long";
}
////logic continues setting Trend[0] = "long", "short" or "donothing" using logic structure of above example ending with an Exception to catch anything falling outside the scope given.
}
Comment