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 NullPointStrategies, Yesterday, 05:17 AM
      0 responses
      65 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      139 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      75 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      45 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      50 views
      0 likes
      Last Post TheRealMorford  
      Working...
      X