Help on converting : Psychological line (PSY)

Forums ProRealTime English forum ProBuilder support Help on converting : Psychological line (PSY)

Viewing 2 posts - 1 through 2 (of 2 total)
  • #139697

    Psychological line (PSY), as an indicator, is the ratio of the number of
    rising periods over the total number of periods. It reflects the buying
    power in relation to the selling power.

    If PSY is above 50%, it indicates that buyers are in control. Likewise,
    if it is below 50%, it indicates the sellers are in control. If the PSY
    moves along the 50% area, it indicates balance between the buyers and
    sellers and therefore there is no direction movement for the market.

    May I seek your assistance in converting the following tradingview code to prorealcode?

    // Psychological line (PSY), as an indicator, is the ratio of the number of
    // rising periods over the total number of periods. It reflects the buying
    // power in relation to the selling power.
    //
    // If PSY is above 50%, it indicates that buyers are in control. Likewise,
    // if it is below 50%, it indicates the sellers are in control. If the PSY
    // moves along the 50% area, it indicates balance between the buyers and
    // sellers and therefore there is no direction movement for the market.
    ////////////////////////////////////////////////////////////
    study(title=”Psychological line”)
    Length = input(20, minval=1)
    xPSY = sum(close > close[1],Length) / Length * 100
    clr = iff(xPSY >= 50, green, red)
    p1 = plot(50, color=black, title=”0″)
    p2 = plot(xPSY, color=blue, title=”PSY”)
    fill(p1, p2, color=clr)

     

    #139716

    There you go:

    you can set colours with its properties.

     

     

Viewing 2 posts - 1 through 2 (of 2 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login