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

Coloring Based on Price Action

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

    Coloring Based on Price Action

    hey I'm trying to make an indicator based on whole number pips + price action and then using then coloring the background accordingly.

    I don't know how to set the whole pip numbers as the target. If I was using a swing high/low I know how to do that based on the swing indicator. I basically want to color the chart every time price moves through a whole pip number.

    If it breaks above closes above a whole number pip background goes green, if it breaks below closes below a whole number chart goes red. I just don't know how to set the targets as the whole pip numbers.

    #2
    Originally posted by matkiefer View Post
    ... if it breaks above closes above a whole number pip background goes green, if it breaks below closes below a whole number chart goes red. I just don't know how to set the targets as the whole pip numbers.
    The entire chart's color changes, or just the bar on which the condition occurs?

    Comment


      #3
      Either Or, it would be nice if the whole chart did, I know I can use

      if { such and such happens
      BackColor = Color.Whatever }

      I just don't know how to make it happen when the bar is breaking above / closing about a whole number pip that's user defined. Like every 5 ticks starting a 0.0 basically or every 10 ticks starting at 0.0 kind of thing

      Comment


        #4
        Hello matkiefer,

        Thank you for your note.

        You could use the % operator to check if the close is on a whole number.

        For example, every time price Closes on a whole number it will paint the background green.

        if (Close[0] % 1 == 0)
        {
        BackColor = Color.Green;
        }
        CameronNinjaTrader Customer Service

        Comment


          #5
          How would I check it if price is already within that whole number though?

          Comment


            #6
            Originally posted by matkiefer View Post
            Either Or, it would be nice if the whole chart did, I know I can use

            if { such and such happens
            BackColor = Color.Whatever }

            I just don't know how to make it happen when the bar is breaking above / closing about a whole number pip that's user defined. Like every 5 ticks starting a 0.0 basically or every 10 ticks starting at 0.0 kind of thing
            Code:
            double definedLevel = someValue; //may want to make this into a parameter?
            Code:
            if (Close[0] > definedLevel && Open[0] < definedLevel)
            {
            ChartControl.BackColor = Color.LightBlue;
            }
            if (Close[0] < definedLevel && Open[0] > definedLevel)
            {
            ChartControl.BackColor = Color.Gold;
            }

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by rtwave, 04-12-2024, 09:30 AM
            4 responses
            29 views
            0 likes
            Last Post rtwave
            by rtwave
             
            Started by yertle, Yesterday, 08:38 AM
            7 responses
            28 views
            0 likes
            Last Post yertle
            by yertle
             
            Started by bmartz, 03-12-2024, 06:12 AM
            2 responses
            21 views
            0 likes
            Last Post bmartz
            by bmartz
             
            Started by funk10101, Today, 12:02 AM
            0 responses
            6 views
            0 likes
            Last Post funk10101  
            Started by gravdigaz6, Yesterday, 11:40 PM
            1 response
            9 views
            0 likes
            Last Post NinjaTrader_Manfred  
            Working...
            X