#### Topic: error message

this keeps coming see attachment

#### Re: error message

Thanks for the report, I'll look into the indicator.

#### Re: error message

Re-upload it from the repo again and report back if it works now (I couldn't replicate the error).

#### Re: error message

same indicator same error again

#### Re: error message

Footon, you can greatly improve the performance of this indicator.

Now, if we have 50000 bars and the indicator period is 500, it checks  (50000-500)*500 = 24 750 000 times the signal conditions.

You can easily remove the loop-back cycle.

``````for (int iBar = firstBar; iBar < Bars; iBar++)
{
for (int l = 1; l <= Period; l++)
{
if (Close[iBar-l] > Open[iBar-l])
countup++;
...
...
}``````

You can calculate it with one pass with something like that:

``````for (int iBar = firstBar; iBar < Bars; iBar++)
{
if (Close[iBar-period] <= Open[iBar-period])
countup--;
if (Close[iBar] > Open[iBar])
countup++;
...
}``````

In that way you will calculate it with only 49 500 checks.

...

The error is division by zero. It looks like there are conditions where it happens. The solution is to check if the divisor is 0 prior to division.

#### Re: error message

same indicator same error again

What data do you use? Tell me timeframe and source of it.

#### Re: error message

Thanks for the tip, my brain is a little bit fried at the moment as I caught a cold or something, I'll review the code in a more clear state of mind later.

Popov wrote:

Footon, you can greatly improve the performance of this indicator.

Now, if we have 50000 bars and the indicator period is 500, it checks  (50000-500)*500 = 24 750 000 times the signal conditions.

You can easily remove the loop-back cycle.

///

In that way you will calculate it with only 49 500 checks.

...

The error is division by zero. It looks like there are conditions where it happens. The solution is to check if the divisor is 0 prior to division.

#### Re: error message

Bloody flu, I made an error in the previous fix, you are absolutely correct Pradeep. Now it should be better. Reload from repo.

#### Re: error message

I am receiving following errors during strategy search with FSB.

I have removed this indicator (Bar Type) from the Active Indicators List to avoid this problem. As I understand it is not an external indicator from Repository, but it is a build in indicator.

Leon

#### Re: error message

I'm working on solving this problem since yesterday, sorry for the trouble!

#### Re: error message

Uh, finally got that divide by zero under control, the answer was in front of me all the time, but I overlooked it for so long. The code is optimized (thanks to Miroslav and his brilliant solution, why didn't I come up with it myself ).

Report if problems of different sort pop out.