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

Update order

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

    Update order

    If I enter a limit order (in a strategy) and want to update the price, do I need to have assigned a name to the order? How do I do that and are there any examples to view?

    #2
    Hello malcolm,

    Thanks for your post.

    No, you do not need a name. If a limit order has not yet been filled and you submit a limit order at a different price, the price will be adjusted.

    Here is a quick example to demonstrate:

    if ((State == State.Realtime)
    && (Doitonce == true)) // Doitonce is a bool that is initially set to true
    {
    EnterLongLimit(Convert.ToInt32(DefaultQuantity), (Low[0] + (-10 * TickSize)) , ""); // this is the initial order 10 ticks below the low of the just closed bar, done once
    Doitonce = false;
    }

    // Set 2
    if (Doitonce == false)
    {
    EnterLongLimit(Convert.ToInt32(DefaultQuantity), (Low[0] + (-20 * TickSize)) , ""); // This adjusts the same order to 20 ticks below the low and will be different price on each new bar
    }



    Note: If you did use a signal name you would need to use the same signal name to update the same order. Same example but with a signal name:

    if ((State == State.Realtime)
    && (Doitonce == true)) // Doitonce is a bool that is initially set to true
    {
    EnterLongLimit(Convert.ToInt32(DefaultQuantity), (Low[0] + (-10 * TickSize)) , "Test"); // this is the initial order 10 ticks below the low of the just closed bar, done once
    Doitonce = false;
    }

    // Set 2
    if (Doitonce == false)
    {
    EnterLongLimit(Convert.ToInt32(DefaultQuantity), (Low[0] + (-20 * TickSize)) , "Test"); // This adjusts the same order to 20 ticks below the low and will be different price on each new bar
    }
    Paul H.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by andrewtrades, Today, 04:57 PM
    1 response
    8 views
    0 likes
    Last Post NinjaTrader_Manfred  
    Started by chbruno, Today, 04:10 PM
    0 responses
    6 views
    0 likes
    Last Post chbruno
    by chbruno
     
    Started by josh18955, 03-25-2023, 11:16 AM
    6 responses
    436 views
    0 likes
    Last Post Delerium  
    Started by FAQtrader, Today, 03:35 PM
    0 responses
    7 views
    0 likes
    Last Post FAQtrader  
    Started by rocketman7, Today, 09:41 AM
    5 responses
    19 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Working...
    X