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, 05-11-2026, 05:56 AM
      0 responses
      56 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 05-10-2026, 08:12 PM
      0 responses
      33 views
      0 likes
      Last Post CarlTrading  
      Started by Hwop38, 05-04-2026, 07:02 PM
      0 responses
      195 views
      0 likes
      Last Post Hwop38
      by Hwop38
       
      Started by CaptainJack, 04-24-2026, 11:07 PM
      0 responses
      359 views
      0 likes
      Last Post CaptainJack  
      Started by Mindset, 04-21-2026, 06:46 AM
      0 responses
      280 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Working...
      X