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

Change SL/TP size in chart and transfer to strategy logic

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

    Change SL/TP size in chart and transfer to strategy logic

    Hi, i would like to change the qty of an order from the chart manual, after it has been placed by a strategy. How can i best read out this new value in the strategy?
    Would that work best in OnOrderUpdate() with store the "quantity" in a variable, or is there another way?

    Click image for larger version

Name:	Screenshot_2.jpg
Views:	246
Size:	18.0 KB
ID:	1129213​​


    sidlercom80
    NinjaTrader Ecosystem Vendor - Sidi Trading

    #2
    Hello sidlercom80,

    This would not be able to be done by using a Strategy, that will only see updates it makes to the orders. Any manual changes would not be observed by the script. You could use an indicator with the addon account to do this type of interaction. Watching the account directly would let you observe all order events like manual changes. https://ninjatrader.com/support/help...ount_class.htm

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Jesse View Post
      Hello sidlercom80,

      This would not be able to be done by using a Strategy, that will only see updates it makes to the orders. Any manual changes would not be observed by the script. You could use an indicator with the addon account to do this type of interaction. Watching the account directly would let you observe all order events like manual changes. https://ninjatrader.com/support/help...ount_class.htm

      I look forward to being of further assistance.
      Hi _Jesse, I use my own PositionUpdate which is handled by the OnOrderUpdate() method, so I can't access the internal strategy position, or did I get something wrong?

      From another post discussed with _Jim: you do not have to worry about the strategy position stating it is out of sync because the strategy is not following the internal strategy position. It would be following the Position object we created within the strategy, that is updated with OrderUpdate events.

      https://ninjatrader.com/support/foru...kers-api/page2
      sidlercom80
      NinjaTrader Ecosystem Vendor - Sidi Trading

      Comment


        #4
        Hello sidlercom80,

        The comments Jim provided are for a different subject, that relates to how the override is called in relation to how the broker provides that information.

        OnOrderUpdate is not called for manual orders or manual changes, you would need to avoid using a strategy to execute this type of goal. Strategy overrides are based on the changes which the strategy makes and not what you are doing outside of the strategy.

        If you want to make a tool that works with manual changes you could use an indicator for that purpose and the addon account to work with the manual orders/events/changes. Strategies are generally intended to work for you and without your interaction based on its virtual information.

        Please let me know if I may be of additional assistance.




        JesseNinjaTrader Customer Service

        Comment


          #5
          Hi _Jesse, I only need the changes for already submitted orders and not for a new order. My solution is:
          Code:
          protected override void OnOrderUpdate(...) 
          //OrderState Working
          if (orderState == OrderState.Working)
          {
          targetPrice = limitPrice;
          quantityTP = quantity;
          }
          sidlercom80
          NinjaTrader Ecosystem Vendor - Sidi Trading

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by r68cervera, Today, 05:29 AM
          0 responses
          2 views
          0 likes
          Last Post r68cervera  
          Started by geddyisodin, Today, 05:20 AM
          0 responses
          3 views
          0 likes
          Last Post geddyisodin  
          Started by JonesJoker, 04-22-2024, 12:23 PM
          6 responses
          35 views
          0 likes
          Last Post JonesJoker  
          Started by GussJ, 03-04-2020, 03:11 PM
          12 responses
          3,239 views
          0 likes
          Last Post Leafcutter  
          Started by AveryFlynn, Today, 04:57 AM
          0 responses
          6 views
          0 likes
          Last Post AveryFlynn  
          Working...
          X