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
Свободен
Похожие заказы
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
Hi. Could you slightly rewrite my cBot for me to use a 5-minute chart without a fixed target? The stop should be a trailing stop at the level of the initial range

Информация о проекте

Бюджет
90+ USD
Сроки выполнения
от 1 до 3 дн.