Strange bug with indicator buffers

How to create strategies and indicators
Message
Author
holo
Posts: 2
Joined: Mon Jul 13, 2015 5:53 pm

Strange bug with indicator buffers

#1 Postby holo » Mon Jul 13, 2015 6:26 pm

I'm using Visual C++ Express to convert my MT4 indicator into FT2 and have come up against what seems to be a very strange bug when using the indicator buffers.

Basically, any assignments I do from one indicator buffer to another do not work. For example, the following test code creates an EMA and copies it to another buffer:

Code: Select all

   MidEnv[i] = GetMA(i, 0, 20, ma_EMA, pt_Low, MidEnv[i + 1]);      //Calculates/stores an EMA(20) into the MidEnv buffer.
   UpperEnv[i] = 1.595;         //Temporarily set UpperEnv to some value.
   UpperEnv[i] = MidEnv[i];      //Immediately overwrite UpperEnv with MidEnv (copies the EMA).

UpperEnv should be the same as MidEnv however it is not - it paints as a horizontal line at 1.595, completely ignoring the final assignment.

If however I change the last line to:

Code: Select all

   UpperEnv[i] = MidEnv[i] + 0;    //Immediately overwrite UpperEnv with MidEnv (copies the EMA) and add Zero.

Simply adding zero during the assignment now makes it work as expected and two identical EMAs are shown on the screen.
I have found adding any other constant works too. I have tried VC++ 2010 and VC++ 2013 but both have exactly the same behavior.

There are many buffer assignments throughout my indicator so i've had to add "+ 0" to loads of lines to make it work. Eventually I got my indicator to work like it did in MT4 but I really don't like fudging all these lines of code to make them execute correctly.

Can anyone tell me what is up with this? Is it a bug in FT2, or the DLL being created, or something important missing in my code?

FX Helper
Posts: 1479
Joined: Mon Apr 01, 2013 3:55 am

Re: Strange bug with indicator buffers

#2 Postby FX Helper » Tue Jul 14, 2015 9:05 am

Hello,

It seems that this is a bug of C++ API, Delphi API shouldn't have this bug.

holo
Posts: 2
Joined: Mon Jul 13, 2015 5:53 pm

Re: Strange bug with indicator buffers

#3 Postby holo » Wed Jul 15, 2015 11:55 am

Thanks for the reply FX Helper.

Do you know if this will this be fixed any time soon?
It seems pointless learning the nuances and syntax of another programming language which I am not familiar with (and probably many of your other customers are not familiar with too) when there is a perfectly good C++ API which we should be able to use.

FX Helper
Posts: 1479
Joined: Mon Apr 01, 2013 3:55 am

Re: Strange bug with indicator buffers

#4 Postby FX Helper » Fri Jul 17, 2015 4:31 am

Hello,

I will transfer this issue to our programmers so they can check if this issue can be fixed in next versions of Forex Tester.


Return to “FT API”

Who is online

Users browsing this forum: No registered users and 6 guests