Please help me find the bug in 5 lines of MQL4 code

MQL4 Indikatoren Skripte

Auftrag beendet

Ausführungszeit 2 Stunden
Bewertung des Kunden
John knows his programming! And he did more than was expected. I can strongly recommend him to anyone who is looking for a programmer.
Bewertung des Entwicklers
Great customer, prompt communication, clear specs, recommended+

Spezifikation

I need help with a small piece of code that calculates the moving average of the Williams Percent Range indicator.

Here is the code:

         ArrayResize(WPRArray, WPR_MAPeriod);

         for (int j = 0; j < WPR_MAPeriod; j++)
         {
            WPRArray[j] = iWPR(symbol, WPR_Timeframe, WPR_Period, j);
         }
         double WPR_Average = iMAOnArray(WPRArray, 0, WPR_MAPeriod, 0, WPR_MAMethod, 0);
         
         WPR = DoubleToString(WPR_Average, 0);

It gives different values on the indicator on the chart and the value in the variable calculated for WPR, e.g.
Here the value on the indicator is -52,4541 where the value in the Variable WPR = -73 (rounded off)



And here is another example:
Value of the indicator = -63.5457 but the variable has the value -41(rounded off)

I have researched the issue and found that there is a 12 hour difference where the value in the variable lags the value of the indicator. 

Here is a chart over 20 hours of the values of the indi and the var to illustrate:


 



Bewerbungen

1
Entwickler 1
Bewertung
(599)
Projekte
932
46%
Schlichtung
31
39% / 29%
Frist nicht eingehalten
93
10%
Frei
2
Entwickler 2
Bewertung
(87)
Projekte
134
14%
Schlichtung
41
22% / 29%
Frist nicht eingehalten
14
10%
Frei
3
Entwickler 3
Bewertung
(115)
Projekte
129
18%
Schlichtung
11
27% / 55%
Frist nicht eingehalten
4
3%
Frei
4
Entwickler 4
Bewertung
(155)
Projekte
224
33%
Schlichtung
27
26% / 26%
Frist nicht eingehalten
23
10%
Frei
5
Entwickler 5
Bewertung
(45)
Projekte
58
33%
Schlichtung
12
42% / 42%
Frist nicht eingehalten
7
12%
Frei
6
Entwickler 6
Bewertung
(3)
Projekte
4
0%
Schlichtung
2
0% / 100%
Frist nicht eingehalten
1
25%
Frei
7
Entwickler 7
Bewertung
(180)
Projekte
195
46%
Schlichtung
0
Frist nicht eingehalten
5
3%
Frei
8
Entwickler 8
Bewertung
(24)
Projekte
28
32%
Schlichtung
1
0% / 0%
Frist nicht eingehalten
0
Frei
9
Entwickler 9
Bewertung
(21)
Projekte
24
17%
Schlichtung
15
20% / 40%
Frist nicht eingehalten
6
25%
Frei
10
Entwickler 10
Bewertung
(1134)
Projekte
1436
62%
Schlichtung
21
57% / 10%
Frist nicht eingehalten
43
3%
Frei
11
Entwickler 11
Bewertung
Projekte
0
0%
Schlichtung
0
Frist nicht eingehalten
0
Frei
12
Entwickler 12
Bewertung
(41)
Projekte
46
28%
Schlichtung
9
0% / 100%
Frist nicht eingehalten
7
15%
Frei
13
Entwickler 13
Bewertung
(3)
Projekte
4
0%
Schlichtung
1
100% / 0%
Frist nicht eingehalten
0
Frei
Ähnliche Aufträge
I’m looking for someone experienced with Think or Swim to create a backtesting script for an in-the-money Iron Condor strategy using options on the SPX. The strategy involves setting up 10 contracts of an Iron Condor with a 10-point spread width and a net credit requirement of $11 per contract. The goal is to backtest the performance over the last three years, focusing on trades where the SPX closes outside a
I currently have a license code that connects to my web server, and I add the account number, client name, and expiration date. I’d like something more automated. Currently I allow clients 10 licenses, but adding for them on my side can get exhausting. I’d like a better solution for myself and clients

Projektdetails

Budget
30+ USD
Für die Entwickler
27 USD
Ausführungsfristen
bis 2 Tag(e)