Supertrend from tradingview to prorealtime

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #169337 quote
    keengteekeengtee
    Participant
    New

     

    Factor=input(5, minval=1,maxval = 100)
    Pd=input(3, minval=1,maxval = 100)

    Up=close-(Factor*atr(Pd))
    Dn=close+(Factor*atr(Pd))

    TrendUp=close[1]>TrendUp[1]? max(Up,TrendUp[1]) : Up
    TrendDown=close[1]<TrendDown[1]? min(Dn,TrendDown[1]) : Dn

    Trend = close > TrendDown[1] ? 1: close< TrendUp[1]? -1: nz(Trend[1],1)
    Tsl = Trend==1? TrendUp: TrendDown

    linecolor = Trend == 1 ? green : red

    plot(Tsl, color = linecolor , style = line , linewidth = 2,title = “SuperTrend”)

    plotshape(cross(close,Tsl) and close>Tsl , “Up Arrow”, shape.triangleup,location.belowbar,green,0,0)
    plotshape(cross(Tsl,close) and close<Tsl , “Down Arrow”, shape.triangledown , location.abovebar, red,0,0)
    //plot(Trend==1 and Trend[1]==-1,color = linecolor, style = circles, linewidth = 3,title=”Trend”)

    plotarrow(Trend == 1 and Trend[1] == -1 ? Trend : na, title=”Up Entry Arrow”, colorup=lime, maxheight=60, minheight=50, transp=0)
    plotarrow(Trend == -1 and Trend[1] == 1 ? Trend : na, title=”Down Entry Arrow”, colordown=red, maxheight=60, minheight=50, transp=0)

    #169387 quote
    NicolasNicolas
    Keymaster
    Legend

    Hi, please next time, try to explain what you request, and not just copy/paste a code in the post without any word… 🙄

    What you request is a default indicator available in the platform, look into your indicators list with “supertrend” keyword.

    keengtee thanked this post
    #169416 quote
    keengteekeengtee
    Participant
    New

    ok I want to convert this tradingview indicator into a prorealtime indicator and I don’t care about it being fancy is just want the buy and sell signals to be clear

     

    //Author – Rajandran R
    //www.marketcalls.in
    study(“Supertrend V1.0 – Buy or Sell Signal”, overlay = true)

    Factor=input(7.20112, minval=1,maxval = 100)
    Pd=input(2, minval=1,maxval = 100)

    Up=close-(Factor*atr(Pd))
    Dn=close+(Factor*atr(Pd))

    TrendUp=close[1]>TrendUp[1]? max(Up,TrendUp[1]) : Up
    TrendDown=close[1]<TrendDown[1]? min(Dn,TrendDown[1]) : Dn

    Trend = close > TrendDown[1] ? 1: close< TrendUp[1]? -1: nz(Trend[1],1)
    Tsl = Trend==1? TrendUp: TrendDown

    linecolor = Trend == 1 ? green : red

    plot(Tsl, color = linecolor , style = line , linewidth = 2,title = “SuperTrend”)

    plotshape(cross(close,Tsl) and close>Tsl , “Up Arrow”, shape.triangleup,location.belowbar,green,0,0)
    plotshape(cross(Tsl,close) and close<Tsl , “Down Arrow”, shape.triangledown , location.abovebar, red,0,0)
    //plot(Trend==1 and Trend[1]==-1,color = linecolor, style = circles, linewidth = 3,title=”Trend”)

    plotarrow(Trend == 1 and Trend[1] == -1 ? Trend : na, title=”Up Entry Arrow”, colorup=lime, maxheight=60, minheight=50, transp=0)
    plotarrow(Trend == -1 and Trend[1] == 1 ? Trend : na, title=”Down Entry Arrow”, colordown=red, maxheight=60, minheight=50, transp=0)

    #169417 quote
    keengteekeengtee
    Participant
    New

    It was an error in the top code this is the correct one

    //Author – Rajandran R
    //www.marketcalls.in
    study(“Supertrend V1.0 – Buy or Sell Signal”, overlay = true)

    Factor=input(7.20112, minval=1,maxval = 100)
    Pd=input(2, minval=1,maxval = 100)

    Up=close-(Factor*atr(Pd))
    Dn=close+(Factor*atr(Pd))

    TrendUp=close[1]>TrendUp[1]? max(Up,TrendUp[1]) : Up
    TrendDown=close[1]<TrendDown[1]? min(Dn,TrendDown[1]) : Dn

    Trend = close > TrendDown[1] ? 1: close< TrendUp[1]? -1: nz(Trend[1],1)
    Tsl = Trend==1? TrendUp: TrendDown

    linecolor = Trend == 1 ? green : red

    plot(Tsl, color = linecolor , style = line , linewidth = 2,title = “SuperTrend”)

    plotshape(cross(close,Tsl) and close>Tsl , “Up Arrow”, shape.triangleup,location.belowbar,green,0,0)
    plotshape(cross(Tsl,close) and close<Tsl , “Down Arrow”, shape.triangledown , location.abovebar, red,0,0)
    //plot(Trend==1 and Trend[1]==-1,color = linecolor, style = circles, linewidth = 3,title=”Trend”)

    plotarrow(Trend == 1 and Trend[1] == -1 ? Trend : na, title=”Up Entry Arrow”, colorup=lime, maxheight=60, minheight=50, transp=0)
    plotarrow(Trend == -1 and Trend[1] == 1 ? Trend : na, title=”Down Entry Arrow”, colordown=red, maxheight=60, minheight=50, transp=0)

    #169418 quote
    keengteekeengtee
    Participant
    New

    something keeps changing when I paste the code so here goes the link to the indicator from tradingview

    https://www.tradingview.com/script/kjdffrF2-Supertrend-V1-0-Buy-or-Sell-Signal/

    I’m trying to change the ‘hl2’ to ‘close’ also the factor to ‘7.20112’ and the period to ‘2’

    highly appreciated

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.
ProRealAI ProRealAI New

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

Supertrend from tradingview to prorealtime


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
keengtee @keengtee Participant
Summary

This topic contains 4 replies,
has 2 voices, and was last updated by keengteekeengtee
5 years, 4 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 05/10/2021
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...