Color the background of that Revert Signal indicator

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #95471 quote
    segie
    Participant
    Senior
    //PRC_RevertSignal Three Line Break | indicator
    //22.06.2017
    //Nicolas @ www.prorealcode.com
    //Sharing ProRealTime knowledge
    //translated from Nanotrader
    
    if barindex=1 then //barindex
     if (close >= open) then
      xtrend = 1
      trend = xtrend
      xu = close
      xu1 = open
      xu2 = open
      xu3 = open
      CL = xu
      OP = xu1
      LL = OP
      HH = CL
     else
      xtrend = -1
      trend = xtrend
      xu = close
      xu1 = open
      xu2 = open
      xu3 = open
      CL = xu
      OP = xu1
      LL = CL
      HH = OP
     endif
    else //barindex continue
     if (xtrend = 1) then
      if (close > xu) then
       trend = xtrend
       xu3 = xu2
       xu2 = xu1
       xu1 = xu
       xu = close
       CL = xu
       OP = xu1
       LL = OP
       HH = CL
      elsif (close < xu3) then
       xtrend = -1
       trend = xtrend
       xu = close
       xu2 = xu1
       xu3 = xu1
       CL = xu
       OP = xu1
       LL = CL
       HH = OP
      else
       trend = xtrend
       CL = CL[1]
       OP = OP[1]
       LL = LL[1]
       HH = HH[1]
      endif
     else //xtrend <>1
      if (close > xu3) then
       xtrend = 1
       trend = xtrend
       xu = close
       xu2 = xu1
       xu3 = xu1
       CL = xu
       OP = xu1
       LL = OP
       HH = CL
      elsif (close < xu) then
       trend = xtrend
       xu3 = xu2
       xu2 = xu1
       xu1 = xu
       xu = close
       CL = xu
       OP = xu1
       LL = CL
       HH = OP
      else
       trend = xtrend
       CL = CL[1]
       OP = OP[1]
       LL = LL[1]
       HH = HH[1]
      endif
     endif
    endif
    
    if trend>0 then
     r=0
     g=200
     b=0
    else
     r=200
     g=0
     b=0
    endif
    
    if trend<>trend[1] then
     BACKGROUNDCOLOR(200,200,200)
    endif
    
    RETURN CL coloured (r,g,b), xu3 coloured (r,g,b)

    Hi,

    Can the background column be changed to green for bullish and red for bearish? Code attached

    Regards,

    Segie

    #95475 quote
    Nicolas
    Keymaster
    Master

    Here is the code to color the background according to the trend.

    I made it slightly transparent with alpha set at 100 (range is 0-255) at line 101.

    //PRC_RevertSignal Three Line Break | indicator
    //22.06.2017
    //Nicolas @ www.prorealcode.com
    //Sharing ProRealTime knowledge
    //translated from Nanotrader
    
    if barindex=1 then //barindex
    if (close >= open) then
    xtrend = 1
    trend = xtrend
    xu = close
    xu1 = open
    xu2 = open
    xu3 = open
    CL = xu
    OP = xu1
    LL = OP
    HH = CL
    else
    xtrend = -1
    trend = xtrend
    xu = close
    xu1 = open
    xu2 = open
    xu3 = open
    CL = xu
    OP = xu1
    LL = CL
    HH = OP
    endif
    else //barindex continue
    if (xtrend = 1) then
    if (close > xu) then
    trend = xtrend
    xu3 = xu2
    xu2 = xu1
    xu1 = xu
    xu = close
    CL = xu
    OP = xu1
    LL = OP
    HH = CL
    elsif (close < xu3) then
    xtrend = -1
    trend = xtrend
    xu = close
    xu2 = xu1
    xu3 = xu1
    CL = xu
    OP = xu1
    LL = CL
    HH = OP
    else
    trend = xtrend
    CL = CL[1]
    OP = OP[1]
    LL = LL[1]
    HH = HH[1]
    endif
    else //xtrend <>1
    if (close > xu3) then
    xtrend = 1
    trend = xtrend
    xu = close
    xu2 = xu1
    xu3 = xu1
    CL = xu
    OP = xu1
    LL = OP
    HH = CL
    elsif (close < xu) then
    trend = xtrend
    xu3 = xu2
    xu2 = xu1
    xu1 = xu
    xu = close
    CL = xu
    OP = xu1
    LL = CL
    HH = OP
    else
    trend = xtrend
    CL = CL[1]
    OP = OP[1]
    LL = LL[1]
    HH = HH[1]
    endif
    endif
    endif
    
    if trend>0 then
    r=0
    g=200
    b=0
    else
    r=200
    g=0
    b=0
    endif
    
    BACKGROUNDCOLOR(r,g,b,50)
    
    
    RETURN CL coloured (r,g,b), xu3 coloured (r,g,b)
    segie thanked this post
    threeline-break-revert-signals.png threeline-break-revert-signals.png
    #95479 quote
    segie
    Participant
    Senior

    Looks good. Thank you!

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

Color the background of that Revert Signal indicator


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
segie @segie Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by segie
6 years, 10 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 04/04/2019
Status: Active
Attachments: 1 files
Logo Logo
Loading...