Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Phenom 2.0
- //@version=5
- indicator("Phenom", overlay=true)
- //{ EMA
- //input
- showEma = input(title='Show Ema', group='EMA', defval=true)
- showColor = input(title='Color bar', group='EMA', defval=true)
- emaLeght1 = input(title='EMA 1', group='EMA', defval=5)
- emaLeght2 = input(title='EMA 2', group='EMA', defval=10)
- emaLeght3 = input(title='EMA 3', group='EMA', defval=20)
- emaLeght4 = input(title='EMA 4', group='EMA', defval=50)
- emaLeght5 = input(title='EMA 5', group='EMA', defval=100)
- emaLeght6 = input(title='EMA 5', group='EMA', defval=150)
- emaLeght7 = input(title='EMA 5', group='EMA', defval=200)
- //calc
- ema1 = ta.ema(close, emaLeght1)
- ema2 = ta.ema(close, emaLeght2)
- ema3 = ta.ema(close, emaLeght3)
- ema4 = ta.ema(close, emaLeght4)
- ema5 = ta.ema(close, emaLeght5)
- ema6 = ta.ema(close, emaLeght6)
- ema7 = ta.ema(close, emaLeght7)
- //plot
- plot1 = plot(showEma ? ema1 : na, color=color.gray, transp=50, linewidth=1)
- plot2 = plot(showEma ? ema2 : na, color=ema2 < ema3 ? color.red : color.green, transp=30, linewidth=2)
- plot3 = plot(showEma ? ema3 : na, color=ema2 < ema3 ? color.red : color.green, transp=30, linewidth=2)
- plot4 = plot(showEma ? ema4 : na, color=color.gray, transp=80,linewidth=1)
- plot5 = plot(showEma ? ema5 : na, color=color.gray, transp=80, linewidth=1)
- plot6 = plot(showEma ? ema6 : na, color=color.gray, transp=80, linewidth=1)
- plot7 = plot(showEma ? ema7 : na, color=color.white, linewidth=2)
- //fill
- fill(plot2, plot3, color=ema2 < ema3 ? color.red : color.green, transp=80)
- fill(plot2, plot4, color=ema2 < ema4 ? color.red : color.green, transp=95)
- fill(plot2, plot5, color=ema2 < ema5 ? color.red : color.green, transp=95)
- fill(plot2, plot6, color=ema2 < ema6 ? color.red : color.green, transp=95)
- fill(plot2, plot7, color=ema2 < ema7 ? color.red : color.green, transp=95)
- //bar color
- colRed = color.rgb(207, 102, 91, 0)
- colGreen = color.rgb(101, 161, 154, 0)
- barColor = ema2 < ema3 ? colRed : colGreen
- barcolor(showColor ? barColor:na)
- //}
- //{ ATR
- //input
- showAtr = input(title="Show Atr", group="ATR", defval=true)
- mood = input.string("Long", title='Mood', group='ATR', options=["Long", "Short"])
- atrLeght = input(title='ATR Leght', group="ATR", defval=14)
- atrMultiply1 = input.float(title="ATR stop", group="ATR", step=0.1, defval=1.5)
- atrMultiply2 = input.float(title="ATR conform", group="ATR", step=0.1, defval=0.5)
- lastBar = input(title="Values to show", group="ATR", defval=2)
- //calc atr
- atr = ta.atr(atrLeght)
- atrShortStop = close + atr*atrMultiply1
- atrLongStop = close - atr*atrMultiply1
- atrShortConform = close - atr*atrMultiply2
- atrLongConform = close + atr*atrMultiply2
- //plot short
- plot(showAtr ? mood == "Short" ? atrShortStop : na : na, style=plot.style_circles, color=color.red, show_last = lastBar, linewidth = 2)
- plot(showAtr ? mood == "Short" ? atrShortStop : na : na, show_last = lastBar, color=color.rgb(255, 82, 82, 50))
- plot(showAtr ? mood == "Short" ? atrShortConform: na : na, style=plot.style_circles, color=color.red, show_last = lastBar, linewidth = 2)
- plot(showAtr ? mood == "Short" ? atrShortConform: na : na, show_last = lastBar, color=color.rgb(255, 82, 82, 50))
- //plot long
- plot(showAtr ? mood == "Long" ? atrLongStop: na :na, style=plot.style_circles, color=color.green, show_last = lastBar, linewidth = 2)
- plot(showAtr ? mood == "Long" ? atrLongStop: na:na, show_last = lastBar, color=color.rgb(76, 175, 79, 50))
- plot(showAtr ? mood == "Long" ? atrLongConform : na:na, style=plot.style_circles, color=color.green, show_last = lastBar, linewidth = 2)
- plot(showAtr ? mood == "Long" ? atrLongConform : na:na, show_last = lastBar, color=color.rgb(76, 175, 79, 50))
- //}
- //{ Cell
- //ipnput
- showCell = input(title='Show Cell', group='Cell', defval=true)
- depo = input(title='Depo', group='Cell', defval=10000)
- risk = input.float(title='Risc % of depo', group='Cell', step=0.1, defval=1.0)
- currency = input.string('USD', title='Currency', group='Cell', options=['USD', 'RUB'])
- //calc
- sumRisc=(depo/100)*risk
- sumStock=sumRisc/(close-atrLongStop)
- sumDeal = sumStock*close
- atrPercent = (close - atrLongStop)/close*100
- //cell
- var table atrDisplay = table.new(position.bottom_right, columns = 10, rows = 10, bgcolor = color.black, frame_width=1, frame_color=color.rgb(255, 255, 255, 50), border_color=color.white)
- if (showCell)
- table.cell(atrDisplay, 0, 0, str.tostring("Depo"), text_color=color.white,text_halign=text.align_left, bgcolor=color.rgb(120, 123, 134, 50))
- if (currency == "USD")
- table.cell(atrDisplay, 0, 1, str.tostring(depo, "#$"), text_color=color.white,text_halign=text.align_left, bgcolor=color.rgb(120, 123, 134, 50))
- if (currency == "RUB")
- table.cell(atrDisplay, 0, 1, str.tostring(depo, "#₽"), text_color=color.white,text_halign=text.align_left, bgcolor=color.rgb(120, 123, 134, 50))
- table.cell(atrDisplay, 1, 0, str.tostring(risk, "Risk #.#") + str.tostring("%") , text_color=color.white, text_halign=text.align_left, bgcolor=color.rgb(120, 123, 134,0))
- if (currency == "USD")
- table.cell(atrDisplay, 1, 1, str.tostring(sumRisc, "#.#$"), text_color=color.white, text_halign=text.align_left, bgcolor=color.rgb(120, 123, 134, 0))
- if (currency == "RUB")
- table.cell(atrDisplay, 1, 1, str.tostring(sumRisc, "#.#₽"), text_color=color.white, text_halign=text.align_left, bgcolor=color.rgb(120, 123, 134, 0))
- table.cell(atrDisplay, 0, 2, str.tostring(atrMultiply1, "Stop #.## ATR"), text_color=color.white, text_halign=text.align_left, bgcolor = atrPercent < 5 ? color.green:color.red)
- table.cell(atrDisplay, 0, 3, str.tostring(atrLongStop, "#.#") + str.tostring(atrPercent, " (#.#") + str.tostring("%) "),text_color=color.white, text_halign=text.align_left, bgcolor = atrPercent < 5 ? color.green:color.red)
- table.cell(atrDisplay, 1, 2, str.tostring("Sum stock"), text_color=color.white, text_halign=text.align_left, bgcolor=color.rgb(120, 123, 134,50))
- if (currency == "USD")
- table.cell(atrDisplay, 1, 3, str.tostring(sumStock, "#") + str.tostring(sumDeal, " (#$)"), text_color=color.white, text_halign=text.align_left, bgcolor=color.rgb(120, 123, 134,50))
- if (currency == "RUB")
- table.cell(atrDisplay, 1, 3, str.tostring(sumStock, "#") + str.tostring(sumDeal, " (#₽)"), text_color=color.white, text_halign=text.align_left, bgcolor=color.rgb(120, 123, 134,50))
- //}
Advertisement
Add Comment
Please, Sign In to add comment