Re: Already Converted TradingView Indicators to MT4 Indicators

101
guys I've got a request.
I found some Trading VIew indicator that looks good.
I extracted variables that were fixed and made them modifiable, and made a strategy (with backtest)
there are a lot of variables now.

If you find a setting that works, please post it here and i'll make a MT4 version
or even better if someone has that automatic optimizer that finds the best settings automatically that would be awesome

thanks

Jeff

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/
// © // 19muratdinc82@gmail.com

strategy(title = "swing trade d", shorttitle="swing trade D", overlay=true,initial_capital = 1000, default_qty_value = 100, default_qty_type = strategy.percent_of_equity)

//@version=5
//indicator("Swing Trade [D]",overlay=true)

lr1=input(3,"linreg 1 Lenght")
lr2=input(13,"linreg 1 Lenght")
lrMA1=input(2,"linreg MA 1 Lenght")
lrMA2=input(2,"linreg MA 1 Lenght")
MA3=input(2,"linreg MA 1 Lenght")
rsi1a=input(14,"RSI1")
sto1=input(14,"Stoch1")
stoMA1=input(3,"Stoch MA 1")
EMA1=input(3,"EMA 1")
EMA2=input(26,"EMA 2")
EMA3=input(26,"EMA 3")
EMA4=input(12,"EMA 4")
EMA5=input(12,"EMA 5")
EMA6=input(12,"EMA 6")
EMA7=input(12,"EMA 7")
CCI1=input(20,"CCI1 length")
CCI1thr=input(50,"CCI1 threshold")

rsi2a=input(7,"RSI2a")
rsi2b=input(14,"RSI2b")

rsi3a=input(6,"RSI3a")
rsiThr3a=input(6,"RSI Threshold 3a")

a=ta.ema(ta.linreg(close,lr1,0),lrMA1)
b=ta.ema(ta.linreg(close,lr2,0),lrMA2)
c=ta.ema(a-b,MA3)
rsi1 = ta.rsi(close, rsi1a)
vk = ta.ema(ta.stoch(rsi1, rsi1, rsi1, sto1), stoMA1)
vd = ta.ema(vk, EMA1)
m1 = ta.ema(close,EMA2)
m2 = ta.ema(m1,EMA3)
m3 = ((2 * m1) - m2 )
m4 = ta.ema(close,EMA4)
m5 = ta.ema(m4,EMA4)
m6 = ((2 * m4) - m5)
m8 = (m6 - m3)
m7 = ta.ema(m8, EMA6)
m9 = ta.ema(m7, EMA7)
m10 = ((2 * m7) - m9)
m11 = (m8 - m10)
deml=ta.crossover(m11,0)
dems=ta.crossunder(m11,0)
ml=ta.crossover(vk,vd)
ms=ta.crossunder(vk,vd)
pl=ta.crossover(c,0) 
ps=ta.crossunder(c,0)
longso=(ml and pl and deml) and ta.cci(close,CCI1)>=-CCI1thr
shortso=(ms and ps and dems) and ta.cci(close,CCI1)<=CCI1thr
long11=((longso or (ml[1] and pl and deml) or (ml and pl[1] and deml) or (ml and pl and deml[1]))) and ta.rsi(close,rsi2a)>ta.rsi(close,rsi2b) 
short11=((shortso or (ms[1] and ps and dems) or (ms and ps[1] and dems) or (ms and ps and dems[1]))) and ta.rsi(close,rsi2a)<ta.rsi(close,rsi2b)


kf = 0.0
kf := nz(kf[1]) +  math.pow(((math.sum(math.abs(close - close[1]), 5) != 0 ? math.abs(close - close[5]) / math.sum(math.abs(close - close[1]), 5): 0)) * (0.6015) + 0.0645, 2)  * (close - nz(kf[1]))
kfh = 0.0
kfh := nz(kfh[1]) +  math.pow(((math.sum(math.abs(high - high[1]), 5) != 0 ? math.abs(high - high[5]) / math.sum(math.abs(high - high[1]), 5): 0)) * (0.6015) + 0.0645, 2)  * (high - nz(kfh[1]))
kfl = 0.0
kfl := nz(kfl[1]) +  math.pow(((math.sum(math.abs(low - low[1]), 5) != 0 ? math.abs(low - low[5]) / math.sum(math.abs(low - low[1]), 5): 0)) * (0.6015) + 0.0645, 2)  * (low - nz(kfl[1]))



rsist=input(3,"Rsi Lenght")
rsil1st=input(5,"Rsi Lower Band 1 ")
rsil2st=input(10,"Rsi Lower Band 2")
rsil3st=input(15,"Rsi Lower Band 3")

rsio1st=input(85,"Rsi Over Band 1")
rsio2st=input(90,"Rsi Over Band 2")
rsio3st=input(95,"Rsi Over Band 3")

rsilongv1st=ta.crossover(ta.rsi(low , rsist),rsil1st)
rsilongv2st= ta.crossover(ta.rsi(low , rsist),rsil2st)
rsilongv3st= ta.crossover(ta.rsi(low , rsist),rsil3st)
rsishortv1st=ta.crossunder(ta.rsi(high , rsist),rsio1st)
rsishortv2st=ta.crossunder(ta.rsi(high , rsist),rsio2st)
rsishortv3st=ta.crossunder(ta.rsi(high , rsist),rsio3st)

rsilongst=( ta.crossover(ta.rsi(close,rsi3a),rsiThr3a) or rsilongv1st or rsilongv1st[1]  or rsilongv2st or rsilongv2st[1]  or rsilongv3st or rsilongv3st[1] ) and (close > open[1] and close[1] < open[1])
rsishortst=(rsishortv1st or rsishortv1st[1] or rsishortv2st or rsishortv2st[1] or rsishortv3st or rsishortv3st[1] ) and ( close < open[1] and close[1] > open[1])







acl=(3*math.sum(ta.highest(high,21),3)/3+kfh)/4
bcl=(3*math.sum(ta.lowest(low,21),3)/3+kfl)/4
abcl=(acl+bcl+8*kf)/10
plot(abcl,color=abcl>abcl[1]?color.green:color.red,linewidth=2)
xcl=plot(acl,color=color.red,transp=100)
ycl=plot(bcl,color=color.green,transp=100)
zcl=plot((2*acl+bcl)/3,color=color.gray,transp=100)
tcl=plot((acl+2*bcl)/3,color=color.gray,transp=100)
z1cl=plot((4*acl+bcl)/5,color=color.gray,transp=100)
t1cl=plot((acl+4*bcl)/5,color=color.gray,transp=100)
fill(xcl,zcl,color=#FF00CC,transp=95)
fill(ycl,tcl,color=#00FFCC,transp=95)
fill(zcl,tcl,color=#669999,transp=100)
fill(xcl,z1cl,color=#FF0033,transp=90)
fill(ycl,t1cl,color=#00FF00,transp=90)

plotshape(rsilongst or long11,  title = "BUY",  text = 'B',  style = shape.labelup,   location = location.belowbar, color= color.green, textcolor = color.white,  size = size.tiny)
plotshape(rsishortst or short11, title = "SELL", text = 'S', style = shape.labeldown, location = location.abovebar, color= color.red,   textcolor = color.white, size = size.tiny)

strategy.entry("long",strategy.long, when = rsilongst or long11)

//strategy.exit("exit","long",when = SHORT)

strategy.entry("short",strategy.short, when = rsishortst or short11)

//strategy.exit("exit","short",LONG) 

These users thanked the author ionone for the post:
Bbq Ribs


Re: Already Converted TradingView Indicators to MT4 Indicators

102
ionone wrote: Tue Jul 19, 2022 9:20 pm guys I've got a request.
I found some Trading VIew indicator that looks good.
I extracted variables that were fixed and made them modifiable, and made a strategy (with backtest)
there are a lot of variables now.

If you find a setting that works, please post it here and i'll make a MT4 version
or even better if someone has that automatic optimizer that finds the best settings automatically that would be awesome

thanks

Jeff

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/
// © // 19muratdinc82@gmail.com

strategy(title = "swing trade d", shorttitle="swing trade D", overlay=true,initial_capital = 1000, default_qty_value = 100, default_qty_type = strategy.percent_of_equity)

//@version=5
//indicator("Swing Trade [D]",overlay=true)

lr1=input(3,"linreg 1 Lenght")
lr2=input(13,"linreg 1 Lenght")
lrMA1=input(2,"linreg MA 1 Lenght")
lrMA2=input(2,"linreg MA 1 Lenght")
MA3=input(2,"linreg MA 1 Lenght")
rsi1a=input(14,"RSI1")
sto1=input(14,"Stoch1")
stoMA1=input(3,"Stoch MA 1")
EMA1=input(3,"EMA 1")
EMA2=input(26,"EMA 2")
EMA3=input(26,"EMA 3")
EMA4=input(12,"EMA 4")
EMA5=input(12,"EMA 5")
EMA6=input(12,"EMA 6")
EMA7=input(12,"EMA 7")
CCI1=input(20,"CCI1 length")
CCI1thr=input(50,"CCI1 threshold")

rsi2a=input(7,"RSI2a")
rsi2b=input(14,"RSI2b")

rsi3a=input(6,"RSI3a")
rsiThr3a=input(6,"RSI Threshold 3a")

a=ta.ema(ta.linreg(close,lr1,0),lrMA1)
b=ta.ema(ta.linreg(close,lr2,0),lrMA2)
c=ta.ema(a-b,MA3)
rsi1 = ta.rsi(close, rsi1a)
vk = ta.ema(ta.stoch(rsi1, rsi1, rsi1, sto1), stoMA1)
vd = ta.ema(vk, EMA1)
m1 = ta.ema(close,EMA2)
m2 = ta.ema(m1,EMA3)
m3 = ((2 * m1) - m2 )
m4 = ta.ema(close,EMA4)
m5 = ta.ema(m4,EMA4)
m6 = ((2 * m4) - m5)
m8 = (m6 - m3)
m7 = ta.ema(m8, EMA6)
m9 = ta.ema(m7, EMA7)
m10 = ((2 * m7) - m9)
m11 = (m8 - m10)
deml=ta.crossover(m11,0)
dems=ta.crossunder(m11,0)
ml=ta.crossover(vk,vd)
ms=ta.crossunder(vk,vd)
pl=ta.crossover(c,0) 
ps=ta.crossunder(c,0)
longso=(ml and pl and deml) and ta.cci(close,CCI1)>=-CCI1thr
shortso=(ms and ps and dems) and ta.cci(close,CCI1)<=CCI1thr
long11=((longso or (ml[1] and pl and deml) or (ml and pl[1] and deml) or (ml and pl and deml[1]))) and ta.rsi(close,rsi2a)>ta.rsi(close,rsi2b) 
short11=((shortso or (ms[1] and ps and dems) or (ms and ps[1] and dems) or (ms and ps and dems[1]))) and ta.rsi(close,rsi2a)<ta.rsi(close,rsi2b)


kf = 0.0
kf := nz(kf[1]) +  math.pow(((math.sum(math.abs(close - close[1]), 5) != 0 ? math.abs(close - close[5]) / math.sum(math.abs(close - close[1]), 5): 0)) * (0.6015) + 0.0645, 2)  * (close - nz(kf[1]))
kfh = 0.0
kfh := nz(kfh[1]) +  math.pow(((math.sum(math.abs(high - high[1]), 5) != 0 ? math.abs(high - high[5]) / math.sum(math.abs(high - high[1]), 5): 0)) * (0.6015) + 0.0645, 2)  * (high - nz(kfh[1]))
kfl = 0.0
kfl := nz(kfl[1]) +  math.pow(((math.sum(math.abs(low - low[1]), 5) != 0 ? math.abs(low - low[5]) / math.sum(math.abs(low - low[1]), 5): 0)) * (0.6015) + 0.0645, 2)  * (low - nz(kfl[1]))



rsist=input(3,"Rsi Lenght")
rsil1st=input(5,"Rsi Lower Band 1 ")
rsil2st=input(10,"Rsi Lower Band 2")
rsil3st=input(15,"Rsi Lower Band 3")

rsio1st=input(85,"Rsi Over Band 1")
rsio2st=input(90,"Rsi Over Band 2")
rsio3st=input(95,"Rsi Over Band 3")

rsilongv1st=ta.crossover(ta.rsi(low , rsist),rsil1st)
rsilongv2st= ta.crossover(ta.rsi(low , rsist),rsil2st)
rsilongv3st= ta.crossover(ta.rsi(low , rsist),rsil3st)
rsishortv1st=ta.crossunder(ta.rsi(high , rsist),rsio1st)
rsishortv2st=ta.crossunder(ta.rsi(high , rsist),rsio2st)
rsishortv3st=ta.crossunder(ta.rsi(high , rsist),rsio3st)

rsilongst=( ta.crossover(ta.rsi(close,rsi3a),rsiThr3a) or rsilongv1st or rsilongv1st[1]  or rsilongv2st or rsilongv2st[1]  or rsilongv3st or rsilongv3st[1] ) and (close > open[1] and close[1] < open[1])
rsishortst=(rsishortv1st or rsishortv1st[1] or rsishortv2st or rsishortv2st[1] or rsishortv3st or rsishortv3st[1] ) and ( close < open[1] and close[1] > open[1])







acl=(3*math.sum(ta.highest(high,21),3)/3+kfh)/4
bcl=(3*math.sum(ta.lowest(low,21),3)/3+kfl)/4
abcl=(acl+bcl+8*kf)/10
plot(abcl,color=abcl>abcl[1]?color.green:color.red,linewidth=2)
xcl=plot(acl,color=color.red,transp=100)
ycl=plot(bcl,color=color.green,transp=100)
zcl=plot((2*acl+bcl)/3,color=color.gray,transp=100)
tcl=plot((acl+2*bcl)/3,color=color.gray,transp=100)
z1cl=plot((4*acl+bcl)/5,color=color.gray,transp=100)
t1cl=plot((acl+4*bcl)/5,color=color.gray,transp=100)
fill(xcl,zcl,color=#FF00CC,transp=95)
fill(ycl,tcl,color=#00FFCC,transp=95)
fill(zcl,tcl,color=#669999,transp=100)
fill(xcl,z1cl,color=#FF0033,transp=90)
fill(ycl,t1cl,color=#00FF00,transp=90)

plotshape(rsilongst or long11,  title = "BUY",  text = 'B',  style = shape.labelup,   location = location.belowbar, color= color.green, textcolor = color.white,  size = size.tiny)
plotshape(rsishortst or short11, title = "SELL", text = 'S', style = shape.labeldown, location = location.abovebar, color= color.red,   textcolor = color.white, size = size.tiny)

strategy.entry("long",strategy.long, when = rsilongst or long11)

//strategy.exit("exit","long",when = SHORT)

strategy.entry("short",strategy.short, when = rsishortst or short11)

//strategy.exit("exit","short",LONG) 

Image
Those settings work decently on the 4Hour and Daily TF, I dont think its overall good enough to work as a standalone... has potential though.
Tested on 28Forex Pairs.
Attachments
These users thanked the author PumbaPLS for the post (total 3):
ionone, Jedidiah, Chickenspicy
You cannot solve a problem from the same consciousness that created it. You must learn to see the world anew

Re: Already Converted TradingView Indicators to MT4 Indicators

105
Does anyone know of an indicator similar to this?

Code: Select all

//@version=4
study(title="Average True Range Stop Loss Finder", shorttitle="ATR", overlay=true)
length = input(title="Length", defval=14, minval=1)
smoothing = input(title="Smoothing", defval="RMA", options=["RMA", "SMA", "EMA", "WMA"])
m = input(1.5, "Multiplier")
src1 = input(high)
src2 = input(low)
pline = input(true, "Show Price Lines")
col1 = input(color.blue, "ATR Text Color")
col2 = input(color.teal, "Low Text Color",inline ="1")
col3 = input(color.red, "High Text Color",inline ="2")

collong = input(color.teal, "Low Line Color",inline ="1")
colshort = input(color.red, "High Line Color",inline ="2")

ma_function(source, length) =>
	if smoothing == "RMA"
		rma(source, length)
	else
		if smoothing == "SMA"
			sma(source, length)
		else
			if smoothing == "EMA"
				ema(source, length)
			else
				wma(source, length)
				
a = ma_function(tr(true), length) * m
x = ma_function(tr(true), length) * m + src1
x2 = src2 - ma_function(tr(true), length) * m

p1 = plot(x, title = "ATR Short Stop Loss", color= colshort, transp=20, trackprice = pline ? true : false)
p2 = plot(x2, title = "ATR Long Stop Loss", color= collong, transp=20, trackprice = pline ? true : false)

var table Table = table.new(position.bottom_center, 3, 1, border_width = 3)    

f_fillCell(_table, _column, _row, _value, _timeframe) =>

	_cellText = _timeframe+ tostring(_value, "#.#")
    table.cell(_table, _column, _row, _cellText, text_color = col1)
    table.cell_set_text_color(Table, 1, 0, color.new(col3, transp = 0))
    table.cell_set_text_color(Table, 2, 0, color.new(col2, transp = 0))
    
if barstate.islast
    f_fillCell(Table, 0, 0, a, "ATR: " )
    f_fillCell(Table, 1, 0, x, "H: " )
    f_fillCell(Table, 2, 0, x2, "L: " )   
These users thanked the author opita for the post:
Marktaylor58
Cheers,

Opita


Re: Already Converted TradingView Indicators to MT4 Indicators

106
oskar656 wrote: Thu Jun 30, 2022 11:58 am Hi,

Could this indicator be converted to MT4?

Thank you.

https://www.tradingview.com/script/KGYE ... me-Signal/

Image

Code: Select all

//@version=4
study(shorttitle="BBSR Extreme", title="Bollinger Bands Stochastic RSI Extreme Signal", overlay=true, resolution="")

//General Inputs
src = input(close, title="Source")
offset = input(0, "Offset", type = input.integer, minval = -500, maxval = 500)

//Bollinger Inputs
length = input(20, title="Bollinger Band Length", minval=1)
mult = input(2.0, minval=0.001, maxval=50, title="StdDev")

//Bollinger Code
basis = sma(src, length)
dev = mult * stdev(src, length)
upper = basis + dev
lower = basis - dev
plot(basis, "BB Basis", color=#872323, offset = offset)
p1 = plot(upper, "BB Upper", color=color.teal, offset = offset)
p2 = plot(lower, "BB Lower", color=color.teal, offset = offset)
fill(p1, p2, title = "BB Background", color=#198787, transp=95)


//Stoch Inputs
smoothK = input(3, "K", minval=1)
smoothD = input(3, "D", minval=1)
lengthRSI = input(14, "RSI Length", minval=1)
lengthStoch = input(14, "Stochastic Length", minval=1)

upperlimit = input(90, "Upper Limit", minval=0.01)
lowerlimit = input(10, "Upper Limit", minval=0.01)

//Stochastic Code
rsi1 = rsi(src, lengthRSI)
k = sma(stoch(rsi1, rsi1, rsi1, lengthStoch), smoothK)
d = sma(k, smoothD)

//Evaluation
Bear = close[1] > upper[1] and close < upper
     and k[1] > upperlimit and d[1] > upperlimit
Bull = close[1] < lower[1] and close > lower
     and k[1] < lowerlimit and d[1] < lowerlimit


//Plots
plotshape(Bear, style=shape.triangledown, location=location.abovebar, 
     color=color.red, size=size.tiny)
plotshape(Bull, style=shape.triangleup, location=location.belowbar, 
     color=color.green, size=size.tiny)
 
// Alert Functionality
alertcondition(Bear or Bull, title="Any Signal", message="{{exchange}}:{{ticker}}" + " {{interval}}" + " BB Stochastic Extreme!")
alertcondition(Bear, title="Bearish Signal", message="{{exchange}}:{{ticker}}" + " {{interval}}" + " Bearish BB Stochastic Extreme!")
alertcondition(Bull, title="Bullish Signal", message="{{exchange}}:{{ticker}}" + " {{interval}}" + " Bullish BB Stochastic Extreme!")
Hi guys,

Could you please check this out?

Thank you.

Re: Already Converted TradingView Indicators to MT4 Indicators

108
wojtek wrote: Sat Jul 23, 2022 9:08 pm This has not been converted yet, I guess:

https://www.tradingview.com/script/aMag ... Step-LSMA/

Looks interesting, doesn't it?

Hi,

This may help.

Trend step lsma 1.2 - made by Darks sir based on tradingview - alexgrover
T-Step LSMA 03 BT


Thanks.
These users thanked the author thomdel for the post (total 2):
wojtek, RodrigoRT7

Re: Already Converted TradingView Indicators to MT4 Indicators

109
Good evening guys, how are you? sorry to insist so much on converting this indicator, but it's because I imagine it can assemble a good combination with some mt4 specifics within a renko matrix. In addition, I found a second indicator that seems to have a good synergy in keeping the trade within a continuity, that is, not to leave early. I'm sharing custom settings for everyone on the forum to review :D

Thank you very much in advance.

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("Three-Pole Super Smoother w/ EMA-Deviation-Corrected Stepping [Loxx]", 
     shorttitle = "TPSSEMADCS [Loxx]", 
     overlay = true, 
     timeframe="", 
     timeframe_gaps = true)
     
import loxx/loxxexpandedsourcetypes/3

greencolor = #2DD204
redcolor = #D2042D 

_ssf3(src, length) =>
    arg = math.pi / length
    a1 = math.exp(-arg)
    b1 = 2 * a1 * math.cos(1.738 * arg)
    c1 = math.pow(a1, 2)
    coef4 = math.pow(c1, 2)
    coef3 = -(c1 + b1 * c1)
    coef2 = b1 + c1
    coef1 = 1 - coef2 - coef3 - coef4
    src1 = nz(src[1], src)
    src2 = nz(src[2], src1)
    src3 = nz(src[3], src2)
    ssf = 0.0
    ssf := coef1 * src + coef2 * nz(ssf[1], src1) + coef3 * nz(ssf[2], src2) + coef4 * nz(ssf[3], src3)
    ssf
    
_corEmaDev(avg, price, period)=>
    ema0 = 0., ema1 = 0., corr = 0.
    alpha = 2.0 / (1.0 + period)
    ema0 := ta.ema(price, period)
    ema1 := ta.ema(price*price, period)
    _deviation = math.max(math.sqrt(period * (ema1 - ema0 * ema0) / math.max(period - 1, 1)), 0.0)
    v1 = math.pow(_deviation, 2)
    v2 = math.pow(nz(corr[1]) - avg, 2) 
    c = (v2 < v1 or v2 == 0) ? 0 : 1 - v1 / v2
    corr := nz(corr[1]) + c * (avg - nz(corr[1]))
    corr

smthtype = input.string("Kaufman", "Heiken-Ashi Better Smoothing", options = ["AMA", "T3", "Kaufman"], group=  "Source Settings")

srcoption = input.string("Close", "Source", group= "Source Settings", 
     options = 
     ["Close", "Open", "High", "Low", "Median", "Typical", "Weighted", "Average", "Average Median Body", "Trend Biased", "Trend Biased (Extreme)", 
     "HA Close", "HA Open", "HA High", "HA Low", "HA Median", "HA Typical", "HA Weighted", "HA Average", "HA Average Median Body", "HA Trend Biased", "HA Trend Biased (Extreme)",
     "HAB Close", "HAB Open", "HAB High", "HAB Low", "HAB Median", "HAB Typical", "HAB Weighted", "HAB Average", "HAB Average Median Body", "HAB Trend Biased", "HAB Trend Biased (Extreme)"])

per = input.int(14, "Period", group= "Basic Settings")
colorbars = input.bool(false, "Color bars?", group= "UI Options")

kfl=input.float(0.666, title="* Kaufman's Adaptive MA (KAMA) Only - Fast End", group = "Moving Average Inputs")
ksl=input.float(0.0645, title="* Kaufman's Adaptive MA (KAMA) Only - Slow End", group = "Moving Average Inputs")
amafl = input.int(2, title="* Adaptive Moving Average (AMA) Only - Fast", group = "Moving Average Inputs")
amasl = input.int(30, title="* Adaptive Moving Average (AMA) Only - Slow", group = "Moving Average Inputs")

haclose = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, close)
haopen = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, open)
hahigh = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, high)
halow = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, low)
hamedian = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, hl2)
hatypical = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, hlc3)
haweighted = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, hlcc4)
haaverage = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, ohlc4)


float src = switch srcoption
	"Close" => loxxexpandedsourcetypes.rclose()
	"Open" => loxxexpandedsourcetypes.ropen()
	"High" => loxxexpandedsourcetypes.rhigh()
	"Low" => loxxexpandedsourcetypes.rlow()
	"Median" => loxxexpandedsourcetypes.rmedian()
	"Typical" => loxxexpandedsourcetypes.rtypical()
	"Weighted" => loxxexpandedsourcetypes.rweighted()
	"Average" => loxxexpandedsourcetypes.raverage()
    "Average Median Body" => loxxexpandedsourcetypes.ravemedbody()
	"Trend Biased" => loxxexpandedsourcetypes.rtrendb()
	"Trend Biased (Extreme)" => loxxexpandedsourcetypes.rtrendbext()
	"HA Close" => loxxexpandedsourcetypes.haclose(haclose)
	"HA Open" => loxxexpandedsourcetypes.haopen(haopen)
	"HA High" => loxxexpandedsourcetypes.hahigh(hahigh)
	"HA Low" => loxxexpandedsourcetypes.halow(halow)
	"HA Median" => loxxexpandedsourcetypes.hamedian(hamedian)
	"HA Typical" => loxxexpandedsourcetypes.hatypical(hatypical)
	"HA Weighted" => loxxexpandedsourcetypes.haweighted(haweighted)
	"HA Average" => loxxexpandedsourcetypes.haaverage(haaverage)
    "HA Average Median Body" => loxxexpandedsourcetypes.haavemedbody(haclose, haopen)
	"HA Trend Biased" => loxxexpandedsourcetypes.hatrendb(haclose, haopen, hahigh, halow)
	"HA Trend Biased (Extreme)" => loxxexpandedsourcetypes.hatrendbext(haclose, haopen, hahigh, halow)
	"HAB Close" => loxxexpandedsourcetypes.habclose(smthtype, amafl, amasl, kfl, ksl)
	"HAB Open" => loxxexpandedsourcetypes.habopen(smthtype, amafl, amasl, kfl, ksl)
	"HAB High" => loxxexpandedsourcetypes.habhigh(smthtype, amafl, amasl, kfl, ksl)
	"HAB Low" => loxxexpandedsourcetypes.hablow(smthtype, amafl, amasl, kfl, ksl)
	"HAB Median" => loxxexpandedsourcetypes.habmedian(smthtype, amafl, amasl, kfl, ksl)
	"HAB Typical" => loxxexpandedsourcetypes.habtypical(smthtype, amafl, amasl, kfl, ksl)
	"HAB Weighted" => loxxexpandedsourcetypes.habweighted(smthtype, amafl, amasl, kfl, ksl)
	"HAB Average" => loxxexpandedsourcetypes.habaverage(smthtype, amafl, amasl, kfl, ksl)
    "HAB Average Median Body" => loxxexpandedsourcetypes.habavemedbody(smthtype, amafl, amasl, kfl, ksl)
	"HAB Trend Biased" => loxxexpandedsourcetypes.habtrendb(smthtype, amafl, amasl, kfl, ksl)
	"HAB Trend Biased (Extreme)" => loxxexpandedsourcetypes.habtrendbext(smthtype, amafl, amasl, kfl, ksl)
	=> haclose

avg2 = _ssf3(src, per)
val = _corEmaDev(avg2, src, per)

goLong_pre = ta.crossover(val, val[1])
goShort_pre = ta.crossunder(val, val[1])

contSwitch = 0
contSwitch := nz(contSwitch[1])
contSwitch := goLong_pre ? 1 : goShort_pre ? -1 : contSwitch

goLong = goLong_pre and ta.change(contSwitch)
goShort = goShort_pre and ta.change(contSwitch)

plot(val,"Corrected super smoother", color = contSwitch == 1  ? greencolor : redcolor, linewidth = 3)

barcolor(colorbars ? contSwitch == 1 ? greencolor : redcolor : na)

Code: Select all

//@version=4
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © RedKTrader

study("Comp_Ratio_MA", shorttitle = "CoRa Wave", overlay = true, resolution ="")

// ======================================================================    
// Compound Ratio Weight MA function
// Compound Ratio Weight is where the weight increases in a "logarithmicly linear" way (i.e., linear when plotted on a log chart) - similar to compound ratio
// the "step ratio" between weights is consistent - that's not the case with linear-weight moving average (WMA), or EMA 
// another advantage is we can significantly reduce the "tail weight" - which is "relatively" large in other MAs and contributes to lag
//
// Compound Weight ratio     r = (A/P)^1/t - 1
// Weight at time t         A = P(1 + r)^t 
//                            = Start_val * (1 + r) ^ index
// Note: index is 0 at the furthest point back -- num periods = length -1
//
f_adj_crwma(source, length, Start_Wt, r_multi) =>
    numerator = 0.0, denom = 0.0, c_weight = 0.0
    //Start_Wt = 1.0    // Start Wight is an input in this version - can also be set to a basic value here.
    End_Wt = length     // use length as initial End Weight to calculate base "r"
    r = pow((End_Wt / Start_Wt),(1 / (length - 1))) - 1
    base = 1 + r * r_multi
    for i = 0 to length -1
        c_weight    := Start_Wt * pow(base,(length - i))
        numerator   := numerator + source[i] * c_weight 
        denom       := denom + c_weight
    numerator / denom    
// ====================================================================== ==   

data        = input(title = "Source",                 type = input.source,      defval = hlc3)
length      = input(title = "length",                 type = input.integer,     defval = 20,  minval = 1)
r_multi     = input(title = "Comp Ratio Multiplier",  type = input.float,       defval = 2.0, minval = 0, step = .1)
smooth      = input(title = "Auto Smoothing",         type = input.bool,        defval = true,                    group = "Smoothing")
man_smooth  = input(title = "Manual Smoothing",       type = input.integer,     defval = 1, minval = 1, step = 1, group = "Smoothing")

s           = smooth ? max(round(sqrt(length)),1) : man_smooth
cora_raw    = f_adj_crwma(data, length, 0.01, r_multi)    
cora_wave   = wma(cora_raw, s)

c_up        = color.new(color.aqua, 0)
c_dn        = color.new(#FF9800   , 0)
cora_up     = cora_wave > cora_wave[1]
plot(cora_wave, title="Adjustible CoRa_Wave", color = cora_up ? c_up : c_dn, linewidth = 3)
Attachments

Re: Already Converted TradingView Indicators to MT4 Indicators

110
these arrows look good. (the best i've seen in a while) I made the code so it becomes a strategy (just copy the code into TV pine code panel and save it and add it to chart)

If you guys find a good set file then I'll convert it to MT4

thanks

Jeff

Code: Select all

//@version=5
//
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © apaulcalypse


//indicator('BBWP Boom & Doom', 'Boom & Doom', overlay=true, precision=2, max_bars_back = 1000)
//@version=5
strategy("boom doom Strategy", overlay = true, default_qty_value = 100, default_qty_type = strategy.percent_of_equity, initial_capital = 1000000)



///////////////////////////////////////////////////////////////////////////////
// BBWP formula by The_Caretaker


///////////////////////////////////////////////////////////////////////////////
// inputs

volume_ma_input = input.int(14, title="Volume Moving Average", group="Boom & Doom Settings")
bbwp_minimum = input.float(20, title="BBWP Crossunder Point", step=0.1, group="Boom & Doom Settings")
bbwp_middle = input.float(50, title="BBWP Reset Point", step=0.1, group="Boom & Doom Settings")
emafilter = input.bool(false, title="Filter over/under EMA", group="Boom & Doom Settings")
emalength = input.int(200, title="EMA Length", group="Boom & Doom Settings")

// BBWP formula is by The_Caretaker
// BBWP Inputs
i_priceSrc      = input.source  ( close,    'Price Source',                                                                         group='BBWP Properties')
i_basisType     = input.string  ( 'SMA',    'Basis Type',                       options=['SMA', 'EMA', 'VWMA'],                     group='BBWP Properties')
i_bbwpLen       = input.int     ( 13,       'Length',                           minval=1,                                           group='BBWP Properties')
i_bbwpLkbk      = input.int     ( 252,      'Lookback',                         minval=1,                                           group='BBWP Properties')

///////////////////////////////////////////////////////////////////////////////
// function declarations

f_maType ( _price, _len, _type ) =>
    _type == 'SMA' ? ta.sma ( _price, _len ) : _type == 'EMA' ? ta.ema ( _price, _len ) : ta.vwma ( _price, _len )

f_bbwp ( _price, _bbwLen, _bbwpLen, _type ) =>
    float _basis = f_maType ( _price, _bbwLen, _type )
    float _dev = ta.stdev ( _price, _bbwLen )
    _bbw = ( _basis + _dev - ( _basis - _dev )) / _basis
    _bbwSum = 0.0
    _len = bar_index < _bbwpLen ? bar_index : _bbwpLen
    for _i = 1 to _len by 1
        _bbwSum += ( _bbw[_i] > _bbw ? 0 : 1 )
        _bbwSum
    _return = bar_index >= _bbwLen ? ( _bbwSum / _len) * 100 : na
    _return

f_clrSlct ( _percent, _select, _type, _solid, _array1, _array2 ) =>
    _select == 'Solid' ? _solid : array.get ( _type == 'Blue Green Red' ? _array1 : _array2, math.round ( _percent ) )

/////////////////////////////////////////////////////////////////////////////// 
// calculations

bbwp        = f_bbwp ( i_priceSrc, i_bbwpLen, i_bbwpLkbk, i_basisType )

// END BBWP
/////////////////////////////////////////////////////////////////////////////// 



// use Heikin Ashi candle data to catch momentum
openHA = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, open)
closeHA = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, close)
highHA = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, high)
lowHA = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, low)



volume_ma = ta.sma(volume, volume_ma_input)

var bbwp_lower_bound = false
var bbwp_reset = false

if ta.crossunder(bbwp, bbwp_middle)
    bbwp_reset := true

if ta.crossunder(bbwp, bbwp_minimum)
    bbwp_lower_bound := true


shadowless_rise = (openHA <= lowHA)  ? 1 : 0
shadowless_fall = (openHA >= highHA)  ? 1 : 0


boom = bbwp_lower_bound and bbwp_reset and shadowless_rise and volume > volume_ma and bbwp < 50 and bbwp > 15 ? 1 : 0
doom = bbwp_lower_bound and bbwp_reset and shadowless_fall and volume > volume_ma and bbwp < 50 and bbwp > 15 ? 1 : 0


emaline = ta.ema(close, emalength)

if emafilter and close < emaline
    boom := 0

if emafilter and close > emaline
    doom := 0



if boom or doom
    bbwp_lower_bound := false
    bbwp_reset := false
    
if ta.crossover(bbwp, 50) and bbwp_lower_bound == true
    bbwp_lower_bound := false
    


plotshape(boom ? boom : na, title='Lambo', text='Boom!', location=location.belowbar, style=shape.labelup, size=size.normal, color=color.green, textcolor=color.new(color.white, 0))
plotshape(doom ? doom : na, title='Rambo', text='Doom!', location=location.abovebar, style=shape.labeldown, size=size.normal, color=color.red, textcolor=color.new(color.white, 0))


alertcondition(boom, "Boom!", "Bullish Boom Signal")
alertcondition(doom, "Doom!", "Bearish Doom Signal")

if (boom)
	strategy.entry("Buy", strategy.long, comment="buy")
if (doom)
	strategy.entry("Sell", strategy.short, comment="sell")

// End Devastation
These users thanked the author ionone for the post:
shinnosuke


Who is online

Users browsing this forum: Ahrefs [Bot], DVanAssen, kvak, Rabi, Ruby [Bot], sunmetal, Telegram [Bot], TheJurgFX and 101 guests