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

MQL4 지표 스크립트

작업 종료됨

실행 시간 2 시간
피고용인의 피드백
Great customer, prompt communication, clear specs, recommended+
고객의 피드백
John knows his programming! And he did more than was expected. I can strongly recommend him to anyone who is looking for a programmer.

명시

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
등급
(637)
프로젝트
1009
47%
중재
33
36% / 36%
기한 초과
99
10%
무료
게재됨: 6 코드
2
개발자 2
등급
(90)
프로젝트
136
14%
중재
43
21% / 28%
기한 초과
14
10%
무료
게재됨: 2 코드
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
등급
(270)
프로젝트
285
55%
중재
0
기한 초과
5
2%
무료
8
개발자 8
등급
(24)
프로젝트
28
32%
중재
1
0% / 0%
기한 초과
0
무료
게재됨: 1 코드
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
무료
비슷한 주문
//+------------------------------------------------------------------+ //| Durban Gold Hunter.mq5 (v3.00) | //| Multi-pair EA for MetaTrader 5 (Razor Markets, XM). | //| Strategy modules (each can be switched on/off): | //| 1. EMA crossover | //| 2. 714 method (EMA 7 + RSI 14) | //| 3. CRT (Candle Range Theory: range sweep and close back inside)| //| 4. Trend line breakout (auto-drawn from swing highs/lows) | //| 5
I want NinjaTrader to behave like Tradovate. When I hover over a candlestick, the cursor should automatically snap to the center of that candle across all open charts. For example, when I hover over a 30-minute candle, the cursor should align with the center of the corresponding candles on the 15-minute and other chart timeframes. I also want vertical lines drawn on one chart to automatically align with the center of
Hello, I already have an MT5 Expert Advisor for XAUUSD based on Fibonacci, market structure, BOS/CHoCH and swing trading. I need an experienced MQL5 developer to modify my existing EA, not develop a completely new one. Required modifications: Partial take-profit system with multiple TP levels. Keep profit targets conservative, using Fibonacci extension levels. Stop-loss placement beyond liquidity areas, not exactly
Hello, I am an independent developer selling an Expert Advisor (EA) on the MQL5 Market. I am looking for an experienced Forex affiliate marketing company or professional marketer to promote my existing MT5 trading robot to customers worldwide. My proposed partnership offers a 35% commission per verified sale, with the possibility of a long-term collaboration. I would like to know: Do you promote third-party MT5
The objective is to develop a custom technical indicator for MetaTrader 5 (MQL5) that replicates the exact visual structure, inputs, and features of the "AYN-Indicator by Snurk" as shown in the provided screenshot. The indicator must analyze price actions based on a flexible lookback period, plot dynamic trend filters, and render precise Buy/Sell breakout labels without any lagging or repainting
Requirements Specification: Debug & Error Fixing: Review the entire source code of the MQL expert advisor. Identify and fix all logical errors, bugs, and performance issues that cause trades to close prematurely or yield extremely low profits. Strategy Restructuring & Optimization: Fully analyze and optimize the current entry and exit strategy for USDJPY and GBPUSD. Modify, upgrade, or completely rewrite the entry
Winter 500+ USD
I am looking for an MQL5 developer to independently review an existing EA’s execution and position management logic. The review should focus on duplicate orders, trade isolation by symbol and magic number, broker price and volume constraints, error handling, and recovery after a terminal restart. This order is for an audit report. Please do not modify the source or change the trading strategy. For each finding
Title: Fully Automatic MT5 Trading Bot (Expert Advisor) with Risk Management I want a fully automated trading robot (Expert Advisor) for MetaTrader 5, written in MQL5. The bot must automatically analyse market data, identify trading opportunities, execute BUY and SELL orders, manage open positions, and close trades according to predefined rules without requiring manual confirmation for each trade. Requirements
The Traffic Rush 250 - 500 USD
Subject: Inquiry: MQL4 Optimization & Refinement for Proprietary Binary Suite (Pine-to-MT4) I am seeking an experienced MQL4 / MetaTrader developer to optimize and finalize a custom binary options trading suite. Project Summary Core Architecture: Multi-pair Regime Scanner (22-pair FX basket monitoring state/score) and a Signal Engine operating on M1 charts. Strategy Sequence: Pre-Alert Dot: Placed on a candle closing
Hello I want some that can help with my strategy signal I have the video that you are going to watch if you know you can help me with kindly do well to bid and let discussed it an urgent project and also if you can not work before you get paid please don bid thanks

프로젝트 정보

예산
30+ USD
기한
로 2 일