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 CarlTrading, 03-31-2026, 09:41 PM
      1 response
      72 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      39 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      63 views
      2 likes
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      63 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      53 views
      0 likes
      Last Post CarlTrading  
      Working...
      X