Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Provide instrument name in the market entry order.

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

    Provide instrument name in the market entry order.

    I am running the Strategy on a 3000 tick chart of NQ, but want to place the orders on MNQ. Since the tick charts of both are not the same, I can't run this on MNQ.
    Please let me know if there is a way of providing the instrument name in the market order.
    Cheers!

    #2
    Hello kashmiami,

    Thanks for your post.

    The MNQ instrument could be added to the script using the AddDataSeries() method.

    Then, you would specify the barsInProgressIndex that you want to submit the order to when calling the Enter method.

    EnterLong(int barsInProgressIndex, int quantity, string signalName)

    If the MNQ instrument is the first added series in the script, you would pass in a 1 for the barsInProgressIndex when calling the Entry method.

    For example, EnterLong(1, 1, "longEntry");

    See the help guide documentation below for more information.

    AddDataSeries: https://ninjatrader.com/support/help...dataseries.htm
    BarsInProgress: https://ninjatrader.com/support/help...inprogress.htm
    Working with Multi-Timeframe/Multi-Instrument NinjaScripts: https://ninjatrader.com/support/help...nstruments.htm
    Managed Approach Order Methods: https://ninjatrader.com/support/help...d_approach.htm

    Here is a reference sample demonstrating submitting orders to an added series: https://ninjatrader.com/support/help...ipt_strate.htm
    <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

    Comment


      #3
      Appreciate the help, Thank you!

      Comment


        #4
        Tried this approach. The new data series seems to work if the instrument is NQ, but it does not work when the instrument is MNQ.
        The code below prints the bar numbers for the primary. When I add NQ, it prints the numbers, but when I add MNQ, it always stays at -1, which tells me it is not being configured.
        Please advise.

        if (State == State.Configure)
        {
        AddDataSeries("MNQ 09-23", Data.BarsPeriodType.Tick, 100);

        }​

        Print( "Primary Current bar " + CurrentBars[0] );
        Print( "Secondary Current bar " + CurrentBars[1] );

        Comment


          #5
          No, that tells you that you do not have that data to load, or that your indicator is crashing with an exception before it gets to that point in OnStateChange because of some code not posted. Try opening a MNQ 09-23 chart of 100 tick bars, then try this again. And check your Control Center Log tab for orange error lines.
          Bruce DeVault
          QuantKey Trading Vendor Services
          NinjaTrader Ecosystem Vendor - QuantKey

          Comment


            #6
            Hello kashmiami,

            Thanks for your notes.

            QuantKey_Bruce is correct. Please try opening a MNQ 09-23 100-Tick chart to make sure you see historical and realtime data populating on the chart.

            Then, enable your script on a separate NQ chart and check for any error messages in the Log tab of the Control Center to see if an error is occurring when running the script.

            Note to ensure that you have a CurrentBars check in your script to make sure you have enough bars in the series you are accessing.

            CurrentBars - https://ninjatrader.com/support/help...urrentbars.htm
            Make sure you have enough bars - https://ninjatrader.com/support/help...nough_bars.htm
            <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

            Comment


              #7
              It was the data, I was not connected. Thank you both!

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by NullPointStrategies, Today, 05:17 AM
              0 responses
              50 views
              0 likes
              Last Post NullPointStrategies  
              Started by argusthome, 03-08-2026, 10:06 AM
              0 responses
              126 views
              0 likes
              Last Post argusthome  
              Started by NabilKhattabi, 03-06-2026, 11:18 AM
              0 responses
              69 views
              0 likes
              Last Post NabilKhattabi  
              Started by Deep42, 03-06-2026, 12:28 AM
              0 responses
              42 views
              0 likes
              Last Post Deep42
              by Deep42
               
              Started by TheRealMorford, 03-05-2026, 06:15 PM
              0 responses
              46 views
              0 likes
              Last Post TheRealMorford  
              Working...
              X