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

Set Quantity in SetProfitTarget and SetStopLoss?

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

    Set Quantity in SetProfitTarget and SetStopLoss?

    In my trading, I am using two positions. I enter both at the same time, both with the same stoploss. One position has a target, the other does not and is considered a runner. Once the target is filled, I typically modify the stop for the remaining position.

    I currently use two different orders to do this. So, when I enter the market, I place two trades, back to back. This works, but I pay double the commission per signal.

    Is there a way to set a quantity in SetProfitTarget, so that can enter once, and have the target affect only 1/2 of my order quantity?

    I know I could do the target and stoploss with exit limit and stop orders, but this significantly complicates the logic.

    Is there a simpler implementation using the managed SetStopLoss/SetProfitTarget functions?

    Thanks!

    #2
    Hello Serac,

    SetProfitTarget() will automatically set the order quantity so you would not be able to set the order quantity. You may want to use an ATM Strategy inside your Strategy to be able to set up to 3 different Profit Targets so that you can leave one a runner.


    There is a sample of using ATM strategies located in Tools > Edit NinjaScript > Strategy > SampleATMStrategy.
    JCNinjaTrader Customer Service

    Comment


      #3
      This looks interesting. I was unaware that I could control an ATM strategy automatically.

      Would this really be simpler and/or more elegant than foregoing using SetProfitTarget in a strategy and using ExitLongLimit with LiveUntilCanceled = True?

      Comment


        #4
        Hello Serac,

        I believe it is yes. It keeps everything structured and handled by NinjaTrader so you do not have to worry about writing additional lines of code.
        JCNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by ETFVoyageur, 05-07-2024, 07:05 PM
        10 responses
        71 views
        0 likes
        Last Post ETFVoyageur  
        Started by Zeezee, Today, 12:45 PM
        3 responses
        14 views
        0 likes
        Last Post NinjaTrader_ChristopherJ  
        Started by ldanenberg, Today, 03:19 PM
        0 responses
        2 views
        0 likes
        Last Post ldanenberg  
        Started by TheTradingMantis, 01-19-2023, 02:05 AM
        42 responses
        914 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by _Zero_, 04-10-2020, 03:21 PM
        144 responses
        7,896 views
        6 likes
        Last Post NinjaTrader_ChelseaB  
        Working...
        X