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 popecapllc, 08-09-2023, 07:42 PM
    9 responses
    1,362 views
    0 likes
    Last Post BartMan
    by BartMan
     
    Started by ETFVoyageur, 04-30-2024, 02:04 PM
    11 responses
    101 views
    0 likes
    Last Post ETFVoyageur  
    Started by bubblegum, 03-18-2024, 10:41 AM
    3 responses
    46 views
    0 likes
    Last Post vjsworld  
    Started by JamesK1, Today, 02:48 PM
    1 response
    13 views
    0 likes
    Last Post JamesK1
    by JamesK1
     
    Started by llanqui, Today, 03:51 PM
    0 responses
    13 views
    0 likes
    Last Post llanqui
    by llanqui
     
    Working...
    X