Attachments forums

List of attachments posted on this forum.


All files on forums: 135572

Re: Supertrend indicators for MT4

mrtools, Sat Jun 18, 2022 7:14 am

PumbaPLS wrote: Sat Jun 18, 2022 12:15 am Superichi Indicator:

This indicator is a modification of the popular Ichimoku indicator using the equally popular Supertrend indicator as its core, thus no longer entirely relying on calculations done over a fixed window size but instead relying on the average true range and the trend detection method offered by the Supertrend.

If someone with his magical hands could convert it to MT4.. that would be very interesting!

Code: Select all

// This work is licensed under a Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0) https://creativecommons.org/licenses/by-nc-sa/4.0/
// © LuxAlgo

//@version=5
indicator("SuperIchi [LUX]",'SuperIchi [LUX]',overlay=true,max_lines_count=500)
tenkan_len  = input(9,'Tenkan          ',inline='tenkan')
tenkan_mult = input(2.,'',inline='tenkan')

kijun_len   = input(26,'Kijun             ',inline='kijun')
kijun_mult  = input(4.,'',inline='kijun')

spanB_len   = input(52,'Senkou Span B ',inline='span')
spanB_mult  = input(6.,'',inline='span')

offset      = input(26,'Displacement')
//------------------------------------------------------------------------------
avg(src,length,mult)=>
    atr = ta.atr(length)*mult
    up = hl2 + atr
    dn = hl2 - atr
    upper = 0.,lower = 0.
    upper := src[1] < upper[1] ? math.min(up,upper[1]) : up
    lower := src[1] > lower[1] ? math.max(dn,lower[1]) : dn
    
    os = 0,max = 0.,min = 0.
    os := src > upper ? 1 : src < lower ? 0 : os[1]
    spt = os == 1 ? lower : upper
    max := ta.cross(src,spt) ? math.max(src,max[1]) : os == 1 ? math.max(src,max[1]) : spt
    min := ta.cross(src,spt) ? math.min(src,min[1]) : os == 0 ? math.min(src,min[1]) : spt
    math.avg(max,min)
//------------------------------------------------------------------------------
tenkan = avg(close,tenkan_len,tenkan_mult)
kijun = avg(close,kijun_len,kijun_mult)

senkouA = math.avg(kijun,tenkan)
senkouB = avg(close,spanB_len,spanB_mult)
//------------------------------------------------------------------------------
tenkan_css = #2157f3
kijun_css = #ff5d00

cloud_a = color.new(color.teal,80)
cloud_b = color.new(color.red,80)

chikou_css = #7b1fa2

plot(tenkan,'Tenkan-Sen',tenkan_css)
plot(kijun,'Kijun-Sen',kijun_css)

plot(ta.crossover(tenkan,kijun) ? kijun : na,'Crossover',#2157f3,3,plot.style_circles)
plot(ta.crossunder(tenkan,kijun) ? kijun : na,'Crossunder',#ff5d00,3,plot.style_circles)

A = plot(senkouA,'Senkou Span A',na,offset=offset-1)
B = plot(senkouB,'Senkou Span B',na,offset=offset-1)
fill(A,B,senkouA > senkouB ? cloud_a : cloud_b)

plot(close,'Chikou',chikou_css,offset=-offset+1,display=display.none)
Image
Superichi indicator for MT4

Thanks for the idea, think this version is kinda close to the tradeview one, except you can use standard deviation too, but to me atr is way better for this.

PS: For the template used in our Daily Downloads post, please see here: Superichi MT4 template.
All files in topic