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
等级
(266)
项目
598
35%
仲裁
64
20% / 58%
逾期
147
25%
空闲
发布者: 1 文章, 22 代码
2
开发者 2
等级
(452)
项目
565
26%
仲裁
24
42% / 38%
逾期
85
15%
工作中
发布者: 6 代码
3
开发者 3
等级
(568)
项目
657
32%
仲裁
41
41% / 46%
逾期
11
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
等级
(450)
项目
477
69%
仲裁
6
67% / 0%
逾期
2
0%
工作中
7
开发者 7
等级
(87)
项目
121
68%
仲裁
5
80% / 0%
逾期
12
10%
工作中
8
开发者 8
等级
(2659)
项目
3377
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
空闲
相似订单
Hi i need an expert to built a automated trading bot for ninja trader platform like sniper auto trader bot If you can develop or build automated bot for ninjatrader, let me know
Project goal: To code several items for Ninja Trader, ranging from simple to more complex tasks, with potential for ongoing collaboration. Scope of work: - Develop code for specific items in Ninja Trader. - Implement minor functionalities like a line at a time level. - Address more complex coding needs as they arise
Hello Developers I have a Project to get done! i have a simple strategy can you please create the automated forex ea to execute my trading strategy? i need custom ea for tradingview and mt4/mt5 correction: i need a tradingview indicator created that tells me when to buy or sell. and ea in mt4/mt5
Early Killer EA 30+ USD
It must have automated stop loss. Something that can end poverty and kill the market early.It must take the trades for me whenever I start it it must work on tradeport ea
Hi, I hope you’re doing great. I’d like to share the project details. The original EA is already working, but I need you to first review and verify that all existing features are functioning correctly. After confirming everything works properly, the next task is to add a simple user dashboard that shows the number of detected zones, buy/sell/none status, and includes an ON/OFF button. Also, please make sure that
Ninjatrdaer Script 500 - 1000 USD
I am looking to purchase a ninjatrader script, if there is any for sale, i mean a ready made ninjatrdaer script that trade futures, i need the seller to show me a backtest of the system, you know send some results, I would like to see a 1 year and YTD backtest
I will like to purchase tradingview strategy with high winning rate, i mean already made, tested and trusted and powerful strategy, i have tried to code my own strategy with lot of freelancers but nothing to me i am just wasting money, i have wasted lot of money already, so i need a high winning rate tradingview strategy, we can discuss price in chat, I will need to see some test result as well
Mk 30+ USD
I need a fully automated trading robot designed to generate consistent profits while strictly controlling risk and minimizing losses. The robot should use a combination of strategies, including trend-following, scalping, and price action, and must be able to adapt to different market conditions such as trending and ranging markets. It should analyze the market using indicators like Moving Averages, RSI, MACD, and
Hi, I hope you doing Greate, Let me share details , so the original EA already working but you can check and verify everything fine.First you verify that all original EA features are working correctly then add a user dashboard showing the number of detected zones, buy sell both none status, and an on off button. also ensure mitigated zones disappear properly and that trades follow the zone rules, and integrate the
1. IF price forms: - Higher highs + higher lows → TREND = BUY - Lower highs + lower lows → TREND = SELL ELSE → NO TRADE 2. IF: - Trend = BUY - Price retraces to support zone - Bullish engulfing candle forms - TDI green crosses above red (optional) THEN: - Execute BUY 3. IF: - Trend = SELL - Price retraces to resistance - Bearish engulfing forms - TDI confirms THEN: - Execute SELL 4. Risk per trade = 1% of account Lot

项目信息

预算
90+ USD
截止日期
 1  3 天