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

multiple TPs, dynamic Quantity

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

    multiple TPs, dynamic Quantity

    Hi,

    im a beginner to NinjaTrader7 programming and im having a question:

    is it possible to have a position with a quantity of 4 contracts and lets say i have the same SL with 10 Ticks for all, but contract number 1 has a TP of 8 Ticks and the left 3 contracts have a TP of 16 ticks.

    Is it possible to do that in managed mode?

    What would be the basic algorithm?

    I tried to program this algorithm, but i have many problems with that and im pretty far from the result.

    Best regards.

    #2
    Hello maynn,

    Welcome to the forums!

    I see that you are referencing NinjaTrader 7 but have opened this post in the NinjaTrader 8 forum. I have created a demonstration for how you can set this up in the Strategy Wizard in NinjaTrader 7. The same can be done in the Strategy Builder in NinjaTrader 8.

    Demo - https://www.screencast.com/t/GKCbIzfalSc

    The Strategy Wizard and Strategy Builder create NinjaScript code following the managed Approach. Those order methods and their rules can be referenced below.

    NT7 Managed Approach -


    NT8 Managed Approach - https://ninjatrader.com/support/help...d_approach.htm

    I will also post links to the Strategy Wizard and Strategy Builder tutorials for further reference on how this tool can be used. I will suggest to use the Wizard or Builder to create a strategy, and then use the View Code button to observe the resulting code.

    Strategy Wizard 301 - https://www.youtube.com/watch?v=FmBiNYsf1e8

    Strategy Builder 301 - https://www.youtube.com/watch?v=HCyt90GAs9k

    Please let me know if I may be of further assistance.
    JimNinjaTrader Customer Service

    Comment


      #3
      Hello,

      thank you very much for your advice. I saw this possibility, but with this kind of solution, you would have multiple entries. But I only want to have one entry.

      Best regards

      Comment


        #4
        Hello maynn,

        Yes this would not be possible with the SetProfitTarget() or SetStopLoss() methods. I would then advise to create your own logic to place exit orders after you have entered.

        Order methods exist for placing Market Orders, Market-If-Touched Orders, Limit Orders, Stop Orders, and Stop Limit Orders. These methods exist in the managed approach to exit positions as well and they are available in the Strategy Builder and Strategy Wizard. You may use the links in my previous thread to reference these different order methods.

        I would advise to use these different order methods to manage your positions instead. I would also suggest to look into using Position.MarketPosition to control your logic to tell when you are in a flat, long or short position.

        Position.MarketPosition NT7 - https://ninjatrader.com/support/help...etposition.htm

        Position.MarketPosition NT8 - https://ninjatrader.com/support/help...etposition.htm

        If you have any additional questions, could you verify if you are using NinjaTrader 7 or NinjaTrader 8?
        JimNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by kujista, Today, 06:23 AM
        4 responses
        14 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by traderqz, Yesterday, 09:06 AM
        2 responses
        16 views
        0 likes
        Last Post traderqz  
        Started by traderqz, Today, 12:06 AM
        3 responses
        6 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by RideMe, 04-07-2024, 04:54 PM
        5 responses
        28 views
        0 likes
        Last Post NinjaTrader_BrandonH  
        Started by f.saeidi, Today, 08:13 AM
        1 response
        8 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Working...
        X