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?