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 SherwoodJP, 06-04-2024, 06:55 AM
            4 responses
            42 views
            0 likes
            Last Post SherwoodJP  
            Started by dibDab, 11-09-2022, 09:04 AM
            13 responses
            119 views
            0 likes
            Last Post MisterTee  
            Started by LordNoah, Today, 06:15 PM
            0 responses
            4 views
            0 likes
            Last Post LordNoah  
            Started by oneybuchi2, Today, 03:48 PM
            2 responses
            19 views
            0 likes
            Last Post oneybuchi2  
            Started by samish18, Today, 04:59 PM
            0 responses
            8 views
            0 likes
            Last Post samish18  
            Working...
            X