Download MetaTrader 5
To add comments, please log in or register
Join MQL5 Cloud Network. Start earning money!
Abejorro
165
Abejorro 2016.03.28 14:39 

What can one do wrong on that simple code ? - But something is going wrong !

 ArraySetAsSeries(arrValues, true);
 ArraySetAsSeries(bufCenterline, true);
 // ...

 newBegin = 1;

 for (i = newBegin; i >= 0; i--)
   {

      bufCenterline[i] = iMAOnArray(arrValues, rates_total, 13, 0, MODE_LWMA, i);
            
      if (i==0) Print("CenterLine: " + bufCenterline[i] + " - TotalQuotes: " + rates_total + " - QuoteValue: " + arrValues[i]);
      // the same static output on i==1 !
   }


The output with that is always the same - wrong - value. Is there a bug in that iMaOnArray() or did I found a silly way using it wrong ?

If the loop works with the long distance over the historic values up to 0 it is fine ! But with only the recent values from 1 to 0:

2016.03.28 16:18:28.187 xx GBPJPY,M1: CenterLine: 161.5353955941705 - TotalQuotes: 66039 - QuoteValue: 161.52
2016.03.28 16:17:28.593 xx GBPJPY,M1: CenterLine: 161.5353955941705 - TotalQuotes: 66038 - QuoteValue: 161.515
2016.03.28 16:16:28.796 xx GBPJPY,M1: CenterLine: 161.5353955941705 - TotalQuotes: 66037 - QuoteValue: 161.511
2016.03.28 16:15:30.921 xx GBPJPY,M1: CenterLine: 161.5353955941705 - TotalQuotes: 66036 - QuoteValue: 161.455
2016.03.28 16:14:29.609 xx GBPJPY,M1: CenterLine: 161.5353955941705 - TotalQuotes: 66035 - QuoteValue: 161.452
2016.03.28 16:13:31.125 xx GBPJPY,M1: CenterLine: 161.5353955941705 - TotalQuotes: 66034 - QuoteValue: 161.494
Abejorro
165
Abejorro 2016.03.30 06:54  
Abejorro:


What can one do wrong on that simple code ? - But something is going wrong !


The output with that is always the same - wrong - value. Is there a bug in that iMaOnArray() or did I found a silly way using it wrong ?

If the loop works with the long distance over the historic values up to 0 it is fine ! But with only the recent values from 1 to 0:

No one any idea ? Me too ! I could play with 'ArraySetAsSeries(..)' as I like, nothing went better.

Now I wrote my own MA-routines. It works in the same code-environment as these insides don't.

Zirkon
123
Zirkon 2016.04.03 13:35  
Abejorro:

No one any idea ? Me too ! I could play with 'ArraySetAsSeries(..)' as I like, nothing went better.

Now I wrote my own MA-routines. It works in the same code-environment as these insides don't.


Your problem is not clear. what is wrong ? Nobody can guess, so nobody can help.

You should provide code that compiles to demonstrate your issue.

whroeder1
13610
whroeder1 2016.04.03 13:41  
zirkoner: You should provide code that compiles to demonstrate your issue.
  1. He already did.
    2016.03.28 16:18:28.187 xx GBPJPY,M1: CenterLine: 161.5353955941705 - TotalQuotes: 66039 - QuoteValue: 161.52
    2016.03.28 16:17:28.593 xx GBPJPY,M1: CenterLine: 161.5353955941705 - TotalQuotes: 66038 - QuoteValue: 161.515
    2016.03.28 16:16:28.796 xx GBPJPY,M1: CenterLine: 161.5353955941705 - TotalQuotes: 66037 - QuoteValue: 161.511
    2016.03.28 16:15:30.921 xx GBPJPY,M1: CenterLine: 161.5353955941705 - TotalQuotes: 66036 - QuoteValue: 161.455
    2016.03.28 16:14:29.609 xx GBPJPY,M1: CenterLine: 161.5353955941705 - TotalQuotes: 66035 - QuoteValue: 161.452
    2016.03.28 16:13:31.125 xx GBPJPY,M1: CenterLine: 161.5353955941705 - TotalQuotes: 66034 - QuoteValue: 161.494
  2. Tell Metaquotes
    Zirkon
    123
    Zirkon 2016.04.03 13:45  
    1. I can't compiled the code provided.
    2. Why do you want to report it to Metaquotes ?
    whroeder1
    13610
    whroeder1 2016.04.03 19:00  
    zirkoner: Why do you want to report it to Metaquotes ?
    Who do you think can fix a broken iMAonArray? Us users or Metaquotes?
    Abejorro
    165
    Abejorro 2016.04.04 12:08  
    WHRoeder:
    zirkoner: Why do you want to report it to Metaquotes ?
    Who do you think can fix a broken iMAonArray? Us users or Metaquotes?
    As you agree that the bug is not in front of the keyboard, I reported a bug at the service-desk. We will see what went wrong...
    Abejorro
    165
    Abejorro 2016.04.04 12:11  
    zirkoner:

    Your problem is not clear. what is wrong ? Nobody can guess, so nobody can help.

    You should provide code that compiles to demonstrate your issue.

    WHRoeder pointed the misthake very well. The results are the same up to 10E-13. Impossible with this input-values.

    And the results are correct and different with my own routines.

    Zirkon
    123
    Zirkon 2016.04.04 21:00  
    Abejorro:

    WHRoeder pointed the misthake very well. The results are the same up to 10E-13. Impossible with this input-values.

    And the results are correct and different with my own routines.

    Maybe or not...

    To be sure 100% the problem need to be reproduced, which I can't do. If you report something to Metaquotes they will ask you the code to reproduce the problem.

    Keith Watford
    Moderator
    7906
    Keith Watford 2016.04.04 21:40  
    zirkoner:

    Maybe or not...

    To be sure 100% the problem need to be reproduced, which I can't do. If you report something to Metaquotes they will ask you the code to reproduce the problem.

    I also have been unable to reproduce the problem.

    I suspect that

     ArraySetAsSeries(arrValues, true);
     ArraySetAsSeries(bufCenterline, true);
    is not in the same block of code and is reset somewhere else. so that iMAOnArray is calculating using the same elements every time. Hence the duplicated result.
    Abejorro
    165
    Abejorro 2016.04.05 06:26  
    zirkoner:

    Maybe or not...

    To be sure 100% the problem need to be reproduced, which I can't do. If you report something to Metaquotes they will ask you the code to reproduce the problem.

    Ok, with a litlle time I will extract the codes which are necessary up to my point so it can be reproduced. The whole code now is a long walk through classes and other inludes.

    Three things made me sure, I could keep it simple:
    1) The iMaOnArray() is fine on the long walk from the very beginning to 0 with the same code.
    2) The output of arrValues[i] did not show any issue.
    3) My own code replacing the iMaOnArray() is working without any other changes.

    But if you can't reproduce it, there must be something special in my other code...


    @GumRai:

    that's what I thought. But I checked the state with ArrayGetAsSeries() a lot of times and set the state a line above the iMaOnArray()... Nothing changes


    Thank you for your answers :-)

    /
    To add comments, please log in or register