Re: Already Converted TradingView Indicators to MT4 Indicators

211
https://tw.tradingview.com/script/Y8v4W ... mment-form

Not sure if interested in converting it to MT4?
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.


Re: Already Converted TradingView Indicators to MT4 Indicators

212
hache wrote: Tue Dec 27, 2022 7:52 am This seems a very interesting indicator too. Here you have a video of how to use it:
Hahaha, it turns out that a friend has already posted it.
These users thanked the author Jedidiah for the post:
hache
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.

Re: Already Converted TradingView Indicators to MT4 Indicators

214
If anyone is interested this would be really good for order block analysis
A higher lower
Or lower high after an imbalance, golden

Code: Select all

// © Lai_Thanh_Trung

//@version=5
indicator(shorttitle='Bagang Pivot Zones', title='Bagang Pivot Zones | Supply & Demand, Support & Resistance', overlay=true)

// functions
get(arr, index) =>
    index < array.size(arr) ? array.get(arr, index) : na

busted(highs, lows, times, bounces) =>
    array.shift(highs)
    array.shift(lows)
    array.shift(times)
    array.shift(bounces) or true

bounced(bounces) =>
    status = array.get(bounces, 0)
    array.set(bounces, 0, true)
    status

// A. CORE
ceiling = math.max(high, close[1], open[1])
floor = math.min(low, close[1], open[1])

buying = close >= open and high != low
selling = close <= open and low != high

green = close > open and close > close[1]
red = close < open and close < close[1]

gapup = open > close[1]
gapdown = open < close[1]

higher = high > high[1]
lower = low < low[1]

bullish = green and higher
bearish = red and lower

// notable price actions
bullishEngulf = selling[1] and (gapdown or lower) and bullish and close > open[1]
bearishEngulf = buying[1] and (gapup or higher) and bearish and close < open[1]

breakHigh = (selling[2] or selling[1]) and buying and close > ceiling[1]
breakLow = (buying[2] or buying[1]) and selling and close < floor[1]

whiteSoldiers = bearish[3] and buying[2] and bullish[1] and bullish and close > high[3]
blackCrows = bullish[3] and selling[2] and bearish[1] and bearish and close < low[3]

// pivot setups
soaring = bullishEngulf or breakHigh or whiteSoldiers
tumbling = bearishEngulf or breakLow or blackCrows

reversal = switch
    whiteSoldiers => not soaring[1] and not soaring[2]
    blackCrows => not tumbling[1] and not tumbling[2]
    breakHigh => not soaring[1] and (bearish[1] or bearish[2])
    breakLow => not tumbling[1] and (bullish[1] or bullish[2])

continuation = switch
    breakHigh => bullish[2] and close > high[2] and not bearish[1]
    breakLow => bearish[2] and close < low[2] and not bullish[1]

engulfing = (bullishEngulf or bearishEngulf) and (higher[1] or lower[1])

// B. PIVOT ZONES
var buyzoneHigh = array.new_float(0)
var buyzoneLow = array.new_float(0)
var buyzoneTime = array.new_int(0)
var bounceUp = array.new_bool(0)

var sellzoneHigh = array.new_float(0)
var sellzoneLow = array.new_float(0)
var sellzoneTime = array.new_int(0)
var bounceDown = array.new_bool(0)

// 1. Broken Pivot Zones
brokenHigh = while get(sellzoneHigh, 0) < high
    busted(sellzoneHigh, sellzoneLow, sellzoneTime, bounceDown)

brokenLow = while get(buyzoneLow, 0) > low
    busted(buyzoneHigh, buyzoneLow, buyzoneTime, bounceUp)

// 2. Distribution/Accumulation Bar and Pivot Bar
upturn = soaring and (reversal or continuation or engulfing)
downturn = tumbling and (reversal or continuation or engulfing)

dacbar = switch
    upturn => whiteSoldiers ? 3 : (breakHigh and selling[2] ? 2 : 1)
    downturn => blackCrows ? 3 : (breakLow and buying[2] ? 2 : 1)

pivotbar = switch
    upturn => whiteSoldiers ? 2 : (green[1] ? 1 : 0)
    downturn => blackCrows ? 2 : (red[1] ? 1 : 0)

// 3. Pivot Zone Values
pzHigh = float(na)
pzLow = float(na)

switch
    upturn =>
        // low at wick
        pzLow := math.min(low[dacbar], low[pivotbar], low[1], low)
        // high at wick or open
        pzHigh := switch
            close[pivotbar] > high[dacbar] => high[dacbar]
            open[pivotbar] > open[dacbar] => open[pivotbar]
            => open[dacbar]

    downturn =>
        // high at wick
        pzHigh := math.max(high[dacbar], high[pivotbar], high[1], high)
        // low at wick or open
        pzLow := switch
            close[pivotbar] < low[dacbar] => low[dacbar]
            open[pivotbar] < open[dacbar] => open[pivotbar]
            => open[dacbar]

// 4. Overlapping Pivot Zones
overlap = switch
    upturn => get(buyzoneHigh, 0) >= pzLow
    downturn => get(sellzoneLow, 0) <= pzHigh

replace = switch
    overlap and upturn => bounced(bounceUp)
    overlap and downturn => bounced(bounceDown)

// remove replaced zone or adjust overlapped zone
switch
    replace and upturn => busted(buyzoneHigh, buyzoneLow, buyzoneTime, bounceUp)
    replace and downturn => busted(sellzoneHigh, sellzoneLow, sellzoneTime, bounceDown)
    overlap and upturn => array.set(buyzoneHigh, 0, pzLow)
    overlap and downturn => array.set(sellzoneLow, 0, pzHigh)

// 5. Pivot Zones Queue
switch
    upturn =>
        array.unshift(buyzoneHigh, pzHigh)
        array.unshift(buyzoneLow, pzLow)
        array.unshift(buyzoneTime, time[dacbar])
        array.unshift(bounceUp, false)

    downturn =>
        array.unshift(sellzoneHigh, pzHigh)
        array.unshift(sellzoneLow, pzLow)
        array.unshift(sellzoneTime, time[dacbar])
        array.unshift(bounceDown, false)

// 6. Pivot Zones Markup
maxbox(redraw) => redraw ? 22 : na

newbox(bg) =>
    box.new(0, 0, 0, 0, xloc=xloc.bar_time, border_color=na, bgcolor=bg, extend=extend.right)

render(boxes, index, highs, lows, times) =>
    ibox = get(boxes, index)
    top = get(highs, index)
    bottom = get(lows, index)
    left = get(times, index)
    overlapped = if index > 0
        lastbox = index - 1
        top == get(lows, lastbox) or bottom == get(highs, lastbox)
    box.set_lefttop(ibox, left, overlapped ? na : top)
    box.set_rightbottom(ibox, time, overlapped ? na : bottom)

var supply = input.color(#F2364512, 'Supply Zones')
var demand = input.color(#08998112, 'Demand Zones')

var buyBox = array.new_box(0)
var sellBox = array.new_box(0)

for i = 0 to maxbox(na(close[1]))
    array.push(buyBox, newbox(demand))
    array.push(sellBox, newbox(supply))

for i = 0 to maxbox(upturn or brokenLow)
    render(buyBox, i, buyzoneHigh, buyzoneLow, buyzoneTime)

for i = 0 to maxbox(downturn or brokenHigh)
    render(sellBox, i, sellzoneHigh, sellzoneLow, sellzoneTime)

// C. ALERTS
if brokenHigh
    alert('Breakout', alert.freq_once_per_bar)

if brokenLow
    alert('Breakdown', alert.freq_once_per_bar)

if upturn or downturn
    setup = switch
        whiteSoldiers => 'White Soldiers'
        blackCrows => 'Black Crows'
        breakHigh => bullishEngulf ? 'Engulf & Break High' : 'Break High'
        breakLow => bearishEngulf ? 'Engulf & Break Low' : 'Break Low'
        bullishEngulf => 'Bullish Engulf'
        bearishEngulf => 'Bearish Engulf'
    occurence = replace ? 'Replace' : (overlap ? 'Bounce' : 'Fresh')
    message = setup + ' (' + occurence + ')'
    alert(message, alert.freq_once_per_bar_close)
Attachments
These users thanked the author Chickenspicy for the post (total 2):
RodrigoRT7, Knight
0 + 0 = 0
Infinite / Infinite = 1
1 way to Heaven & it matters

Re: Already Converted TradingView Indicators to MT4 Indicators

215
Hello coders anyone can make this MACD strategy as a bot in trading view ? thanks


//@version=5
strategy("MACD Strategy", overlay=true)
fastLength = input(12)
slowlength = input(26)
MACDLength = input(9)
MACD = ta.ema(close, fastLength) - ta.ema(close, slowlength)
aMACD = ta.ema(MACD, MACDLength)
delta = MACD - aMACD
if (ta.crossover(delta, 0))
strategy.entry("MacdLE", strategy.long, comment="MacdLE")
if (ta.crossunder(delta, 0))
strategy.entry("MacdSE", strategy.short, comment="MacdSE")
//plot(strategy.equity, title="equity", color=color.red, linewidth=2, style=plot.style_areabr)
Attachments


Re: Already Converted TradingView Indicators to MT4 Indicators

216
AxelJ wrote: Sat Jan 07, 2023 8:43 am Hello coders anyone can make this MACD strategy as a bot in trading view ? thanks


//@version=5
strategy("MACD Strategy", overlay=true)
fastLength = input(12)
slowlength = input(26)
MACDLength = input(9)
MACD = ta.ema(close, fastLength) - ta.ema(close, slowlength)
aMACD = ta.ema(MACD, MACDLength)
delta = MACD - aMACD
if (ta.crossover(delta, 0))
strategy.entry("MacdLE", strategy.long, comment="MacdLE")
if (ta.crossunder(delta, 0))
strategy.entry("MacdSE", strategy.short, comment="MacdSE")
//plot(strategy.equity, title="equity", color=color.red, linewidth=2, style=plot.style_areabr)
Image
There is a simple ma cross EA here Simple Ea match the ma's and the fast/slow settings and it will be basically the same.

Re: Already Converted TradingView Indicators to MT4 Indicators

218
Hi I'm looking for the ATR Stop Loss Finder by very fid
basically it's a multiple atr placed above and below the high and low of the price bar
default is 14 period atr with RMA or SMMA, 1.5 x ATR multipler surely MT4 have done this, I can't find it

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: " )
Attachments

Re: Already Converted TradingView Indicators to MT4 Indicators

219
Marktaylor58 wrote: Sat Jan 14, 2023 2:52 pm Hi I'm looking for the ATR Stop Loss Finder by very fid
basically it's a multiple atr placed above and below the high and low of the price bar
default is 14 period atr with RMA or SMMA, 1.5 x ATR multipler surely MT4 have done this, I can't find it

Code: Select all

//@version=4
study(title="Average True Range Stop Loss Finder", shorttitle="ATR", overlay=true)
ATR Stop Loss Finder for MT4

This version seems to be close to what you are looking for.

Concept

The ATR Stop Loss Finder uses Average True Range to determine a safe place to put stop losses to avoid being stop hunted or stopped out of a trade due to a tight stop loss.

For advance traders it can also be used as a guide for setting take profit or strong breakout areas as price hits other trader's stop losses.

Default multiplier setting is 1.5.

  • Conservative traders can use a stop loss value of 2
  • An even tighter stop loss value of 1 can also be used, too. This is used as a guide for watching price hit other trader's SL and where price can continue further.
These users thanked the author mrtools for the post (total 11):
Jedidiah, Jimmy, josi, kvak, iPar, mystylez007, TransparentTrader, RodrigoRT7, Marktaylor58, eduarescobar, mosape


Who is online

Users browsing this forum: Amazon [Bot], Bing [Bot], DotNetDotCom [Bot], euro_rapp, Google [Bot], opita, Proximic [Bot], Tbot [Bot] and 347 guests