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

MQL4 Indicateurs Scripts

Tâche terminée

Temps d'exécution 2 heures
Commentaires du client
John knows his programming! And he did more than was expected. I can strongly recommend him to anyone who is looking for a programmer.
Commentaires de l'employé
Great customer, prompt communication, clear specs, recommended+

Spécifications

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:


 



Répondu

1
Développeur 1
Évaluation
(599)
Projets
932
46%
Arbitrage
31
39% / 29%
En retard
93
10%
Gratuit
2
Développeur 2
Évaluation
(87)
Projets
134
14%
Arbitrage
41
22% / 29%
En retard
14
10%
Gratuit
3
Développeur 3
Évaluation
(115)
Projets
129
18%
Arbitrage
11
27% / 55%
En retard
4
3%
Gratuit
4
Développeur 4
Évaluation
(155)
Projets
224
33%
Arbitrage
27
26% / 26%
En retard
23
10%
Gratuit
5
Développeur 5
Évaluation
(45)
Projets
58
33%
Arbitrage
12
42% / 42%
En retard
7
12%
Gratuit
6
Développeur 6
Évaluation
(3)
Projets
4
0%
Arbitrage
2
0% / 100%
En retard
1
25%
Gratuit
7
Développeur 7
Évaluation
(180)
Projets
195
46%
Arbitrage
0
En retard
5
3%
Gratuit
8
Développeur 8
Évaluation
(24)
Projets
28
32%
Arbitrage
1
0% / 0%
En retard
0
Gratuit
9
Développeur 9
Évaluation
(21)
Projets
24
17%
Arbitrage
15
20% / 40%
En retard
6
25%
Gratuit
10
Développeur 10
Évaluation
(1134)
Projets
1436
62%
Arbitrage
21
57% / 10%
En retard
43
3%
Gratuit
11
Développeur 11
Évaluation
Projets
0
0%
Arbitrage
0
En retard
0
Gratuit
12
Développeur 12
Évaluation
(41)
Projets
46
28%
Arbitrage
9
0% / 100%
En retard
7
15%
Gratuit
13
Développeur 13
Évaluation
(3)
Projets
4
0%
Arbitrage
1
100% / 0%
En retard
0
Gratuit
Commandes similaires
I have an EA that need some changes including integrating the indicator code directly into the Expert Advisor. I will give the detailed doc once we settle on the candidate for the job . Please bid if you can work with the stated amount. Thanks
Hello, Need to convert Tradingview Indicator to MQL4 indicator. or if you have this one converted already, let me buy a copy please. If we're good, then will definitely buy it and ask to convert into EA on new order. Supertrend by KivancOzbilgic
Fix bug or modify an existing Trading view indicator to display correct. The indicator is working but not displaying/plotting all the information i want. So i want it adjusted to plot all the info
Here's a brief requirement you can use: **Description:** I am seeking an experienced MQL5 developer to create a (EA). The EA should include features for placing pending orders (Buy Stop and Sell Stop) based on market spread, managing trades effectively at the opening of new candlesticks, and implementing take profit and stop loss strategies. Additionally, I would like the option to adjust parameters based on market
I have an EA which i need to do below modifications. Variable Inputs to be added Order Type : Market , Pending Trade Type : Buy, Sell , Buy & Sell Pending Pips Step : ( Pips Value can be negative or positive to decide on what type of Pending Order ) // If trade type Buy is selected Close Type : Close All ( Bulk Close Option in MT5 ) , Close Individually Close Option : %of Equity , %of Balance , Amount $ , %of No
Add multiplier to grid recovery system. For example: Grid Trade 2-3 Spacing; 1.0 Multiplier Grid Trade 4-6 Spacing; 2.0 Multiplier Grid Trade 7+ Spacing; 1.6 Multiplier Need quick turn around. Need it done ASAP
Objects reader PIN 70 - 100 USD
Hi I have an indicator that create objects in the chart and using those following some rules the new indicator will create external global variables with value = 0 ( NONE ), = 1 ( BUY ) or = 2 ( SELL ). The global variable will use PIN external integer number . PINS are by now global variables (GV) whose name indicates the pair name and the PIN belonging and their value indicates it direction/action. PINS GV names
I want an indicator and its source code that returns the value of: - two moving averages in different selectable timeframes, with method Exponential and price calculation price_open; - Opening, closing, maximum and minimum of the candle in different timeframes And that returns the values ​​regardless in a chart of one minute. The input parameters: * select timeframe media1 = {1,2,3,4,5,...} * select timeframe media2
Hello, I want offline Renko chart based on pips and time. Trading View Renko chart is a perfect example of what I require, it prints renko bricks at close of time frame chosen which is more cleaner. The Trading View Renko chart wait until end of desired timeframe candle to close before final renko bricks are drawn. Best is to look at Trading View renko charts to see exactly how this works. I currently have an
A simple candle pattern indicator is required that makes a sound alert and draws an arrow when two consecutive bars have the same high or the same low. If two highs, the second bar is a down close and the bar immediately preceding the two highs is a lower high. Vis versa for 2 lows. The second bar is an up close and the bar immediately preceding the two lows is a higher low. Please see attached images for

Informations sur le projet

Budget
30+ USD
Pour le développeur
27 USD
Délais
à 2 jour(s)