Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How do I "reset" a button based on a boolean value from a different class?

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

    How do I "reset" a button based on a boolean value from a different class?

    I have a singleton that manages some state for some strategies. I'm trying to get a button in Chart Trader to be able to select the direction of a trade, which sets a boolean value in the singleton. The problem is the values gets reset after a trade exits, but the buttons don't "reset". For example, I click a button and it changes to blue and it sets the boolean value. When a trade exits it is still blue, but I want it to change back to being transparent. I tried to use Dispatcher.Invoke() in the OnBarUpdate() to check if different values in the singleton changes, but that doesn't seem to be the way to go about it since it slows down the software. Should I be looking elsewhere to check for the value in the singleton to reset the button back?
    Last edited by walley; 08-28-2023, 04:56 AM.

    #2
    Hello walley,

    See lines 176 through 179 and 195 through 200 in the ChartOrderButtonsStrategyExample linked below.
    https://forum.ninjatrader.com/forum/...ns#post1126818
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thanks for the help!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      580 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      336 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      103 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      554 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      552 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X