Re: Already Converted TradingView Indicators to MT4 Indicators

211
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

212
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

214
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

215
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: Akela, ChatGPT [Bot], DVanAssen, Facebook [Crawler], IBM oBot [Bot], kvak, Majestic-12 [Bot], merlin66, TransparentTrader, WhatsApp [Bot], Woodyz and 116 guests