• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

change color of line based on indicator

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

    change color of line based on indicator

    hi,
    running indicator 1, i would like to change the colors of the lines (painted from indicator 1), based on the values from indicator 2.
    i assume it is possible, but how can this be done?
    thx

    #2
    Hi Tradexxx, thanks for your post.

    If indicator 2 has a public plot or Series object then you can make an instance of indicator 2 in indicator 1. See the SampleMACrossover as an example. That strategy initializes two SMA indicators. I would recommend using RemoveDrawObject() to remove the old line and re-draw it with a different color.
    https://ninjatrader.com/support/help...drawobject.htm

    Please let me know if I can assist any further.
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      hello ChrisL, thank you for your post.

      i don't understand what you mean by this.
      imagine indicator 1 is ZIGZAG indicator.
      and indicator 2 is MACD.
      i would like to color the lines from ZIGZAG depending on result of MACD.
      something like MACD Diff < 0 then draw ZIGZAG red and in case MACD Diff > 0 then draw in green.
      is this possible?
      why do i need to remove DrawObject?
      thank you
      Last edited by Tradexxx; 03-27-2020, 12:03 AM.

      Comment


        #4
        Hi Tradexxx, thanks for your patience.

        The ZigZag indicator would be a little more difficult to manipulate because its Value[] array for the plot is sparse (it gets updates at random points in the data). One could change the back brush of the chart, but It would take a bit more investigation to find how the ZigZag plot itself (specifically PlotBrushes) can be changed based on this condition.

        I've attached an example for review.

        Attached Files
        Chris L.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Fiocco, Today, 05:59 AM
        0 responses
        15 views
        0 likes
        Last Post Fiocco
        by Fiocco
         
        Started by catinabag, Today, 06:09 AM
        0 responses
        6 views
        0 likes
        Last Post catinabag  
        Started by junposlee, Today, 02:59 PM
        0 responses
        1 view
        0 likes
        Last Post junposlee  
        Started by patpat, Yesterday, 11:02 AM
        2 responses
        8 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by jameslee001, Yesterday, 08:09 AM
        1 response
        11 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Working...
        X