Re: Already Converted TradingView Indicators to MT4 Indicators

121
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
These users thanked the author Knight for the post (total 2):
Chickenspicy, binosp2


Re: Already Converted TradingView Indicators to MT4 Indicators

123
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)
Attachments
These users thanked the author RodrigoRT7 for the post (total 2):
Chickenspicy, Knight

Re: Already Converted TradingView Indicators to MT4 Indicators

124
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.
These users thanked the author mrtools for the post (total 9):
Chickenspicy, Knight, RodrigoRT7, 太虚一毫, Jimmy, Jedidiah, 2banglak1993, alexm, Jackson Doh

Re: Already Converted TradingView Indicators to MT4 Indicators

125
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
Attachments
These users thanked the author Jedidiah for the post:
Chickenspicy
Be patient therefore, brethren, until the coming of the Lord. Behold, the husbandman waiteth for the precious fruit of the earth: patiently bearing till he receive the early and latter rain.
Behold, we account them blessed who have endured. You have heard of the patience of Job, and you have seen the end of the Lord, that the Lord is merciful and compassionate.


HappyRe: Already Converted TradingView Indicators to MT4 Indicators

126
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.
Attachments
These users thanked the author loxx for the post (total 7):
Jedidiah, Knight, viklam, RodrigoRT7, berserkyjc, ARKTOS_AUROCH, mrtools

Re: Already Converted TradingView Indicators to MT4 Indicators

127
The coders here are the absolute best. Mr. Tools, Jimmy, Mladen, Kvak, Banzai, man.. all you guys are amazing. My system is coming together bit by bit, and the work you guys do is timeless.

You guys are literally helping regular folks fight poverty and giving us a shot at the good life for free.

If anyone asks for humanitarians, I'm definitely pointing them to this forum.

From the bottom of my heart man, thank you Forex Station, you guys are literally the best forum in this industry, no cap.
These users thanked the author Knight for the post (total 4):
RodrigoRT7, Mickey Abi, Jedidiah, Basic58

Re: Already Converted TradingView Indicators to MT4 Indicators

129
chickensword wrote: Fri Sep 09, 2022 5:20 pm yo m8, do you think you could convert this step nema to trading view? i dont have the source code i think Mr Tools does
Image
what is it? link the ex4. if it's step nema, then cant be converted outright since Pinescript doenst calculation MAs of MAs of MAs, etc, etc, correctly. but i did post a Step Nema already days ago that extrapolates the for loops to produce the same result but its limited to 35 tuple not 50. its called STD-Stepped, Variety N-Tuple Moving Averages [Loxx]. there is a difference, however, i used standard deviation stepping in this one, the one you guys are using uses ATR stepping iirc.
These users thanked the author loxx for the post:
Chickenspicy

Re: Already Converted TradingView Indicators to MT4 Indicators

130
loxx wrote: Sat Sep 10, 2022 1:02 am what is it? link the ex4. if it's step nema, then cant be converted outright since Pinescript doenst calculation MAs of MAs of MAs, etc, etc, correctly. but i did post a Step Nema already days ago that extrapolates the for loops to produce the same result but its limited to 35 tuple not 50. its called STD-Stepped, Variety N-Tuple Moving Averages [Loxx]. there is a difference, however, i used standard deviation stepping in this one, the one you guys are using uses ATR stepping iirc.

yeah its nema
0 + 0 = 0
Infinite / Infinite = 1
1 way to Heaven & it matters


Who is online

Users browsing this forum: Antonov, Efegocmen, jjventural, Sogou [Bot], vvFish, Woodyz and 104 guests