Page 1 of 1

### IndicatorCounted in FT3

Posted: Thu Jun 29, 2017 5:14 am
IndicatorCounted function is not present in FT3 API, so how would you convert this MQL4 loop to FT3?

Code: Select all

`int counted_bars = IndicatorCounted();if (counted_bars > 0) { counted_bars--; }int limit = Bars - counted_bars;for (int i = 0; i < limit; i++) {   // calculations happen here using High(i), Low(i), Volume(i), etc...}`

I couldn't figure it out from the documentation.

### Re: IndicatorCounted in FT3

Posted: Fri Jun 30, 2017 7:51 am
egorpe wrote:IndicatorCounted function is not present in FT3 API, so how would you convert this MQL4 loop to FT3?

Code: Select all

`int counted_bars = IndicatorCounted();if (counted_bars > 0) { counted_bars--; }int limit = Bars - counted_bars;for (int i = 0; i < limit; i++) {   // calculations happen here using High(i), Low(i), Volume(i), etc...}`

I couldn't figure it out from the documentation.

You can use your calculations in the Calculate method.

For example, you have next code

Code: Select all

`in start(){   int counted_bars = IndicatorCounted();   if (counted_bars > 0) { counted_bars--; }   int limit = Bars - counted_bars;   for (int i = 0; i < limit; i++) {      // calculations happen here using High(i), Low(i), Volume(i), etc...   }}`

So in ForexTester this code should be like this

Code: Select all

`EXPORT void __stdcall Calculate(int index){   // calculations happen here using High(index), Low(index), Volume(index), etc...}`

### Re: IndicatorCounted in FT3

Posted: Tue Jul 11, 2017 11:13 pm
Yeah, I figured that out but it is still messed up in some way.

I tried to port a better volume indicator from MQL to ForexTester.

My code is on GitHub.

The original is here https://github.com/egorpe/ForexTester-B ... me-1.4.mq4

The port is here https://github.com/egorpe/ForexTester-B ... me-1.4.cpp

It is a basic copy and paste but the results are completely messed up in ForexTester version.

What am I doing wrong?