Welcome to the BEST forum for traders

Did you know we're sharing tons of exclusive content here?
Our community is growing quickly. Take a look around and say "Hello".

Pine script percentage of a value to a value

Oct 21, 2021 - 11:07 AM

Viewed 2653 times

https://best-trading-indicator.com/community/bti/forums/4180/topics/37544 COPY

  • //@version=3
    study(title=Ö N C Ü, shorttitle=Ö N C Ü)

    isGreenCandle() =>
    if close > open
    true
    else
    false

    lowerShadow() =>
    if isGreenCandle()
    open - low
    else
    close - low

    upperShadow() =>
    if isGreenCandle()
    high - close
    else
    high - open

    realBody() =>
    abs(close - open)

    data8=(lowerShadow() > 2 * realBody() and upperShadow() < realBody())
    len = input(50, minval=1, title=Length)

    data5b=(((high - low)>3*(open -close)) and ((high - close)/(.001 + high - low) > 0.6) and ((high - open)/(.001 + high - low) > 0.6))
    //plotshape(data5b, title= Inverted Hammer, location=location.abovebar, color=red, style=shape.labeldown, text=S)
    ///rsi böümü
    high_ = highest(hl2, len)
    low_ = lowest(hl2, len)

    round_(val) => val > .99 ? .999 : val < -.99 ? -.999 : val

    value = 0.0
    value := round_(.66 * ((hl2 - low_) / max(high_ - low_, .001) - .5) + .67 * nz(value[1]))

    fish1 = 0.0
    fish1 := .5 * log((1 + value) / max(1 - value, .001)) + .5 * nz(fish1[1])

    fish2 = fish1[1]

    plot(fish1, color=blue, title=Fisher)
    plot(fish2, color=red, title=Trigger)
    up5 =crossover(fish1,fish2) and fish1<-1.5
    downyeni = fish1>1.5
    upyeni = fish1<-4
    down5 = crossunder(fish1,fish2) and fish1>0
    plotchar(up5, title=buy, char='AL ', location=location.bottom, color=black, transp=0, offset=0,size=size.tiny)
    plotchar(down5, title=sell,char='SAT', offset=0, location=location.top, color=black, transp=0,size=size.tiny)
    //alertcondition(up5, title='buy', message='go long')
    //alertcondition(down5, title='sell', message='go short')

    // obtain rsi value
    rs = rsi(close,14)

    // Create input options for Buy / Sell values
    selli = input(75, Sell)
    sellzonei = input(65, Sell Zone)
    buyzonei = input(35, Buy Zone)
    buyi = input(30, Buy)
    bottomi = input(25, Bottom)
    buyyeni =input(45, 45veA)
    buyyeni2 =input(40, 45veA)

    // Plot color coded RSI on chart
    mycolor = iff(rs>selli,#D33123,iff(rs>sellzonei,#671675,iff(rs<bottomi,#BEED21,iff(rs<buyi,#688212,iff(rs<buyzonei,#BEED21,#1F9BF0)))))

    //plot(rs,title=RSI,color = mycolor, linewidth=4, style=histogram)

    limit = input(title=warning limit, type=float, defval=1, step=0.1)
    candlePeriod = input(title=candle seconds, type=integer, defval=300) //amount of seconds in the selected period. ex: 1h = 3600s
    sizeMAVol = input(title=vol MA size, type=integer, defval=10, step=1)

    //calculate time until candle closes. candle close= 100% of time
    currentCandle = (timenow-time[0])< candlePeriod*1000 ? true : false
    deltaT = currentCandle ? (timenow - time) : (time[0] - time[1])
    deltaT := deltaT / (candlePeriod * 1000)
    //weekends have weird periods, need normalization hack
    deltaT := deltaT > 1 ? 1 : deltaT

    //volume calculation
    MV = sma(volume,sizeMAVol)
    deltaV = volume / MV
    direction = (close-open)>0 ? 1 : -1
    volTarget = deltaV / deltaT * direction
    volColor = volTarget>limit ? green : volTarget<(0-limit) ? red: gray
    //check for abnormalities. candle volume>500% of average is weird, probably data is bad
    volColor := abs(volTarget)>5 ? black : volColor
    volTarget := abs(volTarget)>5 ? 0.5 : volTarget

    kirmizi1=rs>selli
    kirmizi2=rs>sellzonei
    sari1=rs<bottomi
    sari2=rs<buyi
    sari3=rs<buyzonei
    yeni=rs<buyyeni
    yeni2=rs>buyyeni2

    kirmizi=kirmizi1
    sari=sari1 or sari3 or sari2

    //plot(abs(volTarget), style=columns, color=volColor)
    //plot(deltaT)
    plotshape(up5 and sari or up5 and yeni and yeni2, title= AL, location=location.belowbar, color =yellow, style=shape.labelup, text=L)

    plotshape(data5b and kirmizi and downyeni, title= Sat, location=location.abovebar, color = red, style=shape.labeldown, text=S)

    iff(((al,close)-(al,close[2])/(al,close[2]))/100 =>1
    al=true
    else
    al=false

    GGGGEW.png

    My goal is to get rid of a lot of yellow red below. just cut it in half there

    xbvxvx.png

    This post was edited Oct 21, 2021 12:30PM
    0
  • порно мамки

    0
  • best over the counter ed drugs https://viagarag.com - generic viagra pill identifier
    what is viagra wiki
    dangers of viagra order viagra without prescription speed viagra

    0
CONTENTS