It doesn’t make any sense to mark local method variables as private
. That is what is causing your errors.
Why the compiler is giving you an }
expected error, I’m not sure. I’m guessing that the compiler is assuming that private int howmanybars
is being interpreted as a private instance field definition, which cannot be declared inside a method. So it is telling you that it expects the Bullish
method to end before the declaration.
protected bool Bullish(int ConsecutiveBullishBars)
{
int howmanybars = ConsecutiveBullishBars - 1;
bool IsMarketBullish = false;
while (howmanybars >= 0)
{
if (Close[howmanybars] > KeltnerChannel(Offset, Period)[howmanybars])
{
IsMarketBullish = true;
}
else
{
IsMarketBullish = false;
}
howmanybars--;
}
return IsMarketBullish;
}
2
solved Getting CS1513 } Expected, but all braces are there [closed]