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

How to check last bar's BackColor?

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

    How to check last bar's BackColor?

    Is there a way to reference previous bars backcolor. Try to play a sound if current backcolor is different than the last backcolor. Thanks in advance.

    #2
    billy822,

    Unfortunately not. If you want to see the bar color you can just check the conditions. If close > open then it is green. If close < open then it is red.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Another option you could try: Within your strategy, you could record the conditions in a DataSeries or StringSeries. When the conditions call for a bar color change, also set the series with a flag to indicate the status.

      If desired to have the color condition continue after the change (until the next change), you might use a variable which is zeroed at the change and then increments until the next change so that each series element may be set accordingly.

      OregonSun

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Belfortbucks, Today, 09:29 PM
      0 responses
      3 views
      0 likes
      Last Post Belfortbucks  
      Started by zstheorist, Today, 07:52 PM
      0 responses
      7 views
      0 likes
      Last Post zstheorist  
      Started by pmachiraju, 11-01-2023, 04:46 AM
      8 responses
      150 views
      0 likes
      Last Post rehmans
      by rehmans
       
      Started by mattbsea, Today, 05:44 PM
      0 responses
      6 views
      0 likes
      Last Post mattbsea  
      Started by RideMe, 04-07-2024, 04:54 PM
      6 responses
      33 views
      0 likes
      Last Post RideMe
      by RideMe
       
      Working...
      X