Announcement

Collapse
No announcement yet.

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 sjsj2732, Yesterday, 04:31 AM
            0 responses
            38 views
            0 likes
            Last Post sjsj2732  
            Started by NullPointStrategies, 03-13-2026, 05:17 AM
            0 responses
            287 views
            0 likes
            Last Post NullPointStrategies  
            Started by argusthome, 03-08-2026, 10:06 AM
            0 responses
            289 views
            0 likes
            Last Post argusthome  
            Started by NabilKhattabi, 03-06-2026, 11:18 AM
            0 responses
            134 views
            1 like
            Last Post NabilKhattabi  
            Started by Deep42, 03-06-2026, 12:28 AM
            0 responses
            95 views
            0 likes
            Last Post Deep42
            by Deep42
             
            Working...
            X