Fix this custom Zigzag indicator (on an oscillator + counter)

Termos de Referência

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.

I refer to the image below: the Aqua colored line is how the counter jumps back, while the red line is how it should be.

I'm happy to answer any questions.


example_eurusd_visual_backtest.png


Arquivos anexados:

Respondido

1
Desenvolvedor 1
Classificação
(6)
Projetos
8
25%
Arbitragem
2
50% / 0%
Expirado
2
25%
Livre
2
Desenvolvedor 2
Classificação
(19)
Projetos
22
23%
Arbitragem
5
40% / 60%
Expirado
2
9%
Trabalhando
3
Desenvolvedor 3
Classificação
(16)
Projetos
35
23%
Arbitragem
4
0% / 50%
Expirado
2
6%
Trabalhando
4
Desenvolvedor 4
Classificação
(55)
Projetos
66
58%
Arbitragem
1
0% / 0%
Expirado
0
Livre
5
Desenvolvedor 5
Classificação
(9)
Projetos
19
16%
Arbitragem
3
67% / 0%
Expirado
0
Livre
6
Desenvolvedor 6
Classificação
(70)
Projetos
91
25%
Arbitragem
26
19% / 54%
Expirado
25
27%
Livre
7
Desenvolvedor 7
Classificação
(45)
Projetos
91
13%
Arbitragem
34
26% / 59%
Expirado
37
41%
Livre
Pedidos semelhantes
Junior EA 30+ USD
1. EA for MT5, hedging allowed. 2. Entry: 50 EMA crosses 200 EMA on H1. Buy on bullish cross, sell on bearish. 3. SL: 100 pips, TP: 200 pips. No trailing stop. 4. Lot size: 0.01 fixed. Max 3 trades at once. 5. Trade only 08:00-18:00 GMT. No trades if spread > 20 points. 6. Inputs: EMA periods, SL, TP, lot size, start/end time
Specification 300 - 900 USD
looking for a highly experienced mql5 developer to build a professional trading ea based on multi timeframe top down analysis and market structure concepts the system should combine higher timeframe context with lower timeframe execution and provide both precise logic and clean visual representation on chart ⸻ core requirements • implementation of multi timeframe logic higher timeframe bias combined with lower
MT5 Expert Advisor Specification: Asian Liquidity Sweep & M5 FVG Entry ​Project Overview ​Automated Expert Advisor for EUR/USD on MT5. The strategy maps structural liquidity (Fractal Swings) for entry triggers but targets absolute session extremes for Take Profit. It enters on the first opposite M5 Fair Value Gap (FVG) and features a dynamic, user-controlled risk engine. ​1. Timezone & News Filter Requirements ​The
I am looking for an experienced MQL4/MQL5 developer to build a custom MT4 indicator from scratch or cracking my ex4 file that i provide to you. I already have an existing indicator (EX4) which produces highly accurate buy/sell signals. I want a similar indicator developed based on its observable behavior and signal structure. my existing indicator is pc id protected so you have to do PC ID security bypass and source
OBJETIVO Criar um Expert Advisor MT5 profissional para XAUUSD focado em: Consistência Baixo drawdown Scalping profissional Proteção da conta Crescimento sustentável Compatibilidade com conta micro e prop firms NÃO utilizar: Martingale Grid Hedge agressivo Recovery system Multiplicação de lotes após perda --- ATIVO XAUUSD apenas --- TIMEFRAMES Timeframe principal M5 Confirmação tendência M15 Confirmação macro opcional
I need a very advanced and intelligent MT5 Expert Advisor coded in MQL5 for XAUUSD, based on ICT + CRT + Smart Money Concepts. The goal is not a simple robot, but a professional decision-making system with strong filters, risk control, and high-quality trade selection. The EA must include: 1. Multi-Timeframe Analysis - D1 / H4 / H1 bias - M15 / M5 entry confirmation - Bullish or bearish market structure - BOS, CHoCH
Intraday Trade Ninja EA — Complete Logic Structure This document maps the full architecture, execution logic, signal flow, trade management, and safety structure of the Intraday Trade Ninja MT4 Expert Advisor. 1. Core Indicators · ©Price Border (TMA bands) · MA-X Arrows · MA-Y Arrows · LeManSignal · EMA 49 & 89 - Per Candle Color Switching 2. EA Entry Architecture ·
I have a 90% completed project with the execution part left to complete, I have been struggling to complete this section and I need help from someone expert in MQL5 with knowledge on forex trading and ICT Concepts coding. Contact me for further details
Pip killer ntt 100+ USD
Create a forex robot especially for sculping using the 3 ema strategy which consists of the following moving average levels of the 15 ma ,30 ema , 60 ema and 90 which enter potentially on a retest into the ema and targets opposite direction after the retest .Potentially bringing into account that the number of retested emas controlls the number of entreis which for eg. retest of the 15 ema single 0.01 trade is
📌 Project Overview: I need a full Smart Trade Management System for MetaTrader 4/5. This is a complete trading ecosystem, not a simple EA. 📌 Core Features: Smart Money Management (risk-based lot calculation) Advanced Trading Toolbox (TradingView-style drawing tools) Central Master Dashboard (risk, filters, account control) Multi-account monitoring (MT4/MT5 synchronization) Real-time monitoring (spread, equity

Informações sobre o projeto

Orçamento
100+ USD
Prazo
de 1 para 8 dias