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

Spécifications

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.



Dossiers :

ZIP
trash15.zip
3.6 Kb

Répondu

1
Développeur 1
Évaluation
(268)
Projets
601
34%
Arbitrage
64
20% / 58%
En retard
147
24%
Travail
Publié : 1 article, 22 codes
2
Développeur 2
Évaluation
(453)
Projets
566
26%
Arbitrage
24
42% / 38%
En retard
85
15%
Gratuit
Publié : 6 codes
3
Développeur 3
Évaluation
(586)
Projets
678
32%
Arbitrage
42
45% / 45%
En retard
12
2%
Occupé
4
Développeur 4
Évaluation
(4)
Projets
5
20%
Arbitrage
2
0% / 100%
En retard
1
20%
Gratuit
Publié : 3 codes
5
Développeur 5
Évaluation
(279)
Projets
341
37%
Arbitrage
6
50% / 17%
En retard
7
2%
Gratuit
Publié : 5 codes
6
Développeur 6
Évaluation
(453)
Projets
479
70%
Arbitrage
6
67% / 0%
En retard
2
0%
Travail
7
Développeur 7
Évaluation
(87)
Projets
121
68%
Arbitrage
5
80% / 0%
En retard
12
10%
Travail
8
Développeur 8
Évaluation
(2667)
Projets
3398
68%
Arbitrage
77
48% / 14%
En retard
342
10%
Gratuit
Publié : 1 code
9
Développeur 9
Évaluation
(102)
Projets
105
60%
Arbitrage
0
En retard
0
Gratuit
10
Développeur 10
Évaluation
(132)
Projets
178
39%
Arbitrage
4
25% / 50%
En retard
14
8%
Gratuit
11
Développeur 11
Évaluation
(3)
Projets
2
50%
Arbitrage
2
0% / 100%
En retard
0
Gratuit
Commandes similaires
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
Hello, i would like to have a ninjatrader indicator. I wanna to have a footprint indicator with delta, imbalances and big trades identifiable. Also I wanna sell it on whop. And it should be fully customisable in NT8

Informations sur le projet

Budget
90+ USD
Délais
de 1 à 3 jour(s)