• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Avoid multiple orders

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

    Avoid multiple orders

    Hello,

    I just found the function EnterLongLimit here in the forum and in the helpGuides.

    To better understand the mechanism, how can I avoid that on each bar my Strategy fires a new order to the order execution network and how can I double-check which orders are already in place before I enter a new order or replace the current order that has been already sent to the system by the Strategy one or more bars before?

    Best regards
    Gerik


    #2
    Hello Gerik ,

    Thank you for the post .

    To know which orders are already in place generally requires that you track that yourself. You can observe the current position information or also store order information to track where you script is currently at.

    EnterLongLimit is actually made so that it should be called for each bar where it should stay active. It would not make a new order unless you provided a new unique signal name each time it is called.

    By default with the managed order handling a limit type order will be cancelled after 1 bar if you don't call this method again. Alternatively in manual coding you can use IsLiveUntilCancelled with these methods to keep them active and only call the method once to submit it.

    You can see the different ways this method can be called in the help guide:
    https://ninjatrader.com/support/help...rlonglimit.htm

    Code:
    EnterLongLimit(double limitPrice)
    EnterLongLimit(double limitPrice, string signalName)
    EnterLongLimit(int quantity, double limitPrice)
    EnterLongLimit(int quantity, double limitPrice, string signalName)
    The following method variation is for experienced programmers who fully understand Advanced Order Handling concepts:
    EnterLongLimit(int barsInProgressIndex, bool isLiveUntilCancelled, int quantity, double limitPrice, string signalName)
    And you can see all of the order handling methods here:
    https://ninjatrader.com/support/help...d_approach.htm



    You can find a sample of working with order objects in the following link:

    https://ninjatrader.com/support/help...and_onexec.htm


    Storing your orders to variables allows you to keep track of what orders your script has open and what states they are in. This sample provides some explanation of how to "catch" orders in the OnOrderUpdate/OnExecutionUpdate overrides and then track or use them later on. The same would happen for entry orders you use, you could "catch" the order after its submitted to further control your logic or know it is active.


    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by superkolleech, Today, 12:46 AM
    2 responses
    12 views
    0 likes
    Last Post superkolleech  
    Started by davidwade, Today, 02:51 AM
    0 responses
    3 views
    0 likes
    Last Post davidwade  
    Started by aviat72, 04-26-2020, 09:41 PM
    10 responses
    92 views
    0 likes
    Last Post kissandfly  
    Started by healthooa, Today, 01:28 AM
    0 responses
    8 views
    0 likes
    Last Post healthooa  
    Started by harjinderjit, Yesterday, 08:24 PM
    0 responses
    20 views
    0 likes
    Last Post harjinderjit  
    Working...
    X