Change entire background color on trigger

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

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

    #169634 quote
    robertogozzi
    Moderator
    Master

    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
    Nicolas
    Keymaster
    Master
    #195890 quote
    Wolf
    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
    robertogozzi
    Moderator
    Master

    Yes:

    If close > X then
       //set a background colour
    Else
       //set a different background colour
    Endif
    #196007 quote
    Wolf
    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
    JS
    Participant
    Senior
    //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
    #196018 quote
    Wolf
    Participant
    New

    thank you ! 🙂

    #196027 quote
    JS
    Participant
    Senior

    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
    Wolf
    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.

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 Wolf
3 years, 7 months ago.

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