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

Inconsistent Bar coloring

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

    Inconsistent Bar coloring

    In the code, 'dist' is the spread between the bar's high and its low.

    If I set dist to 5, sometimes ir recolors if the high-low is only 5 and sometimes it doesnt. It always recolors when the spread is > 5.

    // Condition set 1
    if (High[0]-Low[0] >= (TickSize*dist)//0.1
    && Close[0] > Open[0])
    {
    BarColor = Color.Lime;
    }

    // Condition set 2
    if (High[0]-Low[0] >= (TickSize*dist) //0.1
    && Close[0] < Open[0])
    {
    BarColor = Color.DeepPink;
    }

    #2
    simpletrades,

    Thank you for your post.

    When the BarColors are not plotting correctly, are you getting any errors on the Log tab of the Control Center? If so, what do these errors report?

    I look forward to assisting you further.
    MatthewNinjaTrader Product Management

    Comment


      #3
      i have not been disconnected this morning and still am connected and i logged in about 8:20am. (I use a 30 sec chart)
      A bar that should have been the deep pink but wasnt (H 1.4350, L 1.4345) closed at 8:49, but the first comment about anything not connection related was 8:49:20 about submitting an order with strategy.
      The first bar that did recolor deep pink was more than 5 ticks and closed 8:57:30 and the first bar that was exactly 5 ticks colored Lime and closed 9:04:30.
      I dont know why, but my log reads nothing beyond 8:57:22 so i cant see anything.

      Comment


        #4
        I kept the log open and entered and cancelled a trade just now at 10:47:38 and 10:47:43 and that showed up and luckily the bar that closed 10:48:00 colored Lime, but the log didnt mention it.

        Comment


          #5
          I still want to know why it didnt work, but i changed the code to read dist/2 and changed the input variable to 9 and now it recolors properly.

          Comment


            #6
            Hello simpletrades,

            Great to hear you found a solution. I would not know why the earlier logic was not working as expected.

            The only way to determine why that was not working is to debugg your code. I would suggest using the Print() function to print the values and compare them to the values you were expected.

            More information on debugging your code and can be found below:

            MatthewNinjaTrader Product Management

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by andrewtrades, Today, 04:57 PM
            1 response
            5 views
            0 likes
            Last Post NinjaTrader_Manfred  
            Started by chbruno, Today, 04:10 PM
            0 responses
            3 views
            0 likes
            Last Post chbruno
            by chbruno
             
            Started by josh18955, 03-25-2023, 11:16 AM
            6 responses
            436 views
            0 likes
            Last Post Delerium  
            Started by FAQtrader, Today, 03:35 PM
            0 responses
            7 views
            0 likes
            Last Post FAQtrader  
            Started by rocketman7, Today, 09:41 AM
            5 responses
            19 views
            0 likes
            Last Post NinjaTrader_Jesse  
            Working...
            X