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

Resetting a Long Limit?

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

    Resetting a Long Limit?

    I'm having difficulty resetting a long limit. In my code, I set a default profit target, that's a ways off. Then, after I'm in a trade, and after a moderate gain and the market starts to go against my trade, I want to reset the profit target, to get out with my moderate gain. My psuedo-code is:

    SetProfitTarget(12 ticks)
    EnterLongLimit(At current market price)
    ....
    If (Current Gain is at least 4 ticks AND Market starts to go against my trade) {
    ExitLongLimit(At the current market price)
    }

    However, the ExitLongLimit never executes. I can do an ExitLong successfully, but not an ExitLongLimit. The order doesn't complete, until either the ProfitLimit or StopLoss is hit.

    Your thoughts? Thanks,.

    #2
    Hello timmbbo,

    Thanks for opening the thread.

    Can I confirm that you are using the liveUntilCancelled overload for ExitLongLimit()? If you are not using this overload, the order will only be valid for the next bar that the order is placed.

    I will provide reference links to publicly available resources on using this overload.

    ExitLongLimit(int barsInProgressIndex, bool liveUntilCancelled, int quantity, double limitPrice, string signalName, string fromEntrySignal)


    This is further described in the Advanced Order Handling section of the Managed Approach documentation - https://ninjatrader.com/support/help...r_handling.htm

    I would also advise to debug with TraceOrders to monitor and debug your order submissions.

    TraceOrders - https://ninjatrader.com/support/foru...ead.php?t=3627

    If there is anything else I can do to assist, please let me know.
    JimNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by rocketman7, Today, 01:00 AM
    0 responses
    1 view
    0 likes
    Last Post rocketman7  
    Started by wzgy0920, 04-20-2024, 06:09 PM
    2 responses
    27 views
    0 likes
    Last Post wzgy0920  
    Started by wzgy0920, 02-22-2024, 01:11 AM
    5 responses
    32 views
    0 likes
    Last Post wzgy0920  
    Started by wzgy0920, 04-23-2024, 09:53 PM
    2 responses
    74 views
    0 likes
    Last Post wzgy0920  
    Started by Kensonprib, 04-28-2021, 10:11 AM
    5 responses
    193 views
    0 likes
    Last Post Hasadafa  
    Working...
    X