Download MetaTrader 5

integrating a second custom indicator

To add comments, please log in or register
Michael Behr
456
Michael Behr  

Hello to the experts,

I've been using the following concept in MT4, but in MT5 there must be something more to implement to make it work:

a part within the MT 5 custom indicator is

while (i<rates_total)

{

//         code......

       i++;

             }

Now a second (external) custom indicator is to be used within that indicator 

in the declaration part of the main indicator (to address the second one) is:

double      MA[];                // array for the indicator iMA

int         MA_handle;           // handle of the indicator iMA

--

int the  init part the usual:

MA_handle=iCustom(_Symbol, 0, "Examples\\CustomOne",parameters....); 

--

in the  OnCalculate part as usual:

CopyBuffer(MA_handle,0,0,rates_total,MA);

ArraySetAsSeries(MA,true);    

Now, when checking the value of the external indicator outside of the "while part" above by using

Comment(MA[0]); everything is fine;

but when putting Comment(MA[0]); within the "while part" there are no correct values, even when using the cycle variable "i" by implementing

Comment(MA[i]); there is no correct effect.


So is this  "obstacle" caused  by not using the Comment function or the variable(s) correctly within the MT5 cycle, althoug "i" is regularly used in that cycle?

 For any hints how to correct this, thanks in advance of course!

Alexander Fedosov
10180
Alexander Fedosov  

Part of code when use Comment() 

Please use SRC Code 

To add comments, please log in or register