NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Cetas

//@version=5
indicator('Info table with double EMA ', overlay=true)


// POSITION AND SIZE
PosTable = input.string(defval="Bottom Right", title="Position", options=["Top Right", "Middle Right", "Bottom Right", "Top Center", "Middle Center", "Bottom Center", "Top Left", "Middle Left", "Bottom Left"], group="Table Location & Size", inline="1")
SizTable = input.string(defval="Auto", title="Size", options=["Auto", "Huge", "Large", "Normal", "Small", "Tiny"], group="Table Location & Size", inline="1")

Pos1Table = PosTable == "Top Right" ? position.top_right : PosTable == "Middle Right" ? position.middle_right : PosTable == "Bottom Right" ? position.bottom_right : PosTable == "Top Center" ? position.top_center : PosTable == "Middle Center" ? position.middle_center : PosTable == "Bottom Center" ? position.bottom_center : PosTable == "Top Left" ? position.top_left : PosTable == "Middle Left" ? position.middle_left : position.bottom_left
Siz1Table = SizTable == "Auto" ? size.auto : SizTable == "Huge" ? size.huge : SizTable == "Large" ? size.large : SizTable == "Normal" ? size.normal : SizTable == "Small" ? size.small : size.tiny

tbl = table.new(Pos1Table, 8, 8, frame_width=4, frame_color=#2F4F4F, border_width=2, border_color=#2F4F4F)

// RSI CONFIGS
srcRSI = input.source(close, "Source ‏ ‏", inline="1", group="RSI configs")
lenRSI = input.int(14, "Length ‏ ‏", 1, 100, inline="2", group="RSI configs")
maLengthInput = input.int(14, title="MA Length", inline="3", group="RSI configs")
oscRSI = ta.rsi(srcRSI, lenRSI)
up = ta.rma(math.max(ta.change(srcRSI), 0), lenRSI)
down = ta.rma(-math.min(ta.change(srcRSI), 0), lenRSI)
rsi1 = down == 0 ? 100 : up == 0 ? 0 : 100 - (100 / (1 + up / down))
rsiMA = ta.rma(rsi1, maLengthInput)

OB = input.int(70, "O.B", 0, 100, inline="1", group="RSI configs")
OS = input.int(30, "O.S", 0, 100, inline="2", group="RSI configs")

//STOCHASTIC CONFIGS
lenK = input.int(14, "%K Lenght ‏ ‏", 1, inline="1", group="STOCH configs")
smoothK = input.int(3, "%K Smoothing ‏ ‏", 1, inline="2", group="STOCH configs")
lenD = input.int(3, "%D Smoothing ‏ ‏", 1, inline="3", group="STOCH configs")
oscK = ta.sma(ta.stoch(oscRSI, oscRSI, oscRSI, lenK), smoothK)
oscD = ta.sma(oscK, lenD)
OB_1 = input.int(80, "O.B", 0, 100, inline="2", group="STOCH configs")
OS_1 = input.int(20, "O.S", 0, 100, inline="3", group="STOCH configs")

//EMA CONFIGS
show_ema1 = input(true, title = "EMA 1", inline = "1", group = "EMA configs")
emaLength1 = input.int(14, title="Length", inline = "1", group = "EMA configs")
emaWidth1 = input.int(2, title="Width", inline = "1", group = "EMA configs")
emaValue1 = ta.ema(close, emaLength1)
show_ema2 = input(false, title = "EMA 2", inline = "2", group = "EMA configs")
emaLength2 = input.int(50, title="Length", inline = "2", group = "EMA configs")
emaWidth2 = input.int(2, title="Width", inline = "2", group = "EMA configs")
emaValue2 = ta.ema(close, emaLength2)


// MACD DEMA parameters
sma = input.int(12, "DEMA Courte ‏ ‏", 1, inline="1", group="MACD DEMA configs")
lma = input.int(26, "DEMA Longue ‏ ‏", 1, inline="2", group="MACD DEMA configs")
tsp = input.int(9, "Signal ‏ ‏", 1, inline="3", group="MACD DEMA configs")

//Calculate MACD DEMA
MMEslowa = ta.ema(close,lma)
MMEslowb = ta.ema(MMEslowa,lma)
DEMAslow = ((2 * MMEslowa) - MMEslowb )

MMEfasta = ta.ema(close,sma)
MMEfastb = ta.ema(MMEfasta,sma)
DEMAfast = ((2 * MMEfasta) - MMEfastb)

LigneMACDZeroLag = (DEMAfast - DEMAslow)

MMEsignala = ta.ema(LigneMACDZeroLag, tsp)
MMEsignalb = ta.ema(MMEsignala, tsp)
Lignesignal = ((2 * MMEsignala) - MMEsignalb )

MACDZeroLag = (LigneMACDZeroLag - Lignesignal)


// TIMEFRAMES OPTIONS
box01 = input.bool(true, "TF[01]", inline = "01", group="Select Timeframe")
tf01 = input.timeframe("1D", "", inline = "01", group="Select Timeframe")

box02 = input.bool(true, "TF[02]", inline = "02", group="Select Timeframe")
tf02 = input.timeframe("1W", "", inline = "02", group="Select Timeframe")

box03 = input.bool(true, "TF[03]", inline = "03", group="Select Timeframe")
tf03 = input.timeframe("1M", "", inline = "03", group="Select Timeframe")

//box04 = input.bool(true, "TF[04]", inline = "04", group="Select Timeframe")
//tf04 = input.timeframe("60", "", inline = "04", group="Select Timeframe")

//box05 = input.bool(true, "TF[05]", inline = "01", group="Select Timeframe")
//tf05 = input.timeframe("240", "", inline = "01", group="Select Timeframe")

//box06 = input.bool(true, "TF[06]", inline = "02", group="Select Timeframe")
//tf06 = input.timeframe("1D", "", inline = "02", group="Select Timeframe")

//box07 = input.bool(true, "TF[07]", inline = "03", group="Select Timeframe")
//tf07 = input.timeframe("1W", "", inline = "03", group="Select Timeframe")


// DEFINITION OF VALUES
symbol = ticker.modify(syminfo.tickerid, syminfo.session)
tfArr = array.new<string>(na)
rsiArr = array.new<float>(na)
rsimaArr = array.new<float>(na)
ArrK = array.new<float>(na)
ArrD = array.new<float>(na)
ArrMDEMAL = array.new<float>(na)
ArrMDEMAS = array.new<float>(na)


// DEFINITIONS OF RSI & STOCH FUNCTIONS APPENDED IN THE TIMEFRAME OPTIONS
rsiNstochFun(tf, flg) =>
[rsi, stcK, stcD, rsiMA, LigneMACDZeroLag, Lignesignal] = request.security(symbol, tf, [oscRSI, oscK, oscD, rsiMA, LigneMACDZeroLag, Lignesignal])

if flg and (barstate.isrealtime ? true : timeframe.in_seconds(timeframe.period) <= timeframe.in_seconds(tf))
array.push(tfArr, na(tf) ? timeframe.period : tf)
array.push(rsiArr, rsi)
array.push(rsimaArr, rsiMA)
array.push(ArrK, stcK)
array.push(ArrD, stcD)
array.push(ArrMDEMAL, LigneMACDZeroLag)
array.push(ArrMDEMAS, Lignesignal)


rsiNstochFun(tf01, box01), rsiNstochFun(tf02, box02), rsiNstochFun(tf03, box03)


// TABLE AND CELLS CONFIG
// Post Timeframe in format
tfTxt(x)=>
out = x
if not str.contains(x, "S") and not str.contains(x, "M") and
not str.contains(x, "W") and not str.contains(x, "D")
if str.tonumber(x)%60 == 0
out := str.tostring(str.tonumber(x)/60)+"H"
else
out := x + "m"
out

if barstate.islast
table.clear(tbl, 0, 0, 3, 7)

// TITLES
table.cell(tbl, 0, 0, "⏱", text_color=#FFFFFF, text_size=Siz1Table, bgcolor=#000000)
table.cell(tbl, 1, 0, "RSI("+str.tostring(lenRSI)+")", text_color=#FFFFFF, text_size=Siz1Table, bgcolor=#000000)
table.cell(tbl, 2, 0, "%K ("+str.tostring(lenK)+")", text_color=#FFFFFF, text_size=Siz1Table, bgcolor=#000000)
table.cell(tbl, 3, 0, "%D ("+str.tostring(lenD)+")", text_color=#FFFFFF, text_size=Siz1Table, bgcolor=#000000)
table.cell(tbl, 4, 0, "RSI MA("+str.tostring(maLengthInput)+")", text_color=#FFFFFF, text_size=Siz1Table, bgcolor=#000000)
table.cell(tbl, 5, 0, "MACD DEMA LIGNE", text_color=#FFFFFF, text_size=Siz1Table, bgcolor=#000000)
table.cell(tbl, 6, 0, "MACD DEMA SIGNAL", text_color=#FFFFFF, text_size=Siz1Table, bgcolor=#000000)


j = 1
if array.size(rsiArr) > 0
for i = 0 to array.size(rsiArr) - 1
if not na(array.get(rsiArr, i))

//config values in the cells
TF_VALUE = array.get(tfArr,i)
RSI_VALUE = array.get(rsiArr, i)
K_VALUE = array.get(ArrK, i)
D_VALUE = array.get(ArrD, i)
SIGNAL = K_VALUE > D_VALUE ? "▲" : K_VALUE < D_VALUE ? "▼" : na
rsiMA_VALUE = array.get(rsimaArr, i)
rsiMAp_VALUE1 = array.get(rsimaArr, i)
rsiMAp_VALUE = array.get(rsimaArr, i)
mdemaligne_VALUE = array.get(ArrMDEMAL, i)
mdemasignal_VALUE = array.get(ArrMDEMAS, i)


//config colors in the the cells
//rsi
cond1 = (array.get(rsiArr,i)) >= OB
cond2 = (array.get(rsiArr, i)) <= OS
cellRSI = cond1 ? #5D1616 : cond2 ? #194616 : not cond1 and not cond2 ? #1C1C1C : na
txtRSI = cond1 ? #FF4500 : cond2 ? #00FF00 : not cond1 and not cond2 ? #A9A9A9 : na

//stochastic
cond3 = (array.get(ArrK,i)) >= OB_1
cond4 = (array.get(ArrK,i)) <= OS_1
cellK = cond3 ? #5D1616 : cond4 ? #194616 : not cond3 and not cond4 ? #1C1C1C : na
txtK = cond3 ? #FF4500 : cond4 ? #00FF00 : not cond3 and not cond4 ? #A9A9A9 : na

//rsiMApercentage
cond5 = (array.get(ArrK,i)) >= OB_1
cond6 = (array.get(ArrK,i)) <= OS_1
cellrsiMAp = cond5 ? #5D1616 : cond6 ? #194616 : not cond5 and not cond6 ? #1C1C1C : na
txtrsiMAp = cond5 ? #FF4500 : cond6 ? #00FF00 : not cond5 and not cond6 ? #A9A9A9 : na

table.cell(tbl, 0, j, tfTxt(TF_VALUE), text_color=#FFFFFF, text_halign=text.align_left, text_size=Siz1Table, bgcolor=#000000)
table.cell(tbl, 1, j, str.tostring(RSI_VALUE, "#.##"),text_color=txtRSI, text_halign=text.align_right, text_size=Siz1Table, bgcolor=cellRSI)
table.cell(tbl, 2, j, str.tostring(K_VALUE, "#.##"), text_color=txtK, text_halign=text.align_right, text_size=Siz1Table, bgcolor=cellK)
table.cell(tbl, 3, j, str.tostring(D_VALUE, "#.##"), text_color=txtK, text_halign=text.align_right, text_size=Siz1Table, bgcolor=cellK)
table.cell(tbl, 4, j, str.tostring(rsiMA_VALUE, "#.##"),text_color=#A9A9A9, text_halign=text.align_right, text_size=Siz1Table, bgcolor=#1C1C1C)
table.cell(tbl, 5, j, str.tostring(mdemaligne_VALUE, "#.##"), text_color=#A9A9A9, text_halign=text.align_right, text_size=Siz1Table, bgcolor=#1C1C1C)
table.cell(tbl, 6, j, str.tostring(mdemasignal_VALUE, "#.##"), text_color=#A9A9A9, text_halign=text.align_right, text_size=Siz1Table, bgcolor=#1C1C1C)


j += 1

// Plot EMA
plot(show_ema1 ? emaValue1 : na, title='First EMA Line', color=color.new(color.blue, 0), linewidth = emaWidth1, display = display.pane)
plot(show_ema2 ? emaValue2 : na, title='Second EMA Line', color=color.new(color.orange, 0), linewidth = emaWidth2, display = display.pane)
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.