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

Specification

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.



Responded

1
Developer 1
Rating
(258)
Projects
585
35%
Arbitration
64
20% / 58%
Overdue
147
25%
Free
Published: 1 article, 22 codes
2
Developer 2
Rating
(450)
Projects
560
26%
Arbitration
22
41% / 36%
Overdue
85
15%
Free
Published: 6 codes
3
Developer 3
Rating
(535)
Projects
613
34%
Arbitration
34
38% / 44%
Overdue
9
1%
Busy
4
Developer 4
Rating
(4)
Projects
5
20%
Arbitration
0
Overdue
1
20%
Free
Published: 3 codes
5
Developer 5
Rating
(274)
Projects
335
37%
Arbitration
6
50% / 17%
Overdue
7
2%
Free
Published: 5 codes
6
Developer 6
Rating
(434)
Projects
461
69%
Arbitration
6
67% / 0%
Overdue
2
0%
Working
7
Developer 7
Rating
(84)
Projects
115
70%
Arbitration
5
80% / 0%
Overdue
11
10%
Free
8
Developer 8
Rating
(2589)
Projects
3265
67%
Arbitration
77
48% / 14%
Overdue
341
10%
Free
Published: 1 code
9
Developer 9
Rating
(102)
Projects
105
60%
Arbitration
0
Overdue
0
Free
10
Developer 10
Rating
(132)
Projects
178
39%
Arbitration
4
25% / 50%
Overdue
14
8%
Free
11
Developer 11
Rating
(3)
Projects
2
50%
Arbitration
1
0% / 100%
Overdue
0
Free
Similar orders
Hello Great Developer I need a NinjaTrader 8 bot built completely from scratch based on the following logic and also have to fix one issue here Detect the latest valid M5 Fair Value Gap (FVG) only Entry when price enters the M5 FVG and a violated M1 FVG (IFVG) confirms the setup Trade direction based on FVG bias (long/short) SL = lowest candle since M5 entry, TP = 1:3 RR (editable) Max 1 open trade at a time , max 2
The strategy should buy a futures contract at market Ask price. The contract should be held until the price reaches its highest point since entering the position. A user specified virtual (does not show on the order book) trailing sell stop should be in place so when the market begins to decline it activates. It would be excellent if I could have the option of a fixed virtual stop or be able to click variable virtual
Through a series of sources, I’ve been able to generate this code. However, it won’t “Enable” in the Control Panel. The strategy should buy a futures contract at market Ask price. The contract should be held until the price reaches its highest point since entering the position. A user specified virtual (does not show on the order book) trailing sell stop should be in place so when the market begins to decline it
hello great developer We will program 5 single indicator then but them together in one seystem We will program 5 single indicator then but them together in one seystem. I want it professional indicator with nice theme and design from you
im looking for a developer to build a fully automated trading robot Expert Advisor for Metatrader 5. The EA must do the following open buy sell orders based on a custom strategy details below place take profit and stop loss automatically Lot size should be adjustable Should avoid overtrading e.g. max 3 trades per day Close trades automatically based on criteria Work on multiple pairs if possible News filler optional
We are seeking an experienced MQL5 developer to create a custom Expert Advisor (EA) tailored to our specific trading strategy. The ideal candidate should have proven experience in building high-performance trading robots with a focus on strategy optimization, debugging, and efficient order execution. Key Responsibilities: Develop and code an Expert Advisor based on our pre-defined strategy. Conduct in-depth testing
on non repaint indicator based on gold pair wich gives daily 2 to 3 clean trades as day trading or scalping but clean trades 30 to 70pips per day the indicator should give accurate signals above80% with sl and 2 tps only. while using filter window below like rsi wich i will give its dimention as picture below. the developer has to contact me so i show how i want for better understanding and to help him make good
can you help me with Convert Pine Script to Ninja Script Project goal: To convert a Pine script indicator into Ninja script format. Scope of work: - Convert Camarilla Pivot Plays indicator from Pine script to Ninja script. - Ensure functionality remains consistent post-conversion. - Test and verify the accuracy of the converted script. Additional information: - The Pine script indicator is open-source. - Buyer can
Hi all, I want to buy the source code of BTC and ETH future and spot trading robots on bybit running on the web platform. Similar to the robot below. https://app.goodcrypto.app/trade/algos/gc-dca But add RSI strategy Sell over 80 / Buy over 20. =End= Thanks
Hello Great developer I want to program indicator system contain more than one indicator and I can switch between them or show or hide them by buttons out on the screen. The indicator is easy like fractal drawing arrows in the high and the low but with different inputs. And after drawing fractal arrows I want option to connect them with line like zigzag indicator. I want also to change candles colors in different

Project information

Budget
90+ USD
VAT (21%): 18.9 USD
Total: 108.9 USD
For the developer
81 USD
Deadline
from 1 to 3 day(s)