Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

the instrument for trading in a strategy

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

    the instrument for trading in a strategy

    I have a strategy has two additional data series

    else if (State == State.Configure)
    {
    // Add 1-minute series
    AddDataSeries("NQ MAR25", Data.BarsPeriodType.Minute, 1, Data.MarketDataType.Last);

    // Add 100-tick series
    AddDataSeries("NQ MAR25", Data.BarsPeriodType.Tick, 100, Data.MarketDataType.Last);

    I opened a MNQ chart and applied this strategy. I thought it would buy/sell MNQ. However, it traded NQ instead. What is the wrong setting?​

    #2
    What is your entry code? Simply adding a series wouldn't cause it to trade outside of main instrument.

    Comment


      #3
      Here is

      if (Position.MarketPosition == MarketPosition.Flat)
      {
      FirstTrade=true;
      }
      else
      {
      FirstTrade=false;
      }


      if (((magic1.Signal_Trend[0] == 1)||(magic.Signal_Trend[0] == 2))
      &&FirstTrade==true)
      {
      EnterLong(Convert.ToInt32(Quantity), "");
      }

      // Set 2
      if (((magic.Signal_Trend[0] == -1)||(magic.Signal_Trend[0] == -2))
      &&FirstTrade==true)
      {
      EnterShort(Convert.ToInt32(Quantity), "");

      And I also specified the first trade happened at 15:59PM eastern time. I checked the executed order, the first order did got executed at 15:59. The weird thing is I check the control center at 16:05PM, I didn't see any position. And I didn't get any order filled notification from Ninjatrader app at me cell phone until a margin call notification.​

      Comment


        #4
        Are you sure the NQ trade was because of the strategy? Or were you on the NQ by mistake? I'm not seeing anything from what you've provided that would case the entry to enter on anything other than the main instrument. Are there logs of the order?

        Comment


          #5
          100% sure. I just applied this strategy to MNQ chart with sim01 account. The backtest result does show it trades NQ instead of MNQ.

          Comment


            #6
            Do you have any other part of your code that uses the other data series? Is it possible the entries are within a portion of the code accessing these other data series?

            Comment


              #7
              Hello Playdc,

              Thank you for your post.

              You will either need to filter out the logic by BarsInProgress so you are only submitting orders on the primary data series (BIP = 0), or use the entry method overloads that allow you to specify what bars object you are submitting the orders to.

              BarsInProgress 0 would be the primary data series.

              BarsInProgress - https://ninjatrader.com/support/help...inprogress.htm


              Below are examples of the overloads that allow you to specify the index of the bars object the order is being submitted to.

              EnterLong(int barsInProgressIndex, int quantity, string signalName)

              EnterShort(int barsInProgressIndex, int quantity, string signalName)



              Comment


                #8
                Thank you for clarification, Gaby.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by NullPointStrategies, Today, 05:17 AM
                0 responses
                20 views
                0 likes
                Last Post NullPointStrategies  
                Started by argusthome, 03-08-2026, 10:06 AM
                0 responses
                119 views
                0 likes
                Last Post argusthome  
                Started by NabilKhattabi, 03-06-2026, 11:18 AM
                0 responses
                63 views
                0 likes
                Last Post NabilKhattabi  
                Started by Deep42, 03-06-2026, 12:28 AM
                0 responses
                41 views
                0 likes
                Last Post Deep42
                by Deep42
                 
                Started by TheRealMorford, 03-05-2026, 06:15 PM
                0 responses
                45 views
                0 likes
                Last Post TheRealMorford  
                Working...
                X