The same indicator with different settings

 

Hello,


how can I code 3 identical i-Regs with different settings?

I tried:

extern string

   i_Regr_1                   = "---i-Regr_Settings";

extern int degree_1         = 4;

extern double kstd_1        = 2.0;

extern int bars_1           = 120;

extern int shift_1          = 0;



extern string

   i_Regr_2                    = "---i-Regr_Settings";

extern int degree_2          = 4;

extern double kstd_2         = 2.0;

extern int bars_2            = 180;

extern int shift_2           = 0;



extern string

   i_Regr_3                    = "---i-Regr_Settings";

extern int degree_3          = 4;

extern double kstd_3         = 2.0;

extern int bars_3            = 240;

extern int shift_3           = 0;


BUT unfortunately that did not work? Does anybody know how to do it?


Many thanks in advance!

 
Please edit your post and use the code button (Alt+S) when pasting code.
EDIT your original post, please do not just post the code correctly in a new post.

Topics concerning MT4 and MQL4 have their own section.
In future please post in the correct section.

I have moved your topic to the MQL4 and Metatrader 4 section.


 
MJZMQL5: how can I code 3 identical i-Regs with different settings?
  1. Post in the correct place.
  2. Use the code button for code.
  3. You just show how to get different settings. Now call your indicator with each of them.
 
William Roeder:
  1. Post in the correct place.
  2. Use the code button for code.
  3. You just show how to get different settings. Now call your indicator with each of them.

William, I am sorry, I am new here! I thought that Keith Watford already moved my post? Do I still move it to another location? Furthermore, where do I find the code button? The third point I did not get at all!

 
MJZMQL5:

William, I am sorry, I am new here! I thought that Keith Watford already moved my post? Do I still move it to another location? Furthermore, where do I find the code button? The third point I did not get at all!

I had already moved this topic. I have no idea why William needed to say anything as the topic had already been moved.

I already told you about posting code.

Keith Watford:
Please edit your post and use the code button (Alt+S) when pasting code.
EDIT your original post, please do not just post the code correctly in a new post.


The button is at the top of the post window, </> in a box.

 
William Roeder:
  1. Post in the correct place.
  2. Use the code button for code.
  3. You just show how to get different settings. Now call your indicator with each of them.

Hi William,

so you are saying under point 3 that I did code/started out in the right way?

If this is correct, I added later further down in the code:

   double IRegr1Center1 = iCustom(Symbol(),0,"i_Regr",degree_1,kstd_1,bars_1,0,shift1);
   double IRegr1Center2 = iCustom(Symbol(),0,"i_Regr",degree_1,kstd_1,bars_1,0,shift2);
  
   double IRegr2Center1 = iCustom(Symbol(),0,"i_Regr",degree_2,kstd_2,bars_2,0,shift1);
   double IRegr2Center2 = iCustom(Symbol(),0,"i_Regr",degree_2,kstd_2,bars_2,0,shift2);
  
   double IRegr3Center1 = iCustom(Symbol(),0,"i_Regr",degree_3,kstd_3,bars_3,0,shift1);
   double IRegr3Center2 = iCustom(Symbol(),0,"i_Regr",degree_3,kstd_3,bars_3,0,shift

BUT when I took a look it the expert column I discovered the following error message : 

2021.05.17 08:05:23.310 cannot open file 'C:\Program Files (x86)\FTMO MetaTrader 4\MQL4\indicators\i_Regr.ex4' [2]

 So what am I missing here? What am I doing wrong here?

The original name given to the indicator and under which the I-Regr is found under indicators is "i-Regr" But it seems to me that the way I am trying to define the indicator at the beginning of the code by giving it unique numbers (i_Regr_1, i_Regr_2, i_Regr_3) does not work and is not recognized by mt4! If I simply use "i-Regr" more than once the compiler tells that the variable already exists! So what do I need to do?

 
MJZMQL5: 2021.05.17 08:05:23.310 cannot open file 'C:\Program Files (x86)\FTMO MetaTrader 4\MQL4\indicators\i_Regr.ex4' [2]

Your iCustom calls “i_Regr” but there is no such indicator in the «DataFolder»/MQL4/Indicators folder. Go look (File → Open Data Folder) and verify you put it in the correct location and compiled it.
          Data Structure in MetaTrader 4 Build 600 and Higher - MQL4 Articles 2014.02.03

 
William Roeder:

Your iCustom calls “i_Regr” but there is no such indicator in the «DataFolder»/MQL4/Indicators folder. Go look (File → Open Data Folder) and verify you put it in the correct location and compiled it.
          Data Structure in MetaTrader 4 Build 600 and Higher - MQL4 Articles 2014.02.03

Dear William,

thank you for following up on me!

Surely it "sits" in my indicator folder as you can see in the screenshot:


Screenshot MT4 Indicators folder
 
Your indicator looks like it's "i-Regr" and not "i_Regr".
 
Keith Watford:
Your indicator looks like it's "i-Regr" and not "i_Regr".

This is what I thought too! But the compiler does not take "i-Regr_1 as you see below:


screenshot mt4 compiling error


strangely it takes only I_Regr!!: 


Screenshot compiler

 
  1. MJZMQL5: strangely it takes only I_Regr!!: 

    Not strange at all. A dash is the minus operation (as in v=a - b;). Can't use a dash in a variable name. What you named your variables is irrelevant. It is their value that's important.

  2.    double IRegr1Center1 = iCustom(Symbol(),0,"i_Regr",degree_1,kstd_1,bars_1,0,shift1);

    The indicator name contains a dash per your explorer screenshot.

  3. MJZMQL5: Surely it "sits" in my indicator folder as you can see in the screenshot:
    It is not in your folder.
  4. And don't call me Shirley.
Reason: