Debug: array out of range issue + 2 buffers return value of 1 on live chart for every bar

指定

Only for developers with experience in debugging, and array-out-of-range issues.


A custom indicator seems to work on a static chart, but 1 buffer still has mistakes in it, resulting in a value of 1 for every bar: the code needs to be reviewed and modified, resulting in a working indicator for every symbol, for every timeframe: sometimes when the timeframe is switched, the chart closes automatically, but all the time the value of ExtMapBuffer2 (Aqua) is 1 on the live chart, sometimes there is an "array out of range" issue. The second buffer: NonRepaintBuffer (red line on the image below) is based on the first one:  ExtMapBuffer2. ExtMapBuffer2 repaints around turning points, so this second buffer is added ( NonRepaintBuffer ) that does not change values in the past. As the red line is calculated based on the aqua line, the error must be contained within the  ExtMapBuffer2 calculation.



So review, edit & fix please.

I'm happy to answer any questions.

- - - - -  - - - - -  - - - - -  - - - - -  - - - - -  - - - - -  - - - - -  - - - - -  - - - - -  - - - - -  - - - - -  - - - - -  - - - - -  - - - - -  - - - - -  - - - - -  - - - - -  - - - - -  - - - - - 

About the indicator:

A zig-zag NRP close is applied to an oscillator.

On this, a counter is added, to keep track of the number of bars since the last "zag" (that does not repaint). The counter adds 0 for a counter-trend bar, and 1 for a trend bar. So when in a rising segment, you have a small counter-trend down-swing, the counter is flat. If after this counter-trend down-swing the trend goes back up, and a new high is made, the counter takes the value as if there would not have been a counter-trend piece (like only rising bars). (& vice versa for falling segment).

Every trend change starts with a retracement against the current trend, so the counter will be flat during this time, but when the trend goes further (than an acceptable retracement as in the setting for the zigzag), a new leg of the zig zag is created. 

The problem with the current code, is that at that moment (when a new leg of the zigzag close nrp on the oscillator appears), the counter jumps back to the start of the retracement (of the flat part), instead of the end of the flat part. 

So it is not a repainting error, it is a code error.

To fix this, a new buffer that does not repaint is added.



附加的文件:

ZIP
trash15.zip
3.6 Kb

反馈

1
开发者 1
等级
(268)
项目
601
34%
仲裁
64
20% / 58%
逾期
147
24%
工作中
发布者: 1 文章, 22 代码
2
开发者 2
等级
(453)
项目
566
26%
仲裁
24
42% / 38%
逾期
85
15%
空闲
发布者: 6 代码
3
开发者 3
等级
(586)
项目
678
32%
仲裁
42
45% / 45%
逾期
12
2%
繁忙
4
开发者 4
等级
(4)
项目
5
20%
仲裁
2
0% / 100%
逾期
1
20%
空闲
发布者: 3 代码
5
开发者 5
等级
(279)
项目
341
37%
仲裁
6
50% / 17%
逾期
7
2%
空闲
发布者: 5 代码
6
开发者 6
等级
(453)
项目
479
70%
仲裁
6
67% / 0%
逾期
2
0%
工作中
7
开发者 7
等级
(87)
项目
121
68%
仲裁
5
80% / 0%
逾期
12
10%
工作中
8
开发者 8
等级
(2667)
项目
3398
68%
仲裁
77
48% / 14%
逾期
342
10%
空闲
发布者: 1 代码
9
开发者 9
等级
(102)
项目
105
60%
仲裁
0
逾期
0
空闲
10
开发者 10
等级
(132)
项目
178
39%
仲裁
4
25% / 50%
逾期
14
8%
空闲
11
开发者 11
等级
(3)
项目
2
50%
仲裁
2
0% / 100%
逾期
0
空闲
相似订单
I have a EA for XAUUSD which works awesome in sideways and trending market as well, capital requirement is only 2000USd and weekly profit is around 1500-2000 USD. I am using this bot from 3 months and getting continuous good result
Expert should be able to place trades across all Forex symbols (solution is advised) . xauusd live chart execution error . Deletion and Cleaning the Code (if required) . Live Chart Only
Dear All i am working on strategy in forex market specifically in xausud and i just want someone to make it automatic execution mode as per my requirements with propee risk management my broker is exness and i have an account in MT5
I am looking for an experienced MT5/MQL5 programmer to build Phase 1 of a larger Expert Advisor project. This first phase is limited to one custom signal only for the EUR/USD. If Phase 1 is completed correctly, additional signals may be added later as separate follow-up projects. The purpose of Phase 1 is to code, test, display, and log this signal accurately using completed M1 bars only. At this stage, I primarily
✅ MT4 EA Developer Checklist (For Your Ladder EA) 1️⃣ Indicator Integration EA reads signals from provided custom indicator (.ex4 or .mq4) Detects “Buy Next” / “Sell Next” signals on current candle Works with arrow-based or buffer-based signals 2️⃣ Next Candle Execution EA does not trade on the candle where the signal appears Orders placed only at first tick of the next candle Timeframes supported: M1, M5, M15
Hi to all, I need a modification of an existing grid EA with the following instructions: Add the following optional external inputs to the attached Expert Advisor: input bool TradeModeAgainstTrend ( TMAT ) = true ; input int CounterTrendLotsToStartTMAT = 0.15 ; input double CoefficientForTrendLots = 0.30 ; input double MaxTrendLot = 0.08 ; input bool OneSideTMATOnly = true ; input double CombinedClosureAmount = 10.0
Hello, i need expert developer that have been develop so many profitable AI bots that work for mt5 and ctrader autonomously if you know you can easily execute this requirement bid for it. NOTE:- YOU MUST COME WITH SAMPLE FOR THE 2 TRADING PLATFORM. While i take a look at your profile and reach out to you thanks
Gold robot 3000+ USD
I really liked this training platform. I want to start a good business with this funding amount."I like crypto trading. Does it provide a demo account that is good for learning?"
Gold robot 3000+ USD
Hello, I am looking for someone who can help me to build a MT4/MT5 forex EA, by analyzing the trading history. You are responsible to find out trading logic behind the EA and Build a new EA that accurately replicates the existing strategy. I need someone who has proven previous experience to build a new EA by reverse engineering. Thanks

项目信息

预算
90+ USD
截止日期
 1  3 天