Page 13 of 59

Re: Already Converted TradingView Indicators to MT4 Indicators

Posted: Sat Sep 03, 2022 3:10 am
by Knight
Sorry guys, I honestly didn't know how to get the code out. But gimme a second. Let me try, any help would also be appreciated.

Re: Already Converted TradingView Indicators to MT4 Indicators

Posted: Sat Sep 03, 2022 3:31 am
by Jon
Knight wrote: Sat Sep 03, 2022 3:10 am Sorry guys, I honestly didn't know how to get the code out. But gimme a second. Let me try, any help would also be appreciated.
Yes they are pretty ruthless lol

Re: Already Converted TradingView Indicators to MT4 Indicators

Posted: Sat Sep 03, 2022 3:33 am
by Knight
<!-- TradingView Chart BEGIN -->
<script type="text/javascript" src="https://s3.tradingview.com/tv.js"></script>
<script type="text/javascript">
var tradingview_embed_options = {};
tradingview_embed_options.width = '640';
tradingview_embed_options.height = '400';
tradingview_embed_options.chart = 'fSTqdHYh';
new TradingView.chart(tradingview_embed_options);
</script>
<p><a href="https://www.tradingview.com/script/fSTq ... /">JCFBaux Volatility [Loxx]</a> by <a href="https://www.tradingview.com/u/loxx/">loxx</a> on <a href="https://www.tradingview.com/">TradingView.com</a></p>
<!-- TradingView Chart END -->

Re: Already Converted TradingView Indicators to MT4 Indicators

Posted: Sat Sep 03, 2022 3:45 am
by Knight
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © loxx

//@version=5
indicator("JCFBaux Volatility [Loxx]", shorttitle = "JCFBV [Loxx]", timeframe="", timeframe_gaps=true, overlay = false)
greencolor = #2DD204

_a_jurik_filt(src, len, phase) =>
len1 = math.max(math.log(math.sqrt(0.5 * (len-1))) / math.log(2.0) + 2.0, 0)
pow1 = math.max(len1 - 2.0, 0.5)
volty = 7.0, avolty = 9.0, vsum = 8.0, bsmax = 5.0, bsmin = 6.0, avgLen = 65

del1 = src - nz(bsmax[1])
del2 = src - nz(bsmin[1])

div = 1.0 / (10.0 + 10.0 * (math.min(math.max(len-10, 0), 100)) / 100)
volty := math.abs(del1) > math.abs(del2) ? math.abs(del1) : math.abs(del2)
vsum := nz(vsum[1]) + div * (volty - nz(volty[10]))

temp_avg = ta.sma(vsum, avgLen)

y = bar_index + 1
if(y <= avgLen + 1)
avolty := nz(avolty[1]) + 2.0 * (vsum - nz(avolty[1])) / (avgLen + 1)
else
avolty := temp_avg

dVolty = avolty > 0 ? volty / avolty : 0
dVolty := dVolty > math.pow(len1, 1.0/pow1) ? math.pow(len1, 1.0/pow1) : dVolty
dVolty := dVolty < 1 ? 1 : dVolty
pow2 = math.pow(dVolty, pow1)
len2 = math.sqrt(0.5 * (len - 1)) * len1
Kv = math.pow(len2 / (len2 + 1), math.sqrt(pow2))
bsmax := del1 > 0 ? src : src - Kv * del1
bsmin := del2 < 0 ? src : src - Kv * del2
phaseRatio = phase < -100 ? 0.5 : phase > 100 ? 2.5 : phase / 100 + 1.5
beta = 0.45 * (len - 1) / (0.45 * (len - 1) + 2)
alpha = math.pow(beta, pow2)
jma1 = 0.0, e0 = 0.0, e1 = 0.0, e2 = 0.0
e0 := (1 - alpha) * src + alpha * nz(e0[1])
e1 := (src - e0) * (1 - beta) + beta * nz(e1[1])
e2 := (e0 + phaseRatio * e1 - nz(jma1[1])) * math.pow(1 - alpha, 2) + math.pow(alpha, 2) * nz(e2[1])
jma1 := e2 + nz(jma1[1])
jma1


src = input.source(close, "Source")
depth = input.int(15, "Depth")
depthphase = input.float(0, "Jurik Smoothing Phase")
lensmdd = input.int(300, "Smoothing Period")

_jcfbau(src, depth)=>
jrc04 = 0.0, jrc05 = 0.0, jrc06 = 0.0, jrc13 = 0.0, jrc03 = 0.0, jrc08 = 0.0
if (bar_index >= bar_index - depth * 2)
for k = depth - 1 to 0
jrc04 := jrc04 + math.abs(nz(src[k]) - nz(src[k+1]))
jrc05 := jrc05 + (depth + k) * math.abs(nz(src[k]) - nz(src[k+1]))
jrc06 := jrc06 + nz(src[k+1])
if(bar_index < bar_index - depth * 2)
jrc03 := math.abs(src - nz(src[1]))
jrc13 := math.abs(nz(src[depth]) - nz(src[depth+1]))
jrc04 := jrc04 - jrc13 + jrc03
jrc05 := jrc05 - jrc04 + jrc03 * depth
jrc06 := jrc06 - nz(src[depth+1]) + nz(src[1])
jrc08 := math.abs(depth * src - jrc06)
jcfbaux = jrc05 == 0.0 ? 0.0 : jrc08/jrc05
jcfbaux

jcfbaux = _jcfbau(src, depth)
signal = _a_jurik_filt(jcfbaux, lensmdd, depthphase)

plot(signal, color = color.white)
plot(jcfbaux, color = jcfbaux >= signal ? greencolor : color.gray, linewidth = 2)
barcolor(jcfbaux >= signal ? greencolor : color.gray)


















Re: Already Converted TradingView Indicators to MT4 Indicators

Posted: Sat Sep 03, 2022 3:48 am
by Knight
Knight wrote: Sat Sep 03, 2022 3:45 am

Code: Select all

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © loxx

//@version=5
indicator("JCFBaux Volatility [Loxx]", shorttitle = "JCFBV [Loxx]",  timeframe="", timeframe_gaps=true, overlay = false)
greencolor = #2DD204

_a_jurik_filt(src, len, phase) =>
    len1 = math.max(math.log(math.sqrt(0.5 * (len-1))) / math.log(2.0) + 2.0, 0)
    pow1 = math.max(len1 - 2.0, 0.5)
    volty = 7.0, avolty = 9.0, vsum = 8.0, bsmax = 5.0, bsmin = 6.0, avgLen = 65
    
    del1 = src - nz(bsmax[1])
    del2 = src - nz(bsmin[1])
    
    div = 1.0 / (10.0 + 10.0 * (math.min(math.max(len-10, 0), 100)) / 100)
    volty := math.abs(del1) > math.abs(del2) ? math.abs(del1) : math.abs(del2)
    vsum := nz(vsum[1]) + div * (volty - nz(volty[10]))
    
    temp_avg = ta.sma(vsum, avgLen)
    
    y = bar_index + 1
    if(y <= avgLen + 1)
        avolty := nz(avolty[1]) + 2.0 * (vsum - nz(avolty[1])) / (avgLen + 1)	   
    else
        avolty := temp_avg
        
    dVolty = avolty > 0 ? volty / avolty : 0
    dVolty := dVolty > math.pow(len1, 1.0/pow1) ? math.pow(len1, 1.0/pow1) : dVolty
    dVolty := dVolty < 1 ? 1 : dVolty
    pow2 = math.pow(dVolty, pow1)
    len2 = math.sqrt(0.5 * (len - 1)) * len1
    Kv = math.pow(len2 / (len2 + 1), math.sqrt(pow2))
    bsmax := del1 > 0 ? src : src - Kv * del1
    bsmin := del2 < 0 ? src : src - Kv * del2
    phaseRatio = phase < -100 ? 0.5 : phase > 100 ? 2.5 : phase / 100 + 1.5
    beta = 0.45 * (len - 1) / (0.45 * (len - 1) + 2)
    alpha = math.pow(beta, pow2)
    jma1 = 0.0, e0 = 0.0, e1 = 0.0, e2 = 0.0
    e0 := (1 - alpha) * src + alpha * nz(e0[1])
    e1 := (src - e0) * (1 - beta) + beta * nz(e1[1])
    e2 := (e0 + phaseRatio * e1 - nz(jma1[1])) * math.pow(1 - alpha, 2) + math.pow(alpha, 2) * nz(e2[1])
    jma1 := e2 + nz(jma1[1])
    jma1
    

src = input.source(close, "Source")
depth = input.int(15, "Depth")
depthphase = input.float(0, "Jurik Smoothing Phase")
lensmdd = input.int(300, "Smoothing Period")

_jcfbau(src, depth)=>
    jrc04 = 0.0, jrc05 = 0.0, jrc06 = 0.0, jrc13 = 0.0, jrc03 = 0.0, jrc08 = 0.0
    if (bar_index >= bar_index - depth * 2) 
        for k = depth - 1 to 0
            jrc04 := jrc04 + math.abs(nz(src[k]) - nz(src[k+1]))
            jrc05 := jrc05 + (depth + k) * math.abs(nz(src[k]) - nz(src[k+1]))
            jrc06 := jrc06 + nz(src[k+1])
    if(bar_index < bar_index - depth * 2)
        jrc03 := math.abs(src - nz(src[1]))
        jrc13 := math.abs(nz(src[depth]) - nz(src[depth+1]))
        jrc04 := jrc04 - jrc13 + jrc03
        jrc05 := jrc05 - jrc04 + jrc03 * depth
        jrc06 := jrc06 - nz(src[depth+1]) + nz(src[1])
    jrc08 := math.abs(depth * src - jrc06)
    jcfbaux = jrc05 == 0.0 ? 0.0 : jrc08/jrc05
    jcfbaux
    
jcfbaux = _jcfbau(src, depth)
signal = _a_jurik_filt(jcfbaux, lensmdd, depthphase)



plot(signal, color = color.white)
plot(jcfbaux, color = jcfbaux >= signal ? greencolor : color.gray, linewidth = 2)
barcolor(jcfbaux >= signal ? greencolor : color.gray)









JCFBaux is a volatility indicator that is used to detect early volatility spikes. To be used in conjunction with other momentum indicators for confluence. A Jurik-filtered signal line is included to provide a cutoff for when volatility is low. The JCFBaux is also used to calculate Jurik's "Composite Fractal Behavior". This is a directionless indicator. Many advanced traders will use JCFBaux as a drop in replacement for ADX DI.

What is Jurik Volty used in the Juirk Filter?
One of the lesser known qualities of Juirk smoothing is that the Jurik smoothing process is adaptive. "Jurik Volty" (a sort of market volatility ) is what makes Jurik smoothing adaptive. The Jurik Volty calculation can be used as both a standalone indicator and to smooth other indicators that you wish to make adaptive.

What is the Jurik Moving Average?
Have you noticed how moving averages add some lag (delay) to your signals? ... especially when price gaps up or down in a big move, and you are waiting for your moving average to catch up? Wait no more! JMA eliminates this problem forever and gives you the best of both worlds: low lag and smooth lines.

Ideally, you would like a filtered signal to be both smooth and lag-free. Lag causes delays in your trades, and increasing lag in your indicators typically result in lower profits. In other words, late comers get what's left on the table after the feast has already begun.




Code: Select all

<!-- TradingView Chart BEGIN -->
<script type="text/javascript" src="https://s3.tradingview.com/tv.js"></script>
<script type="text/javascript">
var tradingview_embed_options = {};
tradingview_embed_options.width = '640';
tradingview_embed_options.height = '400';
tradingview_embed_options.chart = 'fSTqdHYh';
new TradingView.chart(tradingview_embed_options);
</script>
<p><a href="https://www.tradingview.com/script/fSTqdHYh-JCFBaux-Volatility-Loxx/">JCFBaux Volatility [Loxx]</a> by <a href="https://www.tradingview.com/u/loxx/">loxx</a> on <a href="https://www.tradingview.com/">TradingView.com</a></p>
<!-- TradingView Chart END -->
Image

Re: Already Converted TradingView Indicators to MT4 Indicators

Posted: Sat Sep 03, 2022 3:50 am
by Knight
Sorry if it's a bit messy but that's the indicator and the source code from trading view. Apparently, you can't do all of that with a mobile phone.

Re: Already Converted TradingView Indicators to MT4 Indicators

Posted: Sat Sep 03, 2022 5:04 am
by RodrigoRT7
Knight wrote: Fri Sep 02, 2022 7:28 pm JCFBaux Volatility [Loxx] (close, 15, 0, 300)


Can this indicator be converted to mt4?


It's one of the best for filtering low volatility and choppy markets.
Here we go , bro :D

Code: Select all

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © loxx

//@version=5
indicator("JCFBaux Volatility [Loxx]", shorttitle = "JCFBV [Loxx]",  timeframe="", timeframe_gaps=true, overlay = false)
greencolor = #2DD204

_a_jurik_filt(src, len, phase) =>
    len1 = math.max(math.log(math.sqrt(0.5 * (len-1))) / math.log(2.0) + 2.0, 0)
    pow1 = math.max(len1 - 2.0, 0.5)
    volty = 7.0, avolty = 9.0, vsum = 8.0, bsmax = 5.0, bsmin = 6.0, avgLen = 65
    
    del1 = src - nz(bsmax[1])
    del2 = src - nz(bsmin[1])
    
    div = 1.0 / (10.0 + 10.0 * (math.min(math.max(len-10, 0), 100)) / 100)
    volty := math.abs(del1) > math.abs(del2) ? math.abs(del1) : math.abs(del2)
    vsum := nz(vsum[1]) + div * (volty - nz(volty[10]))
    
    temp_avg = ta.sma(vsum, avgLen)
    
    y = bar_index + 1
    if(y <= avgLen + 1)
        avolty := nz(avolty[1]) + 2.0 * (vsum - nz(avolty[1])) / (avgLen + 1)	   
    else
        avolty := temp_avg
        
    dVolty = avolty > 0 ? volty / avolty : 0
    dVolty := dVolty > math.pow(len1, 1.0/pow1) ? math.pow(len1, 1.0/pow1) : dVolty
    dVolty := dVolty < 1 ? 1 : dVolty
    pow2 = math.pow(dVolty, pow1)
    len2 = math.sqrt(0.5 * (len - 1)) * len1
    Kv = math.pow(len2 / (len2 + 1), math.sqrt(pow2))
    bsmax := del1 > 0 ? src : src - Kv * del1
    bsmin := del2 < 0 ? src : src - Kv * del2
    phaseRatio = phase < -100 ? 0.5 : phase > 100 ? 2.5 : phase / 100 + 1.5
    beta = 0.45 * (len - 1) / (0.45 * (len - 1) + 2)
    alpha = math.pow(beta, pow2)
    jma1 = 0.0, e0 = 0.0, e1 = 0.0, e2 = 0.0
    e0 := (1 - alpha) * src + alpha * nz(e0[1])
    e1 := (src - e0) * (1 - beta) + beta * nz(e1[1])
    e2 := (e0 + phaseRatio * e1 - nz(jma1[1])) * math.pow(1 - alpha, 2) + math.pow(alpha, 2) * nz(e2[1])
    jma1 := e2 + nz(jma1[1])
    jma1
    

src = input.source(close, "Source")
depth = input.int(15, "Depth")
depthphase = input.float(0, "Jurik Smoothing Phase")
lensmdd = input.int(300, "Smoothing Period")

_jcfbau(src, depth)=>
    jrc04 = 0.0, jrc05 = 0.0, jrc06 = 0.0, jrc13 = 0.0, jrc03 = 0.0, jrc08 = 0.0
    if (bar_index >= bar_index - depth * 2) 
        for k = depth - 1 to 0
            jrc04 := jrc04 + math.abs(nz(src[k]) - nz(src[k+1]))
            jrc05 := jrc05 + (depth + k) * math.abs(nz(src[k]) - nz(src[k+1]))
            jrc06 := jrc06 + nz(src[k+1])
    if(bar_index < bar_index - depth * 2)
        jrc03 := math.abs(src - nz(src[1]))
        jrc13 := math.abs(nz(src[depth]) - nz(src[depth+1]))
        jrc04 := jrc04 - jrc13 + jrc03
        jrc05 := jrc05 - jrc04 + jrc03 * depth
        jrc06 := jrc06 - nz(src[depth+1]) + nz(src[1])
    jrc08 := math.abs(depth * src - jrc06)
    jcfbaux = jrc05 == 0.0 ? 0.0 : jrc08/jrc05
    jcfbaux
    
jcfbaux = _jcfbau(src, depth)
signal = _a_jurik_filt(jcfbaux, lensmdd, depthphase)

plot(signal, color = color.white)
plot(jcfbaux, color = jcfbaux >= signal ? greencolor : color.gray, linewidth = 2)
barcolor(jcfbaux >= signal ? greencolor : color.gray)

Re: Already Converted TradingView Indicators to MT4 Indicators

Posted: Sat Sep 03, 2022 6:28 am
by mrtools
Knight wrote: Sat Sep 03, 2022 3:50 am Sorry if it's a bit messy but that's the indicator and the source code from trading view. Apparently, you can't do all of that with a mobile phone.
JCFBaux Volatility indicator

It's pretty much a cfb and a jurik cfb cross non-directional volatility type indicator, best I can understand when the cfb crosses the jurik cfb the pair is in a trend. Think this may be close to that version.

Re: Already Converted TradingView Indicators to MT4 Indicators

Posted: Wed Sep 07, 2022 7:45 pm
by Jedidiah
mrtools wrote: Sat Sep 03, 2022 6:28 am JCFBaux Volatility indicator

It's pretty much a cfb and a jurik cfb cross non-directional volatility type indicator, best I can understand when the cfb crosses the jurik cfb the pair is in a trend. Think this may be close to that version.
Image
;) Thanks for the generosity dear Mr Tools

Re: Already Converted TradingView Indicators to MT4 Indicators

Posted: Thu Sep 08, 2022 1:54 am
by loxx
mrtools wrote: Sat Sep 03, 2022 6:28 am JCFBaux Volatility indicator

It's pretty much a cfb and a jurik cfb cross non-directional volatility type indicator, best I can understand when the cfb crosses the jurik cfb the pair is in a trend. Think this may be close to that version.
Image
Loxx here, that's correct. This version of CFB and JCFBaux is because the normal version of CFB can't be coded in Pine Script due to Pine not allowing assignment of computed MAs or other formula inside loops, so I resorted to this different method. Anyway, enjoy!

Edit: In other words, the MT4 version is better for MT4, this version from Pine is much more complex than it needs to be for MT4. The CFB for MT4, the latest version, works just fine. No need to get too complicated. Pine is still evolving and until they allow assignment and reassignment of variables in complex formuals in loops, then we have to create workarounds.

And one more thing to add, this was built to create another volatility indicator, you can see how it matches up to optimized WAE. So this is just additional confluence for momentum/volatility, but since volatility is directionless this is volatility only.