Re: Already Converted TradingView Indicators to MT4 Indicators

591
nwesterhuijs wrote: Mon May 05, 2025 8:44 pm Check the third option in the inputs: "MaxBarsMulti" or "Max Bars ..."

Introduced it as an multiplier of Trend Length to make it easier wrt consistency checks. A "0"-value will ignore this feature and for me at a value of 4 one quickly sees the impact of limiting bars, hence defaulted to 10 for the time being. Also changed Indicator Prefix to "222" so one can drag and drop both version 1 and 2 onto a chart and compare them.

Relative_Trend_Index_v2.mq4

And some additional price options and Jurik smoothening of RTI (set Length to 1 to have original):

Relative_Trend_Index_v4.mq4

Top sub-window no smoothening (v2) and bottom sub-window has Jurik smoothening (v4):

2025-05-05 15_55_04-2796399_ Afterprime-Demo AP - Demo Account - Afterprime Ltd - [EURUSD,H1].png
Thanks, the improved version produces the same output of original version, but it works better and after the compilation the there is no "warning". Good work! :thumbup:


Re: Already Converted TradingView Indicators to MT4 Indicators

592
nwesterhuijs wrote: Mon May 05, 2025 8:44 pm Check the third option in the inputs: "MaxBarsMulti" or "Max Bars ..."

Introduced it as an multiplier of Trend Length to make it easier wrt consistency checks. A "0"-value will ignore this feature and for me at a value of 4 one quickly sees the impact of limiting bars, hence defaulted to 10 for the time being. Also changed Indicator Prefix to "222" so one can drag and drop both version 1 and 2 onto a chart and compare them.

Relative_Trend_Index_v2.mq4

And some additional price options and Jurik smoothening of RTI (set Length to 1 to have original):

Relative_Trend_Index_v4.mq4

Top sub-window no smoothening (v2) and bottom sub-window has Jurik smoothening (v4):

2025-05-05 15_55_04-2796399_ Afterprime-Demo AP - Demo Account - Afterprime Ltd - [EURUSD,H1].png
The new version i didn't yet check, but it seems very pretty and better. Thank you :thumbup:

Re: Already Converted TradingView Indicators to MT4 Indicators

593
ummadirajani wrote: Thu May 01, 2025 5:28 pm hi mrtools
is it possible to convert this trading view indicator to mt4 Indicator
I am attaching the code here
//@version=6
indicator('ATR Based Zigzag w EMA', overlay = true)
// === Inputs ===
ATRLength = input(14, title = 'ATR Length')
ATRMult = input(5.0, title = 'ATR Multiplier')
lineSmoothLength = input(50, title = 'Line Smoothness (EMA Length)')
upTrendColor = input(color.rgb(0, 255, 132), title = 'Uptrend Line Color')
downTrendColor = input(color.rgb(255, 0, 0), title = 'Downtrend Line Color')
// === ATR Calculation ===
atr_val = ta.atr(ATRLength)
// === State Variables ===
var float LL = na
var float HH = na
var int trend = 1
// === Initialization ===
LL := na(LL[1]) ? low : LL[1]
HH := na(HH[1]) ? high : HH[1]
trend := na(trend[1]) ? 1 : trend[1]
// === Core Logic ===
if trend > 0 // Uptrend: looking for new swing low
if high >= HH
HH := high
HH
else
if low < HH - atr_val * ATRMult
trend := -1
LL := low
LL
else // Downtrend: looking for new swing high
if low <= LL
LL := low
LL
else
if high > LL + atr_val * ATRMult
trend := 1
HH := high
HH
// === Median Price (or pick a price base you prefer) ===
medianPrice = (high + low) / 2
// === Smoothed Line ===
smoothLine = ta.ema(medianPrice, lineSmoothLength)
// === Plotting the Clean Trend Line ===
plot(smoothLine, color = trend == 1 ? upTrendColor : downTrendColor, linewidth = 3, title = 'Trend Line')
// === (Optional) Bar Coloring Too ===
barcolor(trend == 1 ? upTrendColor : downTrendColor)
HI mrtools
please consider converting this trading view Indicator to mt4

Re: Already Converted TradingView Indicators to MT4 Indicators

594
nwesterhuijs wrote: Mon May 05, 2025 5:57 pm My attention was caught by this one. Shading works a bit nicer in TV, so replaced by either histogram or lines in MT4, depending on the setting.

2025-05-05 11_51_43-2796399_ Afterprime-Demo AP - Demo Account - Afterprime Ltd - [EURUSD,H1].png


High_Low_Cloud_Trend.mq4

Enjoy!
Cool indicator, I tried using Claude AI to code some audio alerts but with no success... Could you please take a look at the code?