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 sidlercom80, 10-28-2023, 08:49 AM
    166 responses
    2,234 views
    0 likes
    Last Post sidlercom80  
    Started by thread, Yesterday, 11:58 PM
    0 responses
    1 view
    0 likes
    Last Post thread
    by thread
     
    Started by jclose, Yesterday, 09:37 PM
    0 responses
    6 views
    0 likes
    Last Post jclose
    by jclose
     
    Started by WeyldFalcon, 08-07-2020, 06:13 AM
    10 responses
    1,414 views
    0 likes
    Last Post Traderontheroad  
    Started by firefoxforum12, Yesterday, 08:53 PM
    0 responses
    11 views
    0 likes
    Last Post firefoxforum12  
    Working...
    X