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

strategy to close positions

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

    strategy to close positions

    Let's say I wanted to make a strategy that:

    1) monitors the account's open positions (note: positions are not created by the strategy)

    2) closes them based on some calculations the strategy makes

    Is this possible?

    Would it work on Rithmic accounts? what about CQG accounts?

    What if the position was created by another platform on the same rithmic or cqg account? :

    a) would it show up in ninjatrader?

    b) and could it be manipulated the way mentioned above?

    #2
    Hello NinjaCustomer,

    Thanks for the post.

    This is possible but you would not want to use a Strategy specifically for this type of use. The Addon account methods could be used from an indicator or addon to achieve this type of control over the accounts positions. A strategy is intended to be virtualized and trade for you, it is not a good candidate for also having control over the account directly as that could lead to actions that disable it.

    For external positions it would need to exist in the accounts position collection in the platform so this would be something which you would need to try and see if the position is reported in the positions collection. Generally you would need to submit all orders from NinjaTrader to have full control over the situation with NinjaScript. Another way to look at this would be if you can manage the position in the platform the addon methods should generally be able to see that to work with it.




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

    Comment


      #3
      ok so i can make an indicator? I prefer indicators because they let me easily edit inputs and also are easier to develop

      my "manage" do you mean that if i can manipulate these externally created positions through the UI then they should be available to the indicator?

      Comment


        #4
        Hello NinjaCustomer,

        That is correct, you could use the Account class and any of its methods/events from an indicator. The account class deals directly with the account instead of using the virtual values of a strategy.

        By manage I mean if you can see it in the control center positions tab to manage it, such as closing the position, then you should be able to access it in the positions collection from the account.


        If you wanted to give that a try without programming anything you could import the addon sample basic from the link here: https://ninjatrader.com/support/help...t_overview.htm
        After having a position, you could select the account in the addon window and then click "Account positions". If you see the position printed that means the addon account methods were able to see it and work with it.

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

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by r68cervera, Today, 05:29 AM
        0 responses
        3 views
        0 likes
        Last Post r68cervera  
        Started by geddyisodin, Today, 05:20 AM
        0 responses
        6 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,241 views
        0 likes
        Last Post Leafcutter  
        Started by AveryFlynn, Today, 04:57 AM
        0 responses
        7 views
        0 likes
        Last Post AveryFlynn  
        Working...
        X