Questions from Beginners MQL5 MT5 MetaTrader 5 - page 471

 
Mike:
1. All match.
2. There is no such parameter.
I was told in another thread that this problem is unsolvable in MT4. :(

2. I don't know where you got the MA in a separate window to be able to tell you anything about the parameter. But... If you take from Indicators --> Oscillators --> Moving Averages of Oscillator, it has "Apply to:"

So, if you try to put another indicator in a separate window, in some cases, it can be applied not only to the standard prices from the ENUM_APPLIED_PRICE enumeration, but also to data of that indicator that is already in the window. Maybe you are just in this situation.

3. What is the problem? That the three MAs do not correspond to three similar (according to your statement) MAs? So it's not unsolvable, it's nonsense. If they are made correctly, they are bound to match. What's the difference - three separate MAs with their own parameters or the same three MAs with the same parameters, but crammed into one indicator with three buffers... Can you see the difference? I don't. And if you see it, then look for inconsistency in calculation of MAKs.

By the way... Alligator is three MAs in one indicator, each with its own parameters. Configure the parameters in the same way with your three separate MAs and they will coincide. But you have all this bacchanalia in a separate window... So ... as an example

 
Mike:
I made a 3MA(4,9,14) indicator and decided to compare it to check its correctness with a window where the three indicators are MA(4), MA(9), MA(14). My hair stood on end. :)
Try to disable self-scaling of indicator windows, maybe everything will settle down.
"Where there are three indicators - MA(4), MA(9), MA(14)" the indicator window is self-scaled by the first indicator attached to this window. In your case, it is probably the MA(4)
 

Can you please give me a design for getting the value of the built-in indicator from the upper timeframe, but inside this timeframe.

I.e. the current chart is 15 minutes, I need to get the value of the indicator, calculated by day, but 45 minutes ago, how to do this?

Here is a simple algorithm that returns the value of the indicator, but only for the current bar.

double iDelta(int Variant,int n,int TF,int index)

  {

   double Fibo=0;

   if(Variant==1) Fibo=0.236;

   if(Variant==2) Fibo=0.382;

   if(Variant==3) Fibo=0.5;

   if(Variant==4) Fibo=0.618;

   if(Variant==5) Fibo=0.764;

   if(Variant==6) Fibo=1;

   if(Variant==7) Fibo=1.236;

   if(Variant==8) Fibo=1.382;

   if(Variant==9) Fibo=1.5;

   if(Variant==10) Fibo=1.618;

   if(Variant==11) Fibo=2.0;

   if(Variant==12) Fibo=2.236;

   if(Variant==-1) Fibo=-0.236;

   if(Variant==-2) Fibo=-0.382;

   if(Variant==-3) Fibo=-0.5;

   if(Variant==-4) Fibo=-0.618;

   if(Variant==-5) Fibo=-0.764;

   if(Variant==-6) Fibo=-1;

   if(Variant==-7) Fibo=-1.236;

   if(Variant==-8) Fibo=-1.382;

   if(Variant==-9) Fibo=-1.5;

   if(Variant==-10) Fibo=-1.618;

   if(Variant==-11) Fibo=-2.0;

   if(Variant==-12) Fibo=-2.236;

   return ( NormalizeDouble(iOpen(Symbol(),TF,index)+iATR(Symbol(), TF, n, index+1)*Fibo,Digits) );

  } 

 
Leo59:
Try to disable self-scaling of indicator windows, maybe things will settle down.
"where the three indicators are MA(4), MA(9), MA(14)" the indicator window is self-scaled by the first indicator attached to that window. In your case, it is probably MA(4)
Where do you disable this self-scaling?
 
Artyom Trishkin:

2. I don't know where you got the MA in a separate window to be able to tell you anything about the parameter. But... If you take from Indicators --> Oscillators --> Moving Averages of Oscillator, it has "Apply to:"

So, if you try to put another indicator in a separate window, in some cases, it can be applied not only to the standard prices from the ENUM_APPLIED_PRICE enumeration, but also to data of that indicator that is already in the window. Maybe you are just in this situation.

3. What is the problem? That the three MAs do not correspond to three similar (according to your statement) MAs? So it's not unsolvable, it's nonsense. If they are made correctly, they are bound to match. What's the difference - three separate MAs with their own parameters or the same three MAs with the same parameters, but crammed into one indicator with three buffers... Can you see the difference? I don't. And if you see it, then look for a mismatch in the MAK calculations.

By the way... Alligator is three MAs in one indicator, each with its own parameters. Configure the parameters the same way as your three separate MAs and they will match. But you have all this bacchanalia in a separate window... So ... as an example

Artyom, "Apply to" - there is only a listing of prices. The MA calculations are correct, all three lines are checked by adding a single indicator with a period of 4, then 9, then 14 to the window with the 3MA indicator. In each case, the single indicator coincides with the corresponding line of the 3MA indicator
 
Mike:
Artyom, "Apply to" - there is only an enumeration of prices. The MA calculations are correct, all three lines have been checked by adding a single indicator with period 4, then 9, then 14 to the 3MA indicator window. In each case the single indicator coincides with the corresponding line of the 3MA indicator
What's the problem then? I take it you don't like the visual mismatch of the lines in the different windows. Press Ctrl+D, move the mouse over the indicator lines and look in the data window to see if they match...
 
-Aleks-:

Can you please give me a design for getting the value of the built-in indicator from the upper timeframe, but inside this timeframe.

I.e. the current chart is 15 minutes, I need to get the value of the indicator, calculated by day, but 45 minutes ago, how to do this?

Here is a simple algorithm that returns the value of the indicator, but only for the current bar.

double iDelta(int Variant,int n,int TF,int index)

  {

   double Fibo=0;

   if(Variant==1) Fibo=0.236;

   if(Variant==2) Fibo=0.382;

   if(Variant==3) Fibo=0.5;

   if(Variant==4) Fibo=0.618;

   if(Variant==5) Fibo=0.764;

   if(Variant==6) Fibo=1;

   if(Variant==7) Fibo=1.236;

   if(Variant==8) Fibo=1.382;

   if(Variant==9) Fibo=1.5;

   if(Variant==10) Fibo=1.618;

   if(Variant==11) Fibo=2.0;

   if(Variant==12) Fibo=2.236;

   if(Variant==-1) Fibo=-0.236;

   if(Variant==-2) Fibo=-0.382;

   if(Variant==-3) Fibo=-0.5;

   if(Variant==-4) Fibo=-0.618;

   if(Variant==-5) Fibo=-0.764;

   if(Variant==-6) Fibo=-1;

   if(Variant==-7) Fibo=-1.236;

   if(Variant==-8) Fibo=-1.382;

   if(Variant==-9) Fibo=-1.5;

   if(Variant==-10) Fibo=-1.618;

   if(Variant==-11) Fibo=-2.0;

   if(Variant==-12) Fibo=-2.236;

   return ( NormalizeDouble(iOpen(Symbol(),TF,index)+iATR(Symbol(), TF, n, index+1)*Fibo,Digits) );

  } 

I can't answer the question, but the function can be simplified and significantly speeded up.
When initializing the indicator, create a static array

double arrFibo[13] = {0.0, 0.236, 0.382, ..., 2.236};

and all if iniDelta() can be replaced by:

if (Variant>0)
    Fibo =  arrFibo[ Variant];
else
    Fibo = -arrFibo[-Variant];

 
Mike:

I can't answer the question, but the function can be simplified and significantly speeded up.
During the initialization of the indicator create a static array

double arrFibo[13] = {0.0, 0.236, 0.382, ..., 2.236};

and all if's iniDelta() can be replaced by:

if (Variant>0)
    Fibo =  arrFibo[ Variant];
else
    Fibo = -arrFibo[-Variant];

Thanks, I'll try it, maybe it will be better.

 
Mike:

I can't answer the question, but the function can be simplified and significantly speeded up.
In the initialization of the indicator create a static array

double arrFibo[13] = {0.0, 0.236, 0.382, ..., 2.236};

and all ifs iniDelta() can be replaced by:

if (Variant>0)
    Fibo =  arrFibo[ Variant];
else
    Fibo = -arrFibo[-Variant];

I did. as you wrote, but it didn't work as it should be - I don't know what exactly is wrong yet - I need to print....

I do not understand about the string.

else           Fibo = -arrFibo[-Variant];

So what do we get? Are we asking for the minus index of the array or what?
 
-Aleks-:

I did it as you wrote, but it doesn't work as it should - I don't know what's wrong yet - I need to print....

I don't understand about the line.

else           Fibo = -arrFibo[-Variant];

Does it turn out that we're requesting a minus index of the array or what?
In the case when Variant is negative, expression -Variant gives a positive index for an array fetching.
In the same case we need negative Fibo values, so -arrFibo.