I've been trying to figure out how to resolve this error: Error on calling 'OnBarUpdate' method on bar 20: Index was outside the bounds of the array.
I spent a whole day and no luck. am trying to set a condition where the faster plot with period x is less than the plot with the period y. Code below:
protected override void OnBarUpdate()
{
if (BarsInProgress != 0)
return;
if (CurrentBars[0] < 1)
return;
// Set 1
if ((HMO1.Main_Plot[0] > HMO2.Main_Plot[1]))
{
EnterLong(Convert.ToInt32(DefaultQuantity), "");
ExitShort(Convert.ToInt32(DefaultQuantity), "", "");
}
Comment