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

仕事が完了した

実行時間2 時間
依頼者からのフィードバック
John knows his programming! And he did more than was expected. I can strongly recommend him to anyone who is looking for a programmer.
開発者からのフィードバック
Great customer, prompt communication, clear specs, recommended+

指定

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:


 



応答済み

1
開発者 1
評価
(626)
プロジェクト
984
47%
仲裁
33
36% / 33%
期限切れ
97
10%
仕事中
パブリッシュした人: 6 codes
2
開発者 2
評価
(90)
プロジェクト
136
14%
仲裁
43
21% / 28%
期限切れ
14
10%
パブリッシュした人: 2 codes
3
開発者 3
評価
(115)
プロジェクト
129
18%
仲裁
11
27% / 55%
期限切れ
4
3%
4
開発者 4
評価
(163)
プロジェクト
236
32%
仲裁
30
27% / 30%
期限切れ
26
11%
5
開発者 5
評価
(45)
プロジェクト
58
33%
仲裁
12
42% / 42%
期限切れ
7
12%
6
開発者 6
評価
(3)
プロジェクト
4
0%
仲裁
2
0% / 100%
期限切れ
1
25%
7
開発者 7
評価
(262)
プロジェクト
277
55%
仲裁
0
期限切れ
5
2%
8
開発者 8
評価
(24)
プロジェクト
28
32%
仲裁
1
0% / 0%
期限切れ
0
パブリッシュした人: 1 code
9
開発者 9
評価
(21)
プロジェクト
24
17%
仲裁
15
20% / 40%
期限切れ
6
25%
10
開発者 10
評価
(1156)
プロジェクト
1462
63%
仲裁
21
57% / 10%
期限切れ
43
3%
11
開発者 11
評価
プロジェクト
0
0%
仲裁
0
期限切れ
0
12
開発者 12
評価
(41)
プロジェクト
46
28%
仲裁
9
0% / 100%
期限切れ
7
15%
13
開発者 13
評価
(3)
プロジェクト
4
0%
仲裁
1
100% / 0%
期限切れ
0
類似した注文
Gold robot Ga1 30 - 200 USD
mport pandas as pd import numpy as np def detecter_tendance(data): # Code pour détecter la tendance pass def identifier_niveaux(data): # Code pour identifier les niveaux de support et de résistance pass def calculer_stop_loss(tendance, support, resistance): # Code pour calculer les stop loss pass def calculer_profils(tendance, support, resistance): # Code pour calculer les profils mport pandas as pd
I need a fully automated end-to-end system where a backend continuously runs my deterministic CORE EDGE validator on live market data, generates numeric JSON trade tickets (GO) or alert levels (NO-GO), and automatically pushes those instructions to the MT5 EA for execution. There are no manual signals. ROLE SPLIT (IMPORTANT) Backend (analysis & decision engine): Continuously evaluates live data using my CORE EDGE
Job Description: We are looking for an experienced MQL5 developer to create a script or Expert Advisor (EA) that automatically updates the price of a token CFD on MT5, using a live BTCUSD feed. The goal is to make token fully CFD-tradable , with real-time price updates, charts, and client P/L. Clients should be able to trade long or short and view live candles, just like other MT5 CFDs. Scope of Work / Requirements

プロジェクト情報

予算
30+ USD
締め切り
最高 2 日