Change entire background color on trigger

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #169633 quote
    RubberToeRubberToe
    Participant
    Average

    Can I change the entire background color on an indicator trigger?  Like 0=red, 1=green?

    #169634 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    This a custom version of RSI:

    MyRSI = Rsi[14](close)
    if MyRSI >= 50  THEN
       backgroundcolor(0,255,0,20)
    ELSE
       backgroundcolor(255,0,0,30)
    ENDIF
    RETURN MyRSI AS "Rsi"
    #169646 quote
    NicolasNicolas
    Keymaster
    Legend
    #195890 quote
    WolfWolf
    Participant
    New

    Hi Roberto,

    Is there a way to change colour on chart based on price rather than an indicator?

    Thanks in advance

    W 🙂

    #195943 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    Yes:

    If close > X then
       //set a background colour
    Else
       //set a different background colour
    Endif
    #196007 quote
    WolfWolf
    Participant
    New

    Hi Roberto,

    I am really bad with coding, I wonder if you can help me.

    While trading on a 5 min chart using Heikin Ashi candlesticks, I would like to plot on chart a background color that matches the color of the price candle sticks as they form..  is there a way to achieve this or at least plot the background matching the colour of previous candle color closure?

     

    Thanks a lot

     

    W 🙂

    #196014 quote
    JSJS
    Participant
    Master
    //Heikin Ashi
    
    If BarIndex = 0 then
    HAClose = TotalPrice
    HAOpen = (Open + Close)/2
    Else
    HAClose = TotalPrice
    HAOpen = (HAOpen[1] + HAClose[1])/2
    EndIf
    
    If HAClose >= HAOpen then
    BackGroundColor(0,255,0,50)
    Else
    BackGroundColor(255,0,0,50)
    EndIf
    Return
    
    Wolf and robertogozzi thanked this post
    Schermafbeelding-2022-06-24-om-15.38.21.png Schermafbeelding-2022-06-24-om-15.38.21.png
    #196018 quote
    WolfWolf
    Participant
    New

    thank you ! 🙂

    #196027 quote
    JSJS
    Participant
    Master

    Hi @Wolf,

    The above is only for Heikin Ashi because, as you probably know, the calculations for HA are different than for the “normal” candles.

    #196049 quote
    WolfWolf
    Participant
    New
    @JS Sure, thanks a million and have a great weekend! 🙂
Viewing 10 posts - 1 through 10 (of 10 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

Change entire background color on trigger


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
RubberToe @rubbertoe Participant
Summary

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

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