Posted 15 Days Ago Job ID: 2085097 22 quotes received

Convert Pinescript to mql5 - stocks

Featured
Fixed Price
Quotes (22)  ·  Premium Quotes (0)  ·  Invited (1)  ·  Hired (0)

  Send before: May 14, 2024

Send a Quote

Programming & Development Programming & Software

Convert Pinescript to mql5


Indicator to be converted: Directional Movement Index (script given below)

Stock symbol : 

ESM2024 - TradingView

EPM24     - Metatrader5


Period: 1 Minute


I have converted from pinescript to mql5 but the values are not matching between TradingView and Metatrader5.


The main objective of this job is to ensure that the values of this indicator is matching between TradingView and Metatrader5. If you do not have TradingView, you may use investing.com.


Pinescript code that needs to be converted is given below:

//@version=5

indicator("Average Directional Index", shorttitle="ADX", format=format.price, precision=2, timeframe="", timeframe_gaps=true)

adxlen = input(14, title="ADX Smoothing")

dilen = input(14, title="DI Length")

dirmov(len) =>

    up = ta.change(high)

    down = -ta.change(low)

    plusDM = na(up) ? na : (up > down and up > 0 ? up : 0)

    minusDM = na(down) ? na : (down > up and down > 0 ? down : 0)

    truerange = ta.rma(ta.tr, len)

    plus = fixnan(100 * ta.rma(plusDM, len) / truerange)

    minus = fixnan(100 * ta.rma(minusDM, len) / truerange)

    [plus, minus]

adx(dilen, adxlen) =>

    [plus, minus] = dirmov(dilen)

    sum = plus + minus

    adx = 100 * ta.rma(math.abs(plus - minus) / (sum == 0 ? 1 : sum), adxlen)

sig = adx(dilen, adxlen)

plot(sig, color=color.red, title="ADX")



... Show more
Praveen R Canada