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
(258)
Projets
585
35%
Arbitrage
64
20% / 58%
En retard
147
25%
Gratuit
Publié : 1 article, 22 codes
2
Développeur 2
Évaluation
(450)
Projets
560
26%
Arbitrage
22
41% / 36%
En retard
85
15%
Gratuit
Publié : 6 codes
3
Développeur 3
Évaluation
(535)
Projets
613
34%
Arbitrage
34
38% / 44%
En retard
9
1%
Occupé
4
Développeur 4
Évaluation
(4)
Projets
5
20%
Arbitrage
0
En retard
1
20%
Gratuit
Publié : 3 codes
5
Développeur 5
Évaluation
(274)
Projets
335
37%
Arbitrage
6
50% / 17%
En retard
7
2%
Gratuit
Publié : 5 codes
6
Développeur 6
Évaluation
(434)
Projets
461
69%
Arbitrage
6
67% / 0%
En retard
2
0%
Travail
7
Développeur 7
Évaluation
(84)
Projets
115
70%
Arbitrage
5
80% / 0%
En retard
11
10%
Gratuit
8
Développeur 8
Évaluation
(2589)
Projets
3265
67%
Arbitrage
77
48% / 14%
En retard
341
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
1
0% / 100%
En retard
0
Gratuit
Commandes similaires
Kevin 30+ USD
Hi there, I am looking for EA that can: risk percentage of the account automate take profit and stop loss When TP or SL is hit open a new order open trades at the specific time
This indicator detects ABCD structure-based trading setups using a custom pullback and breakout logic, as discussed below. It works for both bullish and bearish scenarios (mirror logic), with user control over direction selection on the chart. ─────────────── 🔹 1. Pullback Logic: - Pullback is confirmed only after at least 2 red candles (in bullish case) have formed. - The body of one of these red candles must close
Hello everyone I need a good MQL5 developer to build a fully automated Expert Advisor (EA) for MT5 that uses price action strategy. (No grid, no indicator & no martingale) just a normal Expert Advisor (EA) . 🔸 ENTRY STRATEGY: Detect price action patterns: (Bullish/Bearish) Engulfing candles Pin bars (bullish /bearish) including spike rejections Breakouts of support and resistance (bearish/bullish) Use confirmed
Project goal: To develop a trading bot that interprets highs and lows for strategic long and short positions. Scope of work: - Develop a bot to long on Higher Low, Lower Low, or Double bottom signals. - Create bot to short on Higher High, Lower High, or Double top signals. - Incorporate support and resistance levels into the strategy. - Suggest improvements considering volume and market trends. Standard Support and
INDICATOR 30+ USD
I need a very Good indicator and I want non repaint non repaint and perfect one but I need a demo first else first else I’m not interested anymore also i don’t want to develop, I don’t have strategy I want an existing indicators.Am using both mt4 and mt5 but I prefer mt4
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
STEVENS 30 - 100 USD
I need an EXPERT ADVISOR that trades signals for XAU. It must check and correctly process possible errors in trading operations. The main criteria of opening and closing positions; direction of moving Average, price of the last bar. Set the numbers of lots to trade as an input parameter
Develop Custom Trade Panel for MT5 (with Source Code) – Budget $50 📋 Project Description: I am looking for a skilled MQL5 developer to create a Trade Panel tool for MetaTrader 5 , similar to the one listed here on MQL5 Market: Reference Product: https://www.mql5.com/en/market/product/35049 ✅ Core Requirements: The panel must support the following features: 🔹 Trade Entry Functions: One-click Buy / Sell at market

Informations sur le projet

Budget
90+ USD
TVA (21%): 18.9 USD
Total: 108.9 USD
Pour le développeur
81 USD
Délais
de 1 à 3 jour(s)