Pine script (Tradingview Indicator) Conversion to MT4/MT5 required

Tarea técnica

MT5 Indicator Conversion Specification

Zero-Lag MA Trend Levels — TradingView/Pine Script to MT5

1. Project Objective

Convert the supplied TradingView Pine Script v5 indicator:

"Zero-Lag MA Trend Levels [ChartPrime]"

into a fully functional MetaTrader 5 (MT5) custom indicator written in MQL5.

The objective is to reproduce the TradingView indicator's calculations, signals, visual appearance, trend levels, and behavior as closely as technically possible.

The final product must operate directly on an MT5 chart without requiring external indicators, DLLs, or additional files.


2. Original Indicator Logic

The original Pine Script uses:

  • EMA

  • Zero-Lag Moving Average (ZLMA)

  • ATR

  • Bullish/bearish crossovers

  • Trend-level zones

  • Secondary bullish/bearish signals

Default inputs:

  • Length = 15

  • ATR Period = 200

  • Trend Levels = ON

  • Bullish color = #30D453

  • Bearish color = #4043F1


3. Core Calculations

The MT5 version must reproduce the following calculations.

EMA

Calculate:

EMA = EMA(Close, Length)

Default:

Length = 15

Zero-Lag Correction

Calculate:

Correction = Close + (Close - EMA)

ZLMA

Calculate:

ZLMA = EMA(Correction, Length)

The ZLMA calculation must match TradingView's ta.ema() behavior as closely as possible.


4. Trend Direction

The original indicator determines the ZLMA trend using the value three bars previously.

Bullish ZLMA:

ZLMA > ZLMA[3]

Bearish ZLMA:

ZLMA < ZLMA[3]

If neither condition is true, the neutral state may be used.

Colors

Bullish:

#30D453

Bearish:

#4043F1


5. EMA Color

The EMA changes color according to its relationship with ZLMA.

Bullish

When:

EMA < ZLMA

EMA should use the bullish color.

Bearish

When:

EMA >= ZLMA

EMA should use the bearish color.


6. Crossover Signals

Bullish Signal

A bullish signal occurs when ZLMA crosses above EMA:

ZLMA crosses above EMA

Equivalent to:

ZLMA > EMA

on the current closed candle while:

ZLMA(previous) <= EMA(previous)

Bearish Signal

A bearish signal occurs when ZLMA crosses below EMA:

ZLMA crosses below EMA

Equivalent to:

ZLMA < EMA

on the current closed candle while:

ZLMA(previous) >= EMA(previous)


7. Crossover Visualization

At every bullish crossover:

  • Plot a small diamond at the ZLMA price.

  • Use the bullish color.

At every bearish crossover:

  • Plot a small diamond at the ZLMA price.

  • Use the bearish color.

The diamonds must remain visible historically.

They must not disappear when the indicator is reloaded.


8. ZLMA and EMA Lines

The chart must display:

  1. ZLMA

  2. EMA

Both should be plotted directly on the main price chart.

The ZLMA color should change according to its direction.

The EMA color should change according to whether it is above or below ZLMA.


9. Fill Between ZLMA and EMA

The area between ZLMA and EMA should be visually filled.

Bullish

When:

ZLMA > EMA

Use the bullish color with transparency.

Bearish

When:

ZLMA < EMA

Use the bearish color with transparency.

The fill should update automatically as the relationship between the two lines changes.


10. ATR Calculation

Calculate:

ATR = ATR(200)

Default ATR period:

200

The ATR is used to determine the height of the trend-level zone.

The ATR period should be exposed as an MT5 input.


11. Bullish Trend-Level Zone

When a bullish ZLMA/EMA crossover occurs:

Top

ZLMA

Bottom

ZLMA - ATR

Create a bullish rectangular zone between these two prices.

The zone should use the bullish color with transparency.

The price associated with the signal should also be displayed where practical.


12. Bearish Trend-Level Zone

When a bearish ZLMA/EMA crossover occurs:

Top

ZLMA + ATR

Bottom

ZLMA

Create a bearish rectangular zone between these prices.

The zone should use the bearish color with transparency.


13. Trend-Level Extension

The trend-level zone should extend to the right after its creation.

The default extension is approximately 4 bars, matching the TradingView implementation.

The developer should ensure that the zone remains visually consistent with the TradingView version.


14. Secondary Bullish Signal

The original indicator creates a bullish ▲ signal when price crosses above the top of the active bullish trend-level zone.

Conditions should reproduce the Pine logic:

  • Price crosses above the trend-level top.

  • There was no new crossover signal on the current or previous bar.

  • EMA is below ZLMA.

The ▲ should be plotted around the relevant candle.

The signal must remain visible historically.


15. Secondary Bearish Signal

The original indicator creates a bearish ▼ signal when price crosses below the bottom of the active bearish trend-level zone.

Conditions:

  • Price crosses below the trend-level bottom.

  • There was no new crossover signal on the current or previous bar.

  • EMA is above ZLMA.

The ▼ should be plotted around the relevant candle.

The signal must remain visible historically.


16. Non-Repainting Requirement

This is important.

The MT5 indicator should not repaint historical signals.

Signals should preferably be confirmed using the closed candle.

Once a crossover or secondary signal has been confirmed on a closed candle:

  • It must remain on the chart.

  • It must not move to another historical candle.

  • It must not disappear after refreshing MT5.

  • It must not change simply because new candles appear.

The developer should clearly identify if any part of the original TradingView logic inherently behaves differently in real time.


17. Historical Data

When the indicator is attached to an existing MT5 chart, it must calculate historical data.

For example, if the chart contains 5,000 candles, the indicator should calculate and display historical:

  • ZLMA

  • EMA

  • crossover diamonds

  • trend-level zones

  • ▲ signals

  • ▼ signals

It must not only display signals generated after the indicator is attached.


18. Inputs

The MT5 indicator should have the following inputs:

Main Settings

Length = 15

ATR Period = 200

Display

Show Trend Levels = true

Show Secondary Signals = true

Colors

Bullish Color = #30D453

Bearish Color = #4043F1

Alerts

Enable Alerts = false

Enable Push Notifications = false

Alert On Closed Candle = true


19. Alerts

Optional alerts should be provided for:

Bullish crossover

"Symbol / Timeframe — Bullish ZLMA crossover"

Bearish crossover

"Symbol / Timeframe — Bearish ZLMA crossover"

Optionally provide alerts for:

  • ▲ secondary bullish signal

  • ▼ secondary bearish signal

Alerts should be one-time per signal.

The indicator must not repeatedly alert on every tick while the same signal remains active.


20. Performance

The indicator should be lightweight.

Avoid:

  • unnecessary calculations on every tick

  • excessive chart objects

  • infinite object creation

  • unnecessary recalculation of the entire history on every tick

Historical calculations may be performed when the indicator first loads, while subsequent calculations should preferably process only newly available data.

The indicator should be suitable for:

  • XAUUSD

  • Forex pairs

  • indices

  • CFDs

  • multiple MT5 timeframes


21. Object Management

All chart objects created by the indicator must have a unique naming prefix.

For example:

ZLMA_TL_

When the indicator is removed from the chart, its objects should be removed automatically.

The indicator must not delete or modify objects belonging to other indicators or the trader.


22. Timeframes

The indicator should work on all standard MT5 timeframes, including:

  • M1

  • M5

  • M15

  • M30

  • H1

  • H4

  • D1

  • W1

  • MN1

No hard-coded timeframe should be used unless specifically required by the original Pine Script.


23. Symbol Compatibility

The indicator should work with different broker symbol formats, including symbols such as:

  • XAUUSD

  • XAUUSDm

  • XAUUSD.a

  • EURUSD

  • GBPUSD

  • US30

  • NAS100

  • and Synthetic Indices from Deriv broker

The code must use the current chart's symbol and price precision automatically.


24. Compilation Requirements

The final source code must compile in the current MetaEditor/MT5 environment with:

  • 0 errors

  • 0 warnings where reasonably possible

The developer must provide the complete .mq5 source code.

No DLL dependency should be required.

No external indicator should be required.


25. Testing Requirements

Before delivery, the developer should test the indicator on:

XAUUSD M1

and at least one:

EURUSD M15/H1

Testing should verify:

  1. ZLMA matches the TradingView calculation.

  2. EMA matches TradingView.

  3. Crossovers occur on the same candles.

  4. Diamonds appear on the same candles.

  5. Trend-level zones appear on the same signals.

  6. Secondary ▲/▼ signals correspond to the Pine logic.

  7. Historical signals remain visible.

  8. Signals do not unnecessarily repaint.

  9. Alerts trigger only once.

  10. Removing/reloading the indicator does not destroy historical signal integrity.


26. TradingView Comparison

The developer should compare the MT5 version against the supplied TradingView indicator using the same:

  • Symbol

  • Timeframe

  • Length

  • ATR period

  • Historical date range

The developer should aim for candle-by-candle agreement between TradingView and MT5.

Small differences caused by broker price feeds may be expected.


27. Deliverables

The developer should provide:

Required

  1. Complete .mq5 source code.

  2. Compiled .ex5 indicator.

  3. List of configurable inputs.

  4. Brief installation instructions.

  5. Confirmation that the indicator compiles without errors.

Optional

  1. Screenshots comparing TradingView and MT5.

  2. Explanation of any unavoidable differences.

  3. Alert configuration instructions.


28. Acceptance Criteria

The project will be considered complete when:

  • The indicator compiles successfully.

  • ZLMA and EMA calculations reproduce the Pine logic.

  • Bullish and bearish crossovers are correctly identified.

  • Crossover diamonds are visible.

  • Trend-level zones are correctly generated.

  • Secondary ▲/▼ signals are correctly generated.

  • Historical signals are visible.

  • The indicator does not unnecessarily repaint.

  • Alerts work correctly and do not repeat continuously.

  • The indicator works on XAUUSD and standard Forex symbols.

  • The indicator does not significantly slow down MT5.

  • All objects are properly managed when the indicator is removed.

Source Code

The developer will be provided with the original TradingView Pine Script v5 source code for:

Zero-Lag MA Trend Levels [ChartPrime]

The Pine Script should be treated as the reference implementation. The MT5 implementation should reproduce its behavior rather than merely translating Pine syntax line-by-line.


Han respondido

1
Desarrollador 1
Evaluación
(623)
Proyectos
727
34%
Arbitraje
47
49% / 40%
Caducado
14
2%
Trabajando
2
Desarrollador 2
Evaluación
(64)
Proyectos
144
46%
Arbitraje
21
38% / 24%
Caducado
32
22%
Libre
3
Desarrollador 3
Evaluación
Proyectos
0
0%
Arbitraje
0
Caducado
0
Libre
Ha publicado: 2 ejemplos
4
Desarrollador 4
Evaluación
(436)
Proyectos
646
53%
Arbitraje
35
63% / 20%
Caducado
7
1%
Trabaja
5
Desarrollador 5
Evaluación
(22)
Proyectos
28
7%
Arbitraje
9
33% / 33%
Caducado
1
4%
Trabaja
6
Desarrollador 6
Evaluación
(400)
Proyectos
518
24%
Arbitraje
61
57% / 25%
Caducado
60
12%
Trabaja
7
Desarrollador 7
Evaluación
(3)
Proyectos
4
0%
Arbitraje
0
Caducado
0
Libre
8
Desarrollador 8
Evaluación
(83)
Proyectos
97
32%
Arbitraje
9
22% / 56%
Caducado
5
5%
Trabaja
9
Desarrollador 9
Evaluación
Proyectos
0
0%
Arbitraje
0
Caducado
0
Libre
10
Desarrollador 10
Evaluación
Proyectos
0
0%
Arbitraje
0
Caducado
0
Libre
11
Desarrollador 11
Evaluación
(3)
Proyectos
9
67%
Arbitraje
0
Caducado
0
Trabaja
12
Desarrollador 12
Evaluación
(13)
Proyectos
22
41%
Arbitraje
8
0% / 50%
Caducado
3
14%
Trabaja
13
Desarrollador 13
Evaluación
(211)
Proyectos
274
21%
Arbitraje
25
52% / 16%
Caducado
0
Trabajando
14
Desarrollador 14
Evaluación
(183)
Proyectos
197
46%
Arbitraje
4
50% / 25%
Caducado
1
1%
Trabaja
15
Desarrollador 15
Evaluación
(1)
Proyectos
1
0%
Arbitraje
0
Caducado
0
Libre
Ha publicado: 2 ejemplos
16
Desarrollador 16
Evaluación
(14)
Proyectos
15
40%
Arbitraje
3
0% / 100%
Caducado
0
Libre
Ha publicado: 1 artículo
17
Desarrollador 17
Evaluación
(319)
Proyectos
571
35%
Arbitraje
84
31% / 44%
Caducado
206
36%
Trabaja
18
Desarrollador 18
Evaluación
(2)
Proyectos
2
0%
Arbitraje
1
0% / 100%
Caducado
0
Libre
19
Desarrollador 19
Evaluación
Proyectos
0
0%
Arbitraje
0
Caducado
0
Libre
20
Desarrollador 20
Evaluación
Proyectos
0
0%
Arbitraje
0
Caducado
0
Libre
21
Desarrollador 21
Evaluación
(7)
Proyectos
6
0%
Arbitraje
4
25% / 75%
Caducado
2
33%
Libre
22
Desarrollador 22
Evaluación
Proyectos
0
0%
Arbitraje
0
Caducado
0
Libre
23
Desarrollador 23
Evaluación
Proyectos
0
0%
Arbitraje
0
Caducado
0
Libre
24
Desarrollador 24
Evaluación
(9)
Proyectos
11
27%
Arbitraje
0
Caducado
2
18%
Trabaja
Ha publicado: 1 ejemplo
25
Desarrollador 25
Evaluación
(19)
Proyectos
22
18%
Arbitraje
9
33% / 44%
Caducado
3
14%
Trabaja
Ha publicado: 1 ejemplo
26
Desarrollador 26
Evaluación
(45)
Proyectos
53
57%
Arbitraje
2
100% / 0%
Caducado
1
2%
Libre
Ha publicado: 5 ejemplos
27
Desarrollador 27
Evaluación
(556)
Proyectos
850
61%
Arbitraje
33
27% / 45%
Caducado
24
3%
Libre
Ha publicado: 1 ejemplo
28
Desarrollador 28
Evaluación
(2)
Proyectos
3
67%
Arbitraje
0
Caducado
0
Trabaja
Ha publicado: 2 ejemplos
Solicitudes similares
I need a professional XAUUSD signal indicator for MetaTrader 5, written entirely in MQL5 (.mq5). IMPORTANT: This is NOT an auto-trading EA. It must never open, close or modify trades. It only analyzes XAUUSD and generates signals + MT5 push notifications. 1. Multi-timeframe analysis: H4 → H1 → M30 → M15 → M10 → M5 → M1. 2. Detect market structure: - Swing High / Swing Low - BOS - MSS - CHOCH - Bullish/Bearish HTF
i have indicator for Trading View, also copy for NT, i need someone to improve and check the NT version (indicator is simple is volume density koncept)…. when i put same settings on TV version and NT version i have diffrerent results, but this can be because diffrent market data or fact that TV sending tick info in blocks , not tick by tick like NT8 on both. I(ndicator base on counting volume) so besied that is it
I need a developer who can write me a XML file for a dbot robot to trade any deriv option instruments and trading mode A market analyser is needed. Let it automatically scan the market and choose the instrument and with the best input parameters for a given trading mode and show the predicted win rate as shown in the videos below; https://vt.tiktok.com/ ZSb14aoAA/ https://vt.tiktok.com/ ZSb1bFBkA/
Please may someone assist me with the indicator attached, it has a SERIOUS BUG issue in the sense that when I load it, and activate the template (attached as well) MT4 ALWAYS freezes and then eventually disconnects automatically, ALL THE TIME. It even gets worse to an extent that after disconnecting a number of times mt4 ends up not loading anymore, UNTIL I remove the indicator. Please I WILL NEED A DEMO (FOR A DAY)
I need a professional AI-assisted Forex trading Expert Advisor (EA) for MetaTrader 5. The EA should not be based on a simple single indicator strategy. I want a robust multi-factor trading system that can analyze market conditions, trend, momentum, volatility, price action and risk before entering a trade. Requirements: Forex trading on MT5 Automated analysis and trade execution Dynamic entry and exit decisions Stop
We are seeking an independent technical reviewer for a frozen Python evidence/specification candidate related to an XAUUSD paper-trading risk system (ALKOOS-AI). This is NOT a request to develop, modify, optimize, or execute a trading robot or trading strategy. The task is limited to independent verification of a prepared evidence package. The reviewer should verify: Integrity of the supplied frozen artifact using
Creating a bot using the Parabolic indicator with a simple interface.. I want a bot that uses the Parabolic SAR indicator only, with these orders attached to it. Boot name : HEMIN .FX Magic number : 000000 …………………………………………………. Trade behavior : regular OR inverse OR only long "buy" OR only short "sell" Timeframe : ………… Period: ……… ………………………………………………….. Lot size : ……………… Break even in points : …
Gold robot 30+ USD
Yes. This screen is asking you to write the Requirements Specification for your Gold/XAUUSD trading robot. Since you want your DEEPTHINK X10 institutional-style MT5 system , use this ready-to-paste specification: DEEPTHINK X10 GOLD ROBOT – MT5 EXPERT ADVISOR REQUIREMENTS Develop an advanced MetaTrader 5 Expert Advisor (EA) for XAUUSD (Gold) scalping based on a multi-factor DEEPTHINK X10 trading framework. 1. MARKET -
I need a custom MQL5 indicator for MetaTrader 5. The indicator must automatically print entry, stop loss, and take profit zones on the chart using dots. A critical requirement is that these dots must be non-lagging and absolutely non-repainting. Additionally, the indicator needs to identify and display current supply and demand zones. Please provide the mq5 source code and the ex5 file upon completion
Expert Advisors 300+ USD
double CRiskManager::CalculateLotSize(double slPoints) { double balance = AccountInfoDouble(ACCOUNT_BALANCE); double riskMoney = balance * (m_riskPercent / 100.0); double tickValue = SymbolInfoDouble(_Symbol, SYMBOL_TRADE_TICK_VALUE); double tickSize = SymbolInfoDouble(_Symbol, SYMBOL_TRADE_TICK_SIZE); double pointValue = tickValue / tickSize; double lot = riskMoney / (slPoints * pointValue);

Información sobre el proyecto

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

Cliente

(5)
Encargos realizados14
Número de arbitrajes0