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 benmarkal, Yesterday, 12:52 PM
      3 responses
      22 views
      0 likes
      Last Post NinjaTrader_Gaby  
      Started by helpwanted, Today, 03:06 AM
      1 response
      17 views
      0 likes
      Last Post sarafuenonly123  
      Started by Brevo, Today, 01:45 AM
      0 responses
      11 views
      0 likes
      Last Post Brevo
      by Brevo
       
      Started by aussugardefender, Today, 01:07 AM
      0 responses
      6 views
      0 likes
      Last Post aussugardefender  
      Started by pvincent, 06-23-2022, 12:53 PM
      14 responses
      244 views
      0 likes
      Last Post Nyman
      by Nyman
       
      Working...
      X