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

simple bar color change

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

    simple bar color change

    Hello, was just testing something in N7 before N8

    any reason why this code does nothing in N7

    if (((Open[0]) > (Close[0])) || ((Open[0]) < (Close[0]))) {

    BarColorSeries[0] = Color.Empty;

    } else {

    BarColorSeries[0] = Color.Yellow;

    }

    ChartOnly = true and Overlay = true in the Initialise

    obviously i just want to set doji style bars to yellow

    tried BarColor too and that did not work so tried the Series version

    i tried with on bar close = true and false

    there is no plot override

    am i missing something?

    thanks

    #2
    if (Open[0] > Close[0] || Open[0] < Close[0]), easy with the parenthesis, should produce an Empty color unless Open[0] == Close[0].
    What are you seeing?

    Might be simpler to color the doji with if(Open[0] == Close[0])
    eDanny
    NinjaTrader Ecosystem Vendor - Integrity Traders

    Comment


      #3
      thanks but tried that approach open == close but aware of comparing double values in certain situations can have issues which is why i opted for < > check .... so didnt make difference
      seeing no change ...
      the logic above captures the == to situation of open=close but in different way.
      thanks for suggestion ... will run again in debug tomorrow .. but if ninja has any thoughts on recommended approach to BarColor or BarColorSeries ....?
      thanks

      Comment


        #4
        update - on testing further can see now the horizontal line of doji changes color with the above.
        In order to have the wick change as well do i have to do this in a plot override or another series to change? its was so faint that i couldnt see as was expecting the whole candle including wick to change color but this doesnt appear to happen in this instance. Any input?
        thanks

        Comment


          #5
          Use CandleOutlineColor or CandleOutlineColorSeries. Comparing Open[0] to Close[0] will work fine if you refine their doubles. Use Instrument.MasterInstrument.Round2TickSize in this case.
          eDanny
          NinjaTrader Ecosystem Vendor - Integrity Traders

          Comment


            #6
            thanks Danny the CandleOutline... worked ... i did try it before but must have had something else in the way. I do use the Round2TickSize for other things but didnt need in this instance with price.
            thanks for help.

            Comment


              #7
              Hello soulfx,

              Thank you for your note.

              If you were to add the following to your else statement it will color the candle/bar yellow upon a doji as defined by your statement.

              CandleOutlineColor = Color.Yellow;

              Adding to eDanny’s point, you would write the if statement like,

              Code:
              if (Instrument.MasterInstrument.Round2TickSize(Close[0]) == Instrument.MasterInstrument.Round2TickSize(Open[0]))
              {
              DrawArrowUp( "My Up arrow" + CurrentBar, false, 0 , High[0], Color.Lime);	
              }
              Please let us know if you need further assistance.

              Thank you eDanny for your help.
              Alan P.NinjaTrader Customer Service

              Comment


                #8
                Hello i wondered if that was a Draw Arrow trick .. did you mean to write draw arrow in your code snippet?

                Comment


                  #9
                  Hello Soulfx,

                  I was using the arrow to make obvious the Doji points. If you wanted yellow bars you could use,

                  Code:
                  if (Instrument.MasterInstrument.Round2TickSize(Close[0]) == Instrument.MasterInstrument.Round2TickSize(Open[0]))
                  {
                  CandleOutlineColor = Color.Yellow;
                  }
                  Please let us know if you need further assistance.
                  Alan P.NinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by GLFX005, Today, 03:23 AM
                  0 responses
                  1 view
                  0 likes
                  Last Post GLFX005
                  by GLFX005
                   
                  Started by XXtrader, Yesterday, 11:30 PM
                  2 responses
                  11 views
                  0 likes
                  Last Post XXtrader  
                  Started by Waxavi, Today, 02:10 AM
                  0 responses
                  6 views
                  0 likes
                  Last Post Waxavi
                  by Waxavi
                   
                  Started by TradeForge, Today, 02:09 AM
                  0 responses
                  14 views
                  0 likes
                  Last Post TradeForge  
                  Started by Waxavi, Today, 02:00 AM
                  0 responses
                  3 views
                  0 likes
                  Last Post Waxavi
                  by Waxavi
                   
                  Working...
                  X