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 futtrader, 04-21-2024, 01:50 AM
            4 responses
            41 views
            0 likes
            Last Post futtrader  
            Started by Option Whisperer, Today, 09:55 AM
            1 response
            12 views
            0 likes
            Last Post bltdavid  
            Started by port119, Today, 02:43 PM
            0 responses
            8 views
            0 likes
            Last Post port119
            by port119
             
            Started by Philippe56140, Today, 02:35 PM
            0 responses
            7 views
            0 likes
            Last Post Philippe56140  
            Started by 00nevest, Today, 02:27 PM
            0 responses
            7 views
            0 likes
            Last Post 00nevest  
            Working...
            X