Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Up / Down Indicator Coloring

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

    Up / Down Indicator Coloring

    I am trying to plot an indicator with acontinuous line that changes toan upcolor when the currentindicator value is above the previousindicator valueand conversely for the down color. So I haveadded two plots and use the plot values in a dataseries toset the two plots as follows:

    Code:
    // Determine Color forPlotLine 
    if (Plot_Value[0] >= Plot_Value[1]) 
    {
     Plot_Line_Up.Set(Plot_Value[0]); 
    } 
    else if (Plot_Value[0] < Plot_Value[1]) 
    {
     Plot_Line_Dn.Set(Plot_Value[0]); 
    }
    However, when I examine the plots on the chart, I see the colors change but there is agap in the line plot where the plot changes color.I see there is aBarColor and BackColor methods for this purpose but anything forplots?
    Is there a straighforward way to accommodate dynamic color modificationstoa line plotstyle without the need to mind the gap?


    Regards,

    Whitmark


    whitmark
    NinjaTrader Ecosystem Vendor - Whitmark Development

    #2
    imported post

    This should give you what you want. There may be some intersects where lines overlap. Also, you can use the Rising() and Falling() methods.

    if (Rising(Plot_Value))
    // Do something

    Ray






    // Determine Color forPlotLine
    if (Plot_Value[0] >= Plot_Value[1])
    {
    Plot_Line_Up.Set(1, Plot_Value[1]);
    Plot_Line_Up.Set(Plot_Value[0]);
    }
    else if (Plot_Value[0] < Plot_Value[1])
    {
    Plot_Line_Dn.Set(1, Plot_Value[1]);
    Plot_Line_Dn.Set(Plot_Value[0]);
    }

    RayNinjaTrader Customer Service

    Comment


      #3
      imported post

      Thanks Ray, that worked well.

      Regarding the overlaps, is there a way to code the plots tocustomize 1) their layering on the chart and 2) the sequence they appear in the indicator dialog box?

      Regards,

      Whitmark
      whitmark
      NinjaTrader Ecosystem Vendor - Whitmark Development

      Comment


        #4
        imported post

        You are welcome.

        We do not have layering support at this time. I believe that plots lists in the Indicator dialog are alphabetically ordered. I will check this and report back if this is not the case.

        Ray
        RayNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by bill2023, Yesterday, 08:51 AM
        8 responses
        43 views
        0 likes
        Last Post bill2023  
        Started by yertle, Today, 08:38 AM
        6 responses
        25 views
        0 likes
        Last Post ryjoga
        by ryjoga
         
        Started by algospoke, Yesterday, 06:40 PM
        2 responses
        24 views
        0 likes
        Last Post algospoke  
        Started by ghoul, Today, 06:02 PM
        3 responses
        16 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by jeronymite, 04-12-2024, 04:26 PM
        3 responses
        46 views
        0 likes
        Last Post jeronymite  
        Working...
        X