Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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.
    JesseNinjaTrader Customer Service

    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 GussJ, 03-04-2020, 03:11 PM
      16 responses
      3,279 views
      0 likes
      Last Post Leafcutter  
      Started by WHICKED, Today, 12:45 PM
      2 responses
      19 views
      0 likes
      Last Post WHICKED
      by WHICKED
       
      Started by Tim-c, Today, 02:10 PM
      1 response
      8 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by Taddypole, Today, 02:47 PM
      0 responses
      5 views
      0 likes
      Last Post Taddypole  
      Started by chbruno, 04-24-2024, 04:10 PM
      4 responses
      51 views
      0 likes
      Last Post chbruno
      by chbruno
       
      Working...
      X