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 Perr0Grande, Today, 08:16 PM
    0 responses
    2 views
    0 likes
    Last Post Perr0Grande  
    Started by elderan, Today, 08:03 PM
    0 responses
    5 views
    0 likes
    Last Post elderan
    by elderan
     
    Started by algospoke, Today, 06:40 PM
    0 responses
    10 views
    0 likes
    Last Post algospoke  
    Started by maybeimnotrader, Today, 05:46 PM
    0 responses
    12 views
    0 likes
    Last Post maybeimnotrader  
    Started by quantismo, Today, 05:13 PM
    0 responses
    7 views
    0 likes
    Last Post quantismo  
    Working...
    X