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 Taddypole, 04-26-2024, 02:47 PM
            1 response
            10 views
            0 likes
            Last Post NinjaTrader_Eduardo  
            Started by futtrader, 04-21-2024, 01:50 AM
            6 responses
            58 views
            0 likes
            Last Post futtrader  
            Started by sgordet, Today, 11:48 AM
            0 responses
            4 views
            0 likes
            Last Post sgordet
            by sgordet
             
            Started by Trader146, Today, 11:41 AM
            0 responses
            5 views
            0 likes
            Last Post Trader146  
            Started by jpapa, 04-23-2024, 07:22 AM
            2 responses
            19 views
            0 likes
            Last Post rene69851  
            Working...
            X