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 kempotrader, Today, 08:56 AM
    0 responses
    6 views
    0 likes
    Last Post kempotrader  
    Started by kempotrader, Today, 08:54 AM
    0 responses
    4 views
    0 likes
    Last Post kempotrader  
    Started by mmenigma, Today, 08:54 AM
    0 responses
    2 views
    0 likes
    Last Post mmenigma  
    Started by halgo_boulder, Today, 08:44 AM
    0 responses
    1 view
    0 likes
    Last Post halgo_boulder  
    Started by drewski1980, Today, 08:24 AM
    0 responses
    4 views
    0 likes
    Last Post drewski1980  
    Working...
    X