Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Manage Strategy Positions through custom Buttons

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

    Manage Strategy Positions through custom Buttons

    Hi,

    I have found some useful information in creating custom buttons in the Chart Trader panel etc and have successfully created a button to Flatten a position, however when creating a new button to manage existing orders i run into difficulty and does not work the same way. Is it possible to manage orders using ChangeOrder() the same way as im using CancelOrder() and submitOrderUnmanaged(Market)?

    The below example simply does not work in the same way? What am i doing wrong here?

    Code:
    protected void Button1Click(object sender, RoutedEventArgs e)
    {
    ChangeOrder(Stoploss, Position.Quantity, 0, Low[1]));
    }

    #2
    Hello,
    Thank you for the post.

    This is likely because you are not using a TriggerCustomEvent around the ChangeOrder code. The button event is not a NinjaScript event so the properties like Low and Position make no sense in that context.





    Code:
    protected void Button1Click(object sender, RoutedEventArgs e) {
    TriggerCustomEvent(o =>
    {
    //Put your NinjaScript code here
    
    ChangeOrder(Stoploss, Position.Quantity, 0, Low[1]));
    
    }, null);
    }
    I look forward to being of further assistance.

    Comment


      #3
      Thankyou Jesse! This makes sense now i have seen TriggerCustomEvent() but didn't realise its use till now!
      Thanks for pointer will figure this out now.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by CarlTrading, 03-31-2026, 09:41 PM
      1 response
      43 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      21 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      30 views
      1 like
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      50 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      40 views
      0 likes
      Last Post CarlTrading  
      Working...
      X