Notes![what is notes.io? What is notes.io?](/theme/images/whatisnotesio.png)
![]() ![]() Notes - notes.io |
//@version=5
indicator('MaveAlgo', overlay=true)
//EMA
fast_ema = ta.ema(close, 9)
slow_ema = ta.ema(close, 18)
//MACD
fastInput = 12
slowInput = 26
[macdLine, signalLine, histLine] = ta.macd(close, fastInput, slowInput, 9)
//Supertrend
atrPeriod = 10
factor = 3
[supertrend, direction] = ta.supertrend(factor, atrPeriod)
linecolor = direction < 0 ? #00ff00 : #ff0000
plot(supertrend, color=linecolor, linewidth=2, title='Supertrend')
//Condition
longentry = fast_ema > slow_ema and macdLine > signalLine and close > supertrend
shortentry = fast_ema < slow_ema and macdLine < signalLine and close < supertrend
var pos = 0
if longentry and pos <= 0
pos := 1
if shortentry and pos >= 0
pos := -1
longsignal = pos == 1 and (pos != 1)[1]
shortsignal = pos == -1 and (pos != -1)[1]
plotshape(longsignal, style=shape.labelup, color=#00FF00, text='BUY', textcolor=#ffffff, editable=false, location=location.belowbar, size=size.normal)
plotshape(shortsignal, style=shape.labeldown, color=#FF0000, text='SELL', textcolor=#ffffff, editable=false, location=location.abovebar, size=size.normal)
//
atrMultiplier = input.float(title='ATR Band Scale Factor', defval=2.5, step=0.1, minval=0.01, group="ATR Bands Standard Settings", tooltip="Scaling factor (aka multiplier) for the ATR to use for plotting the ATR bands. " +
"This will usually be between 1 and 3.nnDefault: 2.5")
//
atrSourceRef = "close"
showTPBands = input.bool(title="Show opposite bands for take-profit zones", defval=false, tooltip="If enalbled, the existing ATR bands will be treated as 'stop-loss' bands, and 'take-profit' bands will be plotted " +
"to depict potential take-profit targets that are scaled based on the 'stop-loss' band and an additional reward/risk scaling factor (see below).nnDefault: Unchecked", group="Take-Profit Settings")
tpScaleFactor = input.float(title="Take-Profit Scale Factor", defval=1.5, minval=1, step=0.1, tooltip="This is a secondary scaling factor used based on the 'stop-loss' ATR bands to calculate and plot a potential take-profit target.nn" +
"The easiest way to think of this is as a desired reward/risk ratio, where the primary ATR Bands represent the risk/stop-loss.nnDefault: 1.5")
//
//
//
showTable = input.bool(title="Show Table for Stops and Targets", defval=false, group="Table Settings", tooltip="If enabled, a table will be placed on-chart showing exact values for both stop bands, as well as optional take-profit bands/targets.nn" +
"Note: Take-profit values are based on the 'Take-Profit Scale Factor' setting above.nnDefault: Unchecked")
allowTableRepainting = input.bool(title="Allow Table Repainting", defval=false, group="Table Settings", tooltip="If enabled, table data will show real-time values, which will inherently repaint. This may be desirable for people preparing to enter prior " +
"to candle close, but should be used with extreme caution.nnDefault: Unchecked")
showTPinTable = input.bool(title="Include additional rows/columns to display take-profit values.", defval=false, group="Table Settings", tooltip="If enabled, additional table rows/columns will be drawn and populated with take-profit band/target values.nn" +
"Note: Take-profit values are based on the 'Take-Profit Scale Factor' setting above.nnDefault: Unchecked")
//
//
alignTableVertically = input.bool(title="Align Table Vertically", defval=true, group="Table Settings", tooltip="If enabled, the table will be re-aligned to display vertically (headers to the left) instead of horizontally (headers on top).nnDefault: Checked")
tablePosition = input.string(title="Table Location", defval="Bottom Right", options=["Top Right","Top Left","Top Center","Middle Right","Middle Left","Middle Center","Bottom Right","Bottom Left","Bottom Center"], group="Table Settings",
tooltip='This setting controls the position on the chart where the table will be located.nnDefault: Bottom Right')
tableColor = input.color(title="Table Color: ", defval=color.rgb(0, 175, 200, 20), group="Table Settings", inline="A")
tableTextHeaderColor = input.color(title="Table Header Color: ", defval=color.rgb(255, 255, 0, 0), group="Table Settings", tooltip="These settings determine the colors used for the table cell borders/outlines, and the text inside the table cells used as data headers.", inline="A")
tableTextColor = input.color(title="Table Text Color: ", defval=color.rgb(255, 255, 255, 0), group="Table Settings", tooltip="This setting determines the color used for the text inside the table cells.", inline="B")
//
tableLongBGColor = input.color(title="Table Background Color - Long: ", defval=color.rgb(0, 255, 0, 90), group="Table Settings", inline="C")
tableShortBGColor = input.color(title="Short: ", defval=color.rgb(255, 0, 0, 80), group="Table Settings", tooltip="These settings determine the background fill colors used for long/short position info.", inline="C")
//
getBandOffsetSource(srcIn, isUpperBand) =>
ret = close
switch srcIn
"close" => ret := close
"wicks" => ret := isUpperBand ? high : low
=> ret := close
ret
//
getTablePosition(posIn) =>
posOut = position.bottom_right
switch (posIn)
"Top Right" => posOut := position.top_right
"Top Left" => posOut := position.top_left
"Top Center" => posOut := position.top_center
"Middle Right" => posOut := position.middle_right
"Middle Left" => posOut := position.middle_left
"Middle Center" => posOut := position.middle_center
"Bottom Right" => posOut := position.bottom_right
"Bottom Left" => posOut := position.bottom_left
"Bottom Center" => posOut := position.bottom_center
=> posOut := position.bottom_right
posOut
//
atr = ta.atr(atrPeriod)
scaledATR = atr * atrMultiplier
upperATRBand = getBandOffsetSource(atrSourceRef, true) + scaledATR
lowerATRBand = getBandOffsetSource(atrSourceRef, false) - scaledATR
//
scaledTPLong = close + ((close - lowerATRBand) * tpScaleFactor)
scaledTPShort = close - ((upperATRBand - close) * tpScaleFactor)
//
plot(upperATRBand, title="Upper ATR Band", color=color.rgb(97, 97, 97, 67), linewidth=2)
plot(lowerATRBand, title="Lower ATR Band", color=color.rgb(97, 97, 97, 67), linewidth=2)
//
plot(showTPBands ? scaledTPLong : na, title="Upper Take-Profit Band", color=color.rgb(97, 97, 97, 67), linewidth=1)
plot(showTPBands ? scaledTPShort : na, title="Lower Take-Profit Band", color=color.rgb(97, 97, 97, 67), linewidth=1)
//
if (showTable)
var atrTable = table.new(position=getTablePosition(tablePosition), columns=8, rows=8)
//
table.set_border_width(atrTable, 1)
table.set_frame_width(atrTable, 1)
table.set_border_color(atrTable, tableColor)
table.set_frame_color(atrTable, tableColor)
//
if (alignTableVertically)
//
table.cell(atrTable, 0, 0, text="Long ATR Stop", text_color=tableTextHeaderColor, bgcolor=tableLongBGColor, tooltip="Test")
table.cell(atrTable, 0, 1, text="Long ATR Stop Dist", text_color=tableTextHeaderColor, bgcolor=tableLongBGColor)
if (showTPinTable)
table.cell(atrTable, 0, 2, text="Long ATR TP", text_color=tableTextHeaderColor, bgcolor=tableLongBGColor)
//
if (tpScaleFactor != 1)
table.cell(atrTable, 0, 3, text="Long ATR TP Dist", text_color=tableTextHeaderColor, bgcolor=tableLongBGColor)
table.cell(atrTable, 0, 4, text="Short ATR Stop", text_color=tableTextHeaderColor, bgcolor=tableShortBGColor)
table.cell(atrTable, 0, 5, text="Short ATR Stop Dist", text_color=tableTextHeaderColor, bgcolor=tableShortBGColor)
if (showTPinTable)
table.cell(atrTable, 0, 6, text="Short ATR TP", text_color=tableTextHeaderColor, bgcolor=tableShortBGColor)
//
if (tpScaleFactor != 1)
table.cell(atrTable, 0, 7, text="Short ATR TP Dist", text_color=tableTextHeaderColor, bgcolor=tableShortBGColor)
//
table.cell(atrTable, 1, 0, text=str.tostring(allowTableRepainting ? lowerATRBand : lowerATRBand[1], format.mintick), text_color=tableTextColor, bgcolor=tableLongBGColor, tooltip="Test")
table.cell(atrTable, 1, 1, text=str.tostring(math.round_to_mintick(allowTableRepainting ? close - lowerATRBand : close[1] - lowerATRBand[1])), text_color=tableTextColor, bgcolor=tableLongBGColor)
if (showTPinTable)
table.cell(atrTable, 1, 2, text=str.tostring(allowTableRepainting ? scaledTPLong : scaledTPLong[1], format.mintick), text_color=tableTextColor, bgcolor=tableLongBGColor)
//
if (tpScaleFactor != 1)
table.cell(atrTable, 1, 3, text=str.tostring(math.round_to_mintick(allowTableRepainting ? scaledATR * tpScaleFactor : scaledATR[1] * tpScaleFactor)), text_color=tableTextColor, bgcolor=tableLongBGColor)
//
table.cell(atrTable, 1, 4, text=str.tostring(allowTableRepainting ? upperATRBand : upperATRBand[1], format.mintick), text_color=tableTextColor, bgcolor=tableShortBGColor, tooltip="Test 2")
table.cell(atrTable, 1, 5, text=str.tostring(math.round_to_mintick(allowTableRepainting ? upperATRBand - close : upperATRBand[1] - close[1])), text_color=tableTextColor, bgcolor=tableShortBGColor)
if (showTPinTable)
table.cell(atrTable, 1, 6, text=str.tostring(allowTableRepainting ? scaledTPShort : scaledTPShort[1], format.mintick), text_color=tableTextColor, bgcolor=tableShortBGColor)
//
if (tpScaleFactor != 1)
table.cell(atrTable, 1, 7, text=str.tostring(math.round_to_mintick(allowTableRepainting ? scaledATR * tpScaleFactor : scaledATR[1] * tpScaleFactor)), text_color=tableTextColor, bgcolor=tableShortBGColor)
//
else
//
table.cell(atrTable, 0, 0, text="Long ATR Stop", text_color=tableTextHeaderColor, bgcolor=tableLongBGColor, tooltip="Test")
table.cell(atrTable, 1, 0, text="Long ATR Stop Dist", text_color=tableTextHeaderColor, bgcolor=tableLongBGColor)
if (showTPinTable)
table.cell(atrTable, 2, 0, text="Long ATR TP", text_color=tableTextHeaderColor, bgcolor=tableLongBGColor)
//
if (tpScaleFactor != 1)
table.cell(atrTable, 3, 0, text="Long ATR TP Dist", text_color=tableTextHeaderColor, bgcolor=tableLongBGColor)
table.cell(atrTable, 4, 0, text="Short ATR Stop", text_color=tableTextHeaderColor, bgcolor=tableShortBGColor)
table.cell(atrTable, 5, 0, text="Short ATR Stop Dist", text_color=tableTextHeaderColor, bgcolor=tableShortBGColor)
if (showTPinTable)
table.cell(atrTable, 6, 0, text="Short ATR TP", text_color=tableTextHeaderColor, bgcolor=tableShortBGColor)
//
if (tpScaleFactor != 1)
table.cell(atrTable, 7, 0, text="Short ATR TP Dist", text_color=tableTextHeaderColor, bgcolor=tableShortBGColor)
//
table.cell(atrTable, 0, 1, text=str.tostring(allowTableRepainting ? lowerATRBand : lowerATRBand[1], format.mintick), text_color=tableTextColor, bgcolor=tableLongBGColor, tooltip="Test")
table.cell(atrTable, 1, 1, text=str.tostring(math.round_to_mintick(allowTableRepainting ? close - lowerATRBand : close[1] - lowerATRBand[1])), text_color=tableTextColor, bgcolor=tableLongBGColor)
if (showTPinTable)
table.cell(atrTable, 2, 1, text=str.tostring(allowTableRepainting ? scaledTPLong : scaledTPLong[1], format.mintick), text_color=tableTextColor, bgcolor=tableLongBGColor)
//
if (tpScaleFactor != 1)
table.cell(atrTable, 3, 1, text=str.tostring(math.round_to_mintick(allowTableRepainting ? scaledATR * tpScaleFactor : scaledATR[1] * tpScaleFactor)), text_color=tableTextColor, bgcolor=tableLongBGColor)
//
table.cell(atrTable, 4, 1, text=str.tostring(allowTableRepainting ? upperATRBand : upperATRBand[1], format.mintick), text_color=tableTextColor, bgcolor=tableShortBGColor, tooltip="Test 2")
table.cell(atrTable, 5, 1, text=str.tostring(math.round_to_mintick(allowTableRepainting ? upperATRBand - close : upperATRBand[1] - close[1])), text_color=tableTextColor, bgcolor=tableShortBGColor)
if (showTPinTable)
table.cell(atrTable, 6, 1, text=str.tostring(allowTableRepainting ? scaledTPShort : scaledTPShort[1], format.mintick), text_color=tableTextColor, bgcolor=tableShortBGColor)
//
if (tpScaleFactor != 1)
table.cell(atrTable, 7, 1, text=str.tostring(math.round_to_mintick(allowTableRepainting ? scaledATR * tpScaleFactor : scaledATR[1] * tpScaleFactor)), text_color=tableTextColor, bgcolor=tableShortBGColor)
![]() |
Notes is a web-based application for online 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 14 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