Attachments forums

List of attachments posted on this forum.


All files on forums: 162875

Re: Already Converted TradingView Indicators to MT4 Indicators

mrtools, Mon Aug 19, 2024 6:43 am

alpha24 wrote: Mon Aug 19, 2024 12:24 am Hi Mrtools and Kvak

here is an idea of mine that macd of osma. can you convert it in mt4?

Code: Select all

// This Pine Scriptâ„¢ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Alpha24

//@version=5
indicator("MACD of OSMA Original", overlay=false)

// User-defined inputs
shortLength = input(12, title="Short Length")
longLength = input(26, title="Long Length")
signalSmoothing = input(9, title="Signal Smoothing")

// Calculate MACD
macdLine = ta.ema(close, shortLength) - ta.ema(close, longLength)
signalLine = ta.ema(macdLine, signalSmoothing)
osma = macdLine - signalLine

// Calculate MACD of OSMA
osmaEma12 = ta.ema(osma, shortLength)
osmaEma26 = ta.ema(osma, longLength)
macdOfOsma = osmaEma12 - osmaEma26
signalLineOsma = ta.ema(macdOfOsma, signalSmoothing)
osmaOfMacdOfOsma = macdOfOsma - signalLineOsma

// Plotting
plot(macdOfOsma, color=color.blue, title="MACD of OSMA Original", linewidth=2)
plot(signalLineOsma, color=color.orange, title="Signal Line of OSMA", linewidth=2)
hline(0, "Zero Line", color=color.gray)
plot(osmaOfMacdOfOsma, color=#1aaace, title="OSMA of MACD of OSMA", style=plot.style_histogram, linewidth=1)
MACD (OsMA of OsMA)

Think this is close.

PS: Further explanation on this indicator, here.
All files in topic