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 Mindset, 04-21-2026, 06:46 AM
      0 responses
      88 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by M4ndoo, 04-20-2026, 05:21 PM
      0 responses
      135 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by M4ndoo, 04-19-2026, 05:54 PM
      0 responses
      68 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by cmoran13, 04-16-2026, 01:02 PM
      0 responses
      119 views
      0 likes
      Last Post cmoran13  
      Started by PaulMohn, 04-10-2026, 11:11 AM
      0 responses
      69 views
      0 likes
      Last Post PaulMohn  
      Working...
      X