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

Tarea técnica

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.



Archivos adjuntos:

ZIP
trash15.zip
3.6 Kb

Han respondido

1
Desarrollador 1
Evaluación
(265)
Proyectos
596
35%
Arbitraje
64
20% / 58%
Caducado
147
25%
Trabaja
Ha publicado: 1 artículo, 22 ejemplos
2
Desarrollador 2
Evaluación
(452)
Proyectos
565
26%
Arbitraje
24
42% / 38%
Caducado
85
15%
Libre
Ha publicado: 6 ejemplos
3
Desarrollador 3
Evaluación
(548)
Proyectos
632
33%
Arbitraje
39
38% / 49%
Caducado
11
2%
Trabajando
4
Desarrollador 4
Evaluación
(4)
Proyectos
5
20%
Arbitraje
2
0% / 100%
Caducado
1
20%
Libre
Ha publicado: 3 ejemplos
5
Desarrollador 5
Evaluación
(278)
Proyectos
340
37%
Arbitraje
6
50% / 17%
Caducado
7
2%
Libre
Ha publicado: 5 ejemplos
6
Desarrollador 6
Evaluación
(449)
Proyectos
477
69%
Arbitraje
6
67% / 0%
Caducado
2
0%
Libre
7
Desarrollador 7
Evaluación
(87)
Proyectos
121
68%
Arbitraje
5
80% / 0%
Caducado
12
10%
Libre
8
Desarrollador 8
Evaluación
(2640)
Proyectos
3355
67%
Arbitraje
77
48% / 14%
Caducado
342
10%
Libre
Ha publicado: 1 ejemplo
9
Desarrollador 9
Evaluación
(102)
Proyectos
105
60%
Arbitraje
0
Caducado
0
Libre
10
Desarrollador 10
Evaluación
(132)
Proyectos
178
39%
Arbitraje
4
25% / 50%
Caducado
14
8%
Libre
11
Desarrollador 11
Evaluación
(3)
Proyectos
2
50%
Arbitraje
2
0% / 100%
Caducado
0
Libre
Solicitudes similares
hello great developer ’m looking for an experienced NinjaTrader developer to help set up software on my VPS, create custom chart templates with multiple indicators, and build an arbitrage dashboard/trade copier system. The project includes multi-account management and integration with Bookmap. I need a custom dashboard to monitor and control multiple accounts efficiently. Please message me if you have strong
What informtion would you need for Ninjatrader futures automated trading and how long would it take ? if anyone can give me answer i will be happy to discuss more about the project thanks fill free to bid to the project thanks
Requirements: - Convert my written trading rules into TradingView Pine strategy - Then convert into MT5 EA - Entry must be next candle open after signal candle close - Stop loss on signal candle high/low - Position sizing: fixed % risk per trade - Portfolio risk cap across symbols - One trade per symbol at a time - Must understand backtesting differences (spread, slippage, fill logic) Important: I want to be able to
Hi there, your attention is urgently needed if you have the right profession in both MQL4 and Ninjascript code, as I am in need of a very reliable programmer to help convert my MQL4 code into a well functioning ninjatrader, this includes the full reconstruction of the entire code, applicant must be able to provide their previous work in line with this specs thanks
Proficient coder needed for converting my MQL4 code to a well functional Nintrader 8 strategies, coder must be able to provide seamless tailored solutions as I need the NT8 strategy: - Replicate the exact same logic, behavior, and decision flow as the MT4 EA - Take the same trades under comparable market conditions - Include all internal logic, states, controls, and integrations present in the code - Be a faithful
Data Integrity 500 - 1000 USD
The trading bot is an automated software system designed to monitor financial markets, execute trades, and manage risk based on predefined strategies. The bot aims to maximize profits while minimizing human intervention and emotional decision-making. Scope: Supports automated trading on selected exchanges (e.g., Binance, Bitget, Coinbase). Executes trades based on technical indicators, signals, or AI models. Provides
I want a modification on my ea . A spread filter or slipage filter such that when the market price is less than 50 point away from the pend order , then ea check the spread if less than the set filter spread. If spread is more than the set spread, the ea will delete the pend order . Secondly , if the broker price is moved or sliped the pending order from the original price it was set by the tolerable slipage distance
1. Objective Create an MT5 automation script (or set of scripts) that fully automates my strategy optimization workflow, including: • Batch optimization runs • Automatic filtering of results • Automatic forward testing • Exporting and organizing results into structured files/folders The goal is to reduce manual work and allow one‑click execution of the entire pipeline. 2. Platform & Environment • MetaTrader 5 •
Would it be possible to connect Futures prop firm with Rithmic or Tradeovate platform to Ninjatrader automated trading ? If anyone can do this for me I will be happy to get started with the person right away
I have a open source Tradingview indicator that I want it to be converted to Ninja Trader8. I have attached it. Please let me know, if you can do it and for how muc

Información sobre el proyecto

Presupuesto
90+ USD
Plazo límite de ejecución
de 1 a 3 día(s)