Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Change MACD Line color when it cross the Avg

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Change MACD Line color when it cross the Avg

    Hello,

    I am looking to change the macd line from lets say red to green when the macd line cross the macd avg. I want the macd line to stay green for the initial cross candle and then the two candles after. Once there has been 4 candles I want it to go back to red. Is this something that can be done easily?

    #2
    Hello durdcash,

    Thank you for your post.

    This should be possible without too much hassle. I suggest checking out the multi-colored plots reference sample here for an example of changing plot colors when certain conditions are met:
    If you are wanting it to stay green for a set number of candles, you will likely need to record the CurrentBar index when the crossover condition is met in a variable, then add a check if the new CurrentBar is greater than or equal to the saved bar index plus however many bars since the crossover and if so, change the plot to red again.

    Crossovers can be detected with CrossAbove() and CrossBelow():Please let us know if we may be of further assistance.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    647 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    368 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    108 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    571 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    573 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X