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

MQL4 Indicatori Script

Lavoro terminato

Tempo di esecuzione 2 ore
Feedback del cliente
John knows his programming! And he did more than was expected. I can strongly recommend him to anyone who is looking for a programmer.
Feedback del dipendente
Great customer, prompt communication, clear specs, recommended+

Specifiche

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:


 



Con risposta

1
Sviluppatore 1
Valutazioni
(626)
Progetti
984
47%
Arbitraggio
33
36% / 33%
In ritardo
97
10%
In elaborazione
Pubblicati: 6 codici
2
Sviluppatore 2
Valutazioni
(90)
Progetti
136
14%
Arbitraggio
43
21% / 28%
In ritardo
14
10%
Gratuito
Pubblicati: 2 codici
3
Sviluppatore 3
Valutazioni
(115)
Progetti
129
18%
Arbitraggio
11
27% / 55%
In ritardo
4
3%
Gratuito
4
Sviluppatore 4
Valutazioni
(163)
Progetti
236
32%
Arbitraggio
30
27% / 30%
In ritardo
26
11%
Gratuito
5
Sviluppatore 5
Valutazioni
(45)
Progetti
58
33%
Arbitraggio
12
42% / 42%
In ritardo
7
12%
Gratuito
6
Sviluppatore 6
Valutazioni
(3)
Progetti
4
0%
Arbitraggio
2
0% / 100%
In ritardo
1
25%
Gratuito
7
Sviluppatore 7
Valutazioni
(262)
Progetti
277
55%
Arbitraggio
0
In ritardo
5
2%
Gratuito
8
Sviluppatore 8
Valutazioni
(24)
Progetti
28
32%
Arbitraggio
1
0% / 0%
In ritardo
0
Gratuito
Pubblicati: 1 codice
9
Sviluppatore 9
Valutazioni
(21)
Progetti
24
17%
Arbitraggio
15
20% / 40%
In ritardo
6
25%
Gratuito
10
Sviluppatore 10
Valutazioni
(1156)
Progetti
1462
63%
Arbitraggio
21
57% / 10%
In ritardo
43
3%
Gratuito
11
Sviluppatore 11
Valutazioni
Progetti
0
0%
Arbitraggio
0
In ritardo
0
Gratuito
12
Sviluppatore 12
Valutazioni
(41)
Progetti
46
28%
Arbitraggio
9
0% / 100%
In ritardo
7
15%
Gratuito
13
Sviluppatore 13
Valutazioni
(3)
Progetti
4
0%
Arbitraggio
1
100% / 0%
In ritardo
0
Gratuito
Ordini simili
EA requirements and necessary correction to be done . The EA monitors the PROFIT of open positions and turns ON or OFF the ALGO TRADING accordingly. By PROFIT I mean the SUM of profit + commission + swap. The EA will have two strategies, the INITIAL and the SECONDARY. Each one of them will be selectable by the user in the EA inputs. Let me explain here how the EA will operate: 1. INITIAL strategy: ·
Hello, I have a breakout EA with reversal logic. I own the full source code for both MT4 and MT5 versions. I need the modifications implemented for both MT4 and MT5 versions. I need several modifications: – Multiple reversals with configurable parameters – Breakeven functionality – Entry only after candle close beyond range + offset – Time-based activation – Alternative offset calculation logic – Automatic close at
Hi I have a simple task (hopefully) I have a custom strategy that I built with the help of Claude Anthropic - everything is finished and I zipped it with power shell but when importing it NT8 gives me the error message that the file was made from an older, incompatible version or not a NinjaScript. My folder structure is correct as far I can see so I don't know what the issues is and it's costing me too much to go
Subject: Development of Ultra-High Precision Confluence Indicator - M1 Binary Options (Non-Repaint) ​ Hello, I am looking for a Senior MQL5 Developer to create a custom "Surgical Precision" indicator for MetaTrader 5, specifically optimized for 1-minute (M1) Binary Options trading. The system must integrate three distinct layers of algorithmic analysis. ​ 1. Core Logic: Triple-Layer Confluence ​The signal (Call/Put)
Hello, I have an MQ4 indicator that works with a specific strategy. I want to modify some aspects and convert the file to MQ5. It's simple and won't take much effort or time for someone experienced in this field. Ideally, the person undertaking this task should be familiar with the MX2Trading software, as I will be using it to transfer the signals from the indicator to the trading platform
Phahla fx boto 30+ USD
99.99% signal accuracy 10-15 trades distribution all currency trade and meta AI assistance on loss[advice] stop and start robot cyber security firewall protection activation code: 20060605TLP20 Please create a trading bot with any logo with the name elevation
Does anyone have a ready made sierra chart absorption indicator ready made or anything similar to below. I would like to buy it. You must have understanding of order flow, sierra chart and is able to code or coded this before https://www.emojitrading.com/product/absorption-pro/ https://www.emojitrading.com/product/price-rejector-pro/
1. Shift the Time Gate (Critical) Current start time: 08:30 New required start time: 08:35:01 The EA is currently triggering trades too early (between 08:25 – 08:30 ), which is causing incorrect entries. Please ensure the EA cannot enter any trade before 08:35:01 . 2. Change Order Execution Logic The current code is using Pending Orders . Please remove pending order logic completely . Replace it with Direct Market
Project Title Freedom ORB – Fully Automated MT5 Expert Advisor (ORB + Structure + Liquidity) (MT5) Project Description I require a fully automated MT5 Expert Advisor based on a structured Opening Range Breakout (ORB) model with market structure and liquidity confirmation. The EA must: Detect ORB session range Wait for breakout (close-based) Wait for retrace Confirm M1 structure + displacement Execute trade
I’m looking for a trading bot where I can use a balance of £1000 to make regular entries making £20-£40 per entry. obviously, I want to have minimum loss with a lot more profit being made

Informazioni sul progetto

Budget
30+ USD
Scadenze
a 2 giorno(i)