Conversion of simple bar color indicator from Pinescript to Pro Builder

Forums ProRealTime English forum ProBuilder support Conversion of simple bar color indicator from Pinescript to Pro Builder

Viewing 3 posts - 1 through 3 (of 3 total)
  • #202669

    Hi all,

    In Trading View, I had coloured my bars depending on the close of the bar. In Pinescipt V5, the code looked like this:

     

    indicator(“Bar Color”, overlay=true)

     

    //Bull bar 1/4

    data1 = close > ((high – low) * 0.75) + low

    barcolor(close > ((high – low) * 0.75) + low ? #27af40 : na)

     

    //Bull bar 1/3

    data2 = close > ((high – low) * 0.666) + low and close < ((high – low) * 0.75) + low

    barcolor(close > ((high – low) * 0.666) + low and close < ((high – low) * 0.75) + low? #24532d : na)

     

    //Neutral Bull bar

    data3 = close < (((high – low) * 0.666) + low) and  close > (high – ((high – low) * 0.666)) and close > open

    barcolor(close < (((high – low) * 0.666) + low) and  close > (high – ((high – low) * 0.666)) and close > open? #a5dfb2 : na)

     

    If anyone here can help me convert this code to ProBuilder I would be very grateful.

    Philip

    #202683

    Here is the translated code that color the candlestick accordingly to the conditions. If conditions are not met, then the bar color is the default one of the platform.

     

    #202697

    Thank you for the quick response! It works perfectly.

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

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